Skip to content

Commit

Permalink
misc-3 (#200)
Browse files Browse the repository at this point in the history
* misc clean up

* parameterize aux population update duration.

use different mechanism to determine if redirect

* allow dups in view gossip

* revert back to trace

* back off on durations

* back to single threaded tests

* extend

* arg

* handle bootstrapping context
  • Loading branch information
Hellblazer committed May 24, 2024
1 parent 781f564 commit ccdf34d
Show file tree
Hide file tree
Showing 18 changed files with 239 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
cache: 'maven'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build with Maven
run: ./mvnw -batch-mode clean install -Dforks=4 -Ppre --file pom.xml
run: ./mvnw -batch-mode clean install -Dforks=1 -Ppre --file pom.xml
13 changes: 7 additions & 6 deletions choam/src/main/java/com/salesforce/apollo/choam/CHOAM.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package com.salesforce.apollo.choam;

import com.chiralbehaviors.tron.Fsm;
import com.google.common.base.Function;
import com.google.protobuf.ByteString;
import com.google.protobuf.Empty;
import com.google.protobuf.InvalidProtocolBufferException;
Expand Down Expand Up @@ -56,6 +55,7 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -109,10 +109,9 @@ public CHOAM(Parameters params) {

rotateViewKeys();
var bContext = new DelegatedContext<>(params.context());
var adapter = new MessageAdapter(_ -> true, (Function<ByteString, Digest>) this::signatureHash,
(Function<ByteString, List<Digest>>) _ -> Collections.emptyList(),
(_, any) -> any,
(Function<AgedMessageOrBuilder, ByteString>) AgedMessageOrBuilder::getContent);
var adapter = new MessageAdapter(_ -> true, this::signatureHash,
_ -> Collections.emptyList(),
(_, any) -> any, AgedMessageOrBuilder::getContent);

combine = new ReliableBroadcaster(bContext, params.member(), params.combine(), params.communications(),
params.metrics() == null ? null : params.metrics().getCombineMetrics(),
Expand Down Expand Up @@ -234,7 +233,9 @@ public static Block reconfigure(Digest nextViewId, Map<Digest, Join> joins, Hash
}

public static Map<Digest, Member> rosterMap(Context<Member> baseContext, Collection<Digest> members) {
return members.stream().collect(Collectors.toMap(m -> m, baseContext::getMember));
return members.stream()
.map(baseContext::getMember)
.collect(Collectors.toMap(Member::getId, Function.identity()));
}

public static List<Transaction> toGenesisData(List<? extends Message> initializationData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package com.salesforce.apollo.choam;

import com.codahale.metrics.Timer;
import com.google.common.base.Function;
import com.google.protobuf.Message;
import com.netflix.concurrency.limits.Limiter;
import com.netflix.concurrency.limits.internal.EmptyMetricRegistry;
Expand All @@ -33,6 +32,7 @@
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.function.Supplier;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,14 @@ public void setUp() throws Exception {

@Test
public void smokin() throws Exception {

var bootstrap = members.subList(0, 4);
var kernel = bootstrap.get(0);
contexts.get(kernel).activate(kernel);
routers.get(kernel).start();
choams.get(kernel).start();

bootstrap.forEach(member -> bootstrap.forEach(m -> contexts.get(member).activate(m)));

bootstrap.forEach(member -> bootstrap.forEach(m -> contexts.get(member).activate(m)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public void before() throws Exception {
var params = Parameters.newBuilder()
.setGenerateGenesis(true)
.setGenesisViewId(origin.prefix(entropy.nextLong()))
.setGossipDuration(Duration.ofMillis(20))
.setGossipDuration(Duration.ofMillis(30))
.setProducer(ProducerParameters.newBuilder()
.setMaxBatchCount(15_000)
.setMaxBatchByteSize(200 * 1024 * 1024)
.setGossipDuration(Duration.ofMillis(10))
.setGossipDuration(Duration.ofMillis(30))
.setBatchInterval(Duration.ofMillis(50))
.setEthereal(Config.newBuilder()
.setNumberOfEpochs(3)
Expand Down Expand Up @@ -191,7 +191,7 @@ public void submitMultiplTxn() throws Exception {

transactioneers.stream().forEach(e -> e.start());
try {
final var complete = countdown.await(LARGE_TESTS ? 3200 : 60, TimeUnit.SECONDS);
final var complete = countdown.await(LARGE_TESTS ? 3200 : 120, TimeUnit.SECONDS);
assertTrue(complete, "All clients did not complete: " + transactioneers.stream()
.map(t -> t.getCompleted())
.filter(i -> i < max)
Expand Down

0 comments on commit ccdf34d

Please sign in to comment.