These are chat archives for atomix/atomix

Jan 2017
Tyler Foster
Jan 06 2017 14:08
Cool, sounds good. If it's just a couple lines on top of some unmerged code you have, do you just bang it out and I can pick up some bigger chunk to contribute?
Jan 06 2017 15:08
Hi. I am a complete noob here and just getting started with atomix. I tried to test starting a cluster with 3 replicas but I for some reason am unable to start even a single one.
The code gets stuck at the replica.bootstrap(clusters).join() part
It just waits there forever.
I don't know if this is the right place to paste code. My apologies in advance.
  List<Address> cluster = Arrays.asList(new Address("localhost", 8700),
            new Address("localhost", 8701), new Address("localhost", 8702));

    Storage storage = getStorage("atomixlogs");
    Transport transport = new NettyTransport();

    AtomixReplica replica1 = AtomixReplica.builder(cluster.get(0)).build();

    AtomixReplica replica2 = AtomixReplica.builder(cluster.get(1)).withStorage(storage)

    AtomixReplica replica3 = AtomixReplica.builder(cluster.get(2)).withStorage(storage)

    DistributedValue<String> value2 = replica2.<String> getValue("myKey").join();
    value2.set("Hello world!").join();

    DistributedValue<String> value1 = replica1.<String> getValue("myKey").join();
    value1.get().thenAccept(result -> {
        System.out.println("The value1 is " + result);

    DistributedValue<String> value3 = replica3.<String> getValue("myKey").join();
    value3.get().thenAccept(result -> {
        System.out.println("The value3 is " + result);
The method getStorage is pretty straight forward:
return Storage.builder().withDirectory(new File(filePath))
Jan 06 2017 15:13
Any help is appreciated. Thanks.
Jordan Halterman
Jan 06 2017 20:33

So, the reason your replicas aren't starting is because they're all bootstrapping in the same thread. The problem is when the first replica is bootstrapped, it's given a three node cluster. That's fine, but in order to start the replica fully it has to be able to communicate with at least one another node (a majority of the cluster has to be started). So, when the first replica is bootstrapped, it's the only node that can communicate in a three node cluster, so it will try to start the cluster until it's able to communicate with one another node, which will never happen in this code.

There are a couple of things you can do. First, you can call bootstrap on all three replicas but don't call join on the CompletableFuture until after bootstrap on all three nodes. Then they'll all be bootstrapping at the same time. Alternatively, you can bootstrap the first node and then join the other two to the first one by calling join(firstAddress). That will start the cluster with one node, add the second node, then add the third node.

I should say the problem is the first node is bootstrapping a three node cluster, but blocking before the other nodes have been started. In order for a three node cluster to be bootstrapped, and least two replicas must be started.
Jordan Halterman
Jan 06 2017 21:12
@hazemkmammu ^^