Package com.splout.db.hazelcast

Examples of com.splout.db.hazelcast.TablespaceVersion


    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);

      // Query key 2 (> 1 < 10)
      QueryStatus qStatus = handler.query("tablespace1", "2", "SELECT 1;", null);
      Assert.assertEquals(new Integer(0), qStatus.getShard());
View Full Code Here


    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);

      // Query shard 0
      QueryStatus qStatus = handler.query("tablespace1", null, "SELECT 1;", "0");
      Assert.assertEquals(new Integer(0), qStatus.getShard());
View Full Code Here

    Long version = context.getCurrentVersionsMap().get(tablespaceName);
    if(version == null) {
      return new ErrorQueryStatus("Unknown tablespace or no version ready to be served! (" + tablespaceName + ")");
    }
    Tablespace tablespace = context.getTablespaceVersionsMap().get(
        new TablespaceVersion(tablespaceName, version));
    if(tablespace == null) {
      return new ErrorQueryStatus("Unknown tablespace version:(" + version +") tablespace:(" + tablespaceName + ")");
    }
    PartitionMap partitionMap = tablespace.getPartitionMap();
   
View Full Code Here

    Long version = context.getCurrentVersionsMap().get(tablespaceName);
    if(version == null) {
      return new ErrorQueryStatus("Unknown tablespace! (" + tablespaceName + ")");
    }
    Tablespace tablespace = context.getTablespaceVersionsMap().get(
        new TablespaceVersion(tablespaceName, version));
    if(tablespace == null) {
      return new ErrorQueryStatus("Unknown tablespace! (" + tablespaceName + ")");
    }
    ReplicationMap replicationMap = tablespace.getReplicationMap();
    ReplicationEntry repEntry = null;
View Full Code Here

      if(versionsTable != null) {
        newVersionsTable.putAll(versionsTable);
      }

      for(SwitchVersionRequest req : switchRequest) {
        TablespaceVersion tsv = new TablespaceVersion(req.getTablespace(), req.getVersion());
        newVersionsTable.put(tsv.getTablespace(), tsv.getVersion());
      }
    } while(!context.getCoordinationStructures().updateVersionsBeingServed(versionsTable,
        newVersionsTable));
  }
View Full Code Here

        replicationEntries.add(repEntry);
      }

      Tablespace tablespace1 = new Tablespace(new PartitionMap(partitions), new ReplicationMap(replicationEntries), 1l,
          0l);
      handler.getContext().getTablespaceVersionsMap().put(new TablespaceVersion("tablespace1", 1l), tablespace1);
      handler.getContext().getCurrentVersionsMap().put("tablespace1", 1l);

      // The following has to be read as: multi-query range [23-25)
      // The impacted shard will be 1 [20-30)
      List<String> keyMins = Arrays.asList(new String[] { "23" });
View Full Code Here

          Iterator<SwitchVersionRequest> it = versionsToCheck.iterator();
          while(it.hasNext()) {
            SwitchVersionRequest req = it.next();
            Tablespace t = context.getTablespaceVersionsMap().get(
                new TablespaceVersion(req.getTablespace(), req.getVersion()));
            // Check that this TablespaceVersion has been reported by some node through Hazelcast
            if(t != null && t.getReplicationMap() != null && t.getPartitionMap() != null
                && t.getPartitionMap().getPartitionEntries() != null
                && t.getReplicationMap().getReplicationEntries() != null
                && t.getReplicationMap().getReplicationEntries().size() > 0) {
View Full Code Here

    List<ReplicationEntry> rEntries = new ArrayList<ReplicationEntry>();
    rEntries.add(new ReplicationEntry(0, "localhost:4444", "localhost:5555", "localhost:6666"));

    Tablespace tablespace = new Tablespace(PartitionMap.oneShardOpenedMap(), new ReplicationMap(rEntries), 0, 0);
    context.getTablespaceVersionsMap().put(new TablespaceVersion("t1", 0l), tablespace);
    context.getCurrentVersionsMap().put("t1", 0l);

    Querier querier = new Querier(context);
   
    // All DNodes are tried since they are alive and because all including the last one fail, the error is returned
View Full Code Here

        String tablespaceName = tablespaceEntry.getKey();
        // Iterate over all versions of this tablespace
        for(Map.Entry<Long, Map<Integer, PartitionMetadata>> versionEntry : tablespaceEntry.getValue()
            .entrySet()) {
          Long versionName = versionEntry.getKey();
          TablespaceVersion tablespaceVersion = new TablespaceVersion(tablespaceName, versionName);
          Tablespace currentTablespace = tablespaceVersionMap.get(tablespaceVersion);
          List<PartitionEntry> partitionMap = new ArrayList<PartitionEntry>();
          List<ReplicationEntry> replicationMap = new ArrayList<ReplicationEntry>();
          long deployDate = -1;
          if(currentTablespace != null) {
View Full Code Here

    rEntries.add(new ReplicationEntry(0, dnode1.getAddress(), dnode2.getAddress()));

    QNodeHandlerContext context = new QNodeHandlerContext(testConfig, null);
   
    Tablespace tablespace = new Tablespace(PartitionMap.oneShardOpenedMap(), new ReplicationMap(rEntries), 0, 0);
    context.getTablespaceVersionsMap().put(new TablespaceVersion("t1", 0l), tablespace);
    context.getCurrentVersionsMap().put("t1", 0l);

    Querier querier = new Querier(context);
   
    /*
 
View Full Code Here

TOP

Related Classes of com.splout.db.hazelcast.TablespaceVersion

Copyright © 2018 www.massapicom. 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.