Examples of ReplicationMap


Examples of com.splout.db.common.ReplicationMap

    SploutConfiguration config = SploutConfiguration.getTestConfig();
    DNode dnode = TestUtils.getTestDNode(config, dHandler, "dnode-" + this.getClass().getName() + "-6");
    try {
      ReplicationEntry repEntry = new ReplicationEntry(0, dnode.getAddress());
      Tablespace tablespace1 = new Tablespace(PartitionMap.oneShardOpenedMap(), new ReplicationMap(
          Arrays.asList(repEntry)), 0l, 0l);
      handler.getContext().getTablespaceVersionsMap()
          .put(new TablespaceVersion("tablespace1", 0l), tablespace1);
      handler.getContext().getCurrentVersionsMap().put("tablespace1", 0l);
View Full Code Here

Examples of com.splout.db.common.ReplicationMap

      replicationEntries.add(repEntry);
    }
    // A valid partition map is complete: first min is null and last max is null.
    partitions.get(0).setMin(null);
    partitions.get(partitions.size() - 1).setMax(null);
    return new Tablespace(new PartitionMap(partitions), new ReplicationMap(replicationEntries), 0l, 0l);
  }
View Full Code Here

Examples of com.splout.db.common.ReplicationMap

        try {
          boolean dnode1NotPresent = true;
          for(int i = 0; i < N_QNODES; i++) {
            Map.Entry<String, Tablespace> tEntry = clients[i].overview().getTablespaceMap().entrySet()
                .iterator().next();
            ReplicationMap currentReplicationMap = tEntry.getValue().getReplicationMap();
            for(ReplicationEntry entry : currentReplicationMap.getReplicationEntries()) {
              if(entry.getNodes().contains(dnode1.getAddress())) {
                dnode1NotPresent = false;
              }
            }
          }
          return dnode1NotPresent;
        } catch(IOException e) {
          // test failed
          e.printStackTrace();
          return true;
        }
      }
    }.waitAtMost(5000);

    // waiting now until the system recovers itself without dnode1
    new TestUtils.NotWaitingForeverCondition() {

      @Override
      public boolean endCondition() {
        try {
          boolean balanced = true;
          for(int i = 0; i < N_QNODES; i++) {
            Map.Entry<String, Tablespace> tEntry = clients[i].overview().getTablespaceMap().entrySet()
                .iterator().next();
            ReplicationMap currentReplicationMap = tEntry.getValue().getReplicationMap();
            for(ReplicationEntry entry : currentReplicationMap.getReplicationEntries()) {
              if(entry.getNodes().size() < entry.getExpectedReplicationFactor()) {
                balanced = false;
              }
            }
          }
          return balanced;
        } catch(IOException e) {
          // test failed
          e.printStackTrace();
          return true;
        }
      }
    }.waitAtMost(5000);

    // now we bring back dnode1 to life
    // what will happen now is that the partitions it seves will be over-replicated
    dnode1.testCommand(TestCommands.RESTART.toString());

    // waiting now until the system is over-replicated
    new TestUtils.NotWaitingForeverCondition() {

      @Override
      public boolean endCondition() {
        try {
          boolean overreplicated = true;
          for(int i = 0; i < N_QNODES; i++) {
            Map.Entry<String, Tablespace> tEntry = clients[i].overview().getTablespaceMap().entrySet()
                .iterator().next();
            ReplicationMap currentReplicationMap = tEntry.getValue().getReplicationMap();
            for(ReplicationEntry entry : currentReplicationMap.getReplicationEntries()) {
              if(partitionsByNode1.contains(entry.getShard())
                  && entry.getNodes().size() <= entry.getExpectedReplicationFactor()) {
                overreplicated = false;
              }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.