@Test @Category({ OrderedKeyStoreTests.class }) public void testGetLocalKeyPartition() throws BackendException { assumeTrue(manager.getFeatures().hasLocalKeyPartition()); List<KeyRange> local = manager.getLocalKeyPartition(); assertNotNull(local); assertEquals(1, local.size()); assertNotNull(local.get(0).getStart()); assertNotNull(local.get(0).getEnd()); } }
if (storeManager.getFeatures().hasLocalKeyPartition()) {
public VertexIDAssigner(Configuration config, IDAuthority idAuthority, StoreFeatures idAuthFeatures) { Preconditions.checkNotNull(idAuthority); this.idAuthority = idAuthority; int partitionBits = NumberUtil.getPowerOf2(config.get(CLUSTER_MAX_PARTITIONS)); idManager = new IDManager(partitionBits); Preconditions.checkArgument(idManager.getPartitionBound() <= Integer.MAX_VALUE && idManager.getPartitionBound()>0); this.partitionIdBound = (int)idManager.getPartitionBound(); hasLocalPartitions = idAuthFeatures.hasLocalKeyPartition(); placementStrategy = Backend.getImplementationClass(config, config.get(PLACEMENT_STRATEGY), REGISTERED_PLACEMENT_STRATEGIES); placementStrategy.injectIDManager(idManager); log.debug("Partition IDs? [{}], Local Partitions? [{}]",true,hasLocalPartitions); long baseBlockSize = config.get(IDS_BLOCK_SIZE); idAuthority.setIDBlockSizer(new SimpleVertexIDBlockSizer(baseBlockSize)); renewTimeoutMS = config.get(IDS_RENEW_TIMEOUT); renewBufferPercentage = config.get(IDS_RENEW_BUFFER_PERCENTAGE); idPools = new ConcurrentHashMap<>(partitionIdBound); schemaIdPool = new StandardIDPool(idAuthority, IDManager.SCHEMA_PARTITION, PoolType.SCHEMA.getIDNamespace(), IDManager.getSchemaCountBound(), renewTimeoutMS, renewBufferPercentage); partitionVertexIdPool = new StandardIDPool(idAuthority, IDManager.PARTITIONED_VERTEX_PARTITION, PoolType.PARTITIONED_VERTEX.getIDNamespace(), PoolType.PARTITIONED_VERTEX.getCountBound(idManager), renewTimeoutMS, renewBufferPercentage); setLocalPartitions(partitionBits); }
@Test public void testLocalPartitionAcquisition() throws BackendException { for (int c = 0; c < CONCURRENCY; c++) { if (manager[c].getFeatures().hasLocalKeyPartition()) { try { List<KeyRange> partitions = idAuthorities[c].getLocalIDPartition(); for (KeyRange range : partitions) { assertEquals(range.getStart().length(), range.getEnd().length()); for (int i = 0; i < 2; i++) { Assert.assertTrue(range.getAt(i).length() >= 4); } } } catch (UnsupportedOperationException e) { Assert.fail(); } } } }
/** * Construct a Builder whose default values exactly match the values on * the supplied {@code template}. */ public Builder(StoreFeatures template) { unorderedScan(template.hasUnorderedScan()); orderedScan(template.hasOrderedScan()); multiQuery(template.hasMultiQuery()); locking(template.hasLocking()); batchMutation(template.hasBatchMutation()); localKeyPartition(template.hasLocalKeyPartition()); keyOrdered(template.isKeyOrdered()); distributed(template.isDistributed()); transactional(template.hasTxIsolation()); timestamps(template.hasTimestamps()); preferredTimestamps(template.getPreferredTimestamps()); cellTTL(template.hasCellTTL()); storeTTL(template.hasStoreTTL()); visibility(template.hasVisibility()); persists(template.supportsPersistence()); if (template.isKeyConsistent()) { keyConsistent(template.getKeyConsistentTxConfig(), template.getLocalKeyConsistentTxConfig()); } scanTxConfig(template.getScanTxConfig()); supportsInterruption(template.supportsInterruption()); optimisticLocking(template.hasOptimisticLocking()); }