final byte[] endKeyGroupBytes = new byte[keyGroupPrefixBytes]; if (currentKeyGroupRange.getStartKeyGroup() < targetKeyGroupRange.getStartKeyGroup()) { RocksDBKeySerializationUtils.serializeKeyGroup( currentKeyGroupRange.getStartKeyGroup(), beginKeyGroupBytes); RocksDBKeySerializationUtils.serializeKeyGroup( targetKeyGroupRange.getStartKeyGroup(), endKeyGroupBytes); deleteRange(db, columnFamilyHandles, beginKeyGroupBytes, endKeyGroupBytes);
RocksDBKeySerializationUtils.serializeKeyGroup(stateBackend.getKeyGroupRange().getStartKeyGroup(), startKeyGroupPrefixBytes);
createAndStartInternalTimerService(mockTriggerable, keyContext, processingTimeService, testKeyGroupRange, queueFactory); int midpoint = testKeyGroupRange.getStartKeyGroup() + (testKeyGroupRange.getEndKeyGroup() - testKeyGroupRange.getStartKeyGroup()) / 2; KeyGroupRange subKeyGroupRange1 = new KeyGroupRange(testKeyGroupRange.getStartKeyGroup(), midpoint); KeyGroupRange subKeyGroupRange2 = new KeyGroupRange(midpoint + 1, testKeyGroupRange.getEndKeyGroup());
private int computeKeyGroupIndex(int keyGroup) { int idx = keyGroup - keyGroupRange.getStartKeyGroup(); if (idx < 0 || idx >= offsets.length) { throw new IllegalArgumentException("Key group " + keyGroup + " is not in " + keyGroupRange + "."); } return idx; }
private int computeKeyGroupIndex(int keyGroup) { int idx = keyGroup - keyGroupRange.getStartKeyGroup(); if (idx < 0 || idx >= offsets.length) { throw new IllegalArgumentException("Key group " + keyGroup + " is not in " + keyGroupRange + "."); } return idx; }
private int computeKeyGroupIndex(int keyGroup) { int idx = keyGroup - keyGroupRange.getStartKeyGroup(); if (idx < 0 || idx >= offsets.length) { throw new IllegalArgumentException("Key group " + keyGroup + " is not in " + keyGroupRange + "."); } return idx; }
private int computeKeyGroupIndex(int keyGroup) { int idx = keyGroup - keyGroupRange.getStartKeyGroup(); if (idx < 0 || idx >= offsets.length) { throw new IllegalArgumentException("Key group " + keyGroup + " is not in " + keyGroupRange + "."); } return idx; }
@Override public Tuple2<Integer, Long> next() { Integer currentKeyGroup = keyGroupIterator.next(); Tuple2<Integer,Long> result = new Tuple2<>( currentKeyGroup, offsets[currentKeyGroup - keyGroupRange.getStartKeyGroup()]); return result; }
@Override public Tuple2<Integer, Long> next() { Integer currentKeyGroup = keyGroupIterator.next(); Tuple2<Integer,Long> result = new Tuple2<>( currentKeyGroup, offsets[currentKeyGroup - keyGroupRange.getStartKeyGroup()]); return result; }
@Override public Tuple2<Integer, Long> next() { Integer currentKeyGroup = keyGroupIterator.next(); Tuple2<Integer,Long> result = new Tuple2<>( currentKeyGroup, offsets[currentKeyGroup - keyGroupRange.getStartKeyGroup()]); return result; }
@Override public Tuple2<Integer, Long> next() { Integer currentKeyGroup = keyGroupIterator.next(); Tuple2<Integer,Long> result = new Tuple2<>( currentKeyGroup, offsets[currentKeyGroup - keyGroupRange.getStartKeyGroup()]); return result; }
private int globalKeyGroupToLocalIndex(int keyGroup) { checkArgument(keyGroupRange.contains(keyGroup)); return keyGroup - keyGroupRange.getStartKeyGroup(); }
private int globalKeyGroupToLocalIndex(int keyGroup) { checkArgument(keyGroupRange.contains(keyGroup)); return keyGroup - keyGroupRange.getStartKeyGroup(); }
private static void serializeRawKeyedStateHandle( KeyedStateHandle stateHandle, DataOutputStream dos) throws IOException { if (stateHandle == null) { dos.writeByte(NULL_HANDLE); } else if (stateHandle instanceof KeyGroupsStateHandle) { KeyGroupsStateHandle keyGroupsStateHandle = (KeyGroupsStateHandle) stateHandle; dos.writeByte(KEY_GROUPS_HANDLE); dos.writeInt(keyGroupsStateHandle.getKeyGroupRange().getStartKeyGroup()); dos.writeInt(keyGroupsStateHandle.getKeyGroupRange().getNumberOfKeyGroups()); for (int keyGroup : keyGroupsStateHandle.getKeyGroupRange()) { dos.writeLong(keyGroupsStateHandle.getOffsetForKeyGroup(keyGroup)); } serializeStreamStateHandle(keyGroupsStateHandle.getDelegateStateHandle(), dos); } else { throw new IllegalStateException("Unknown RawKeyedStateHandle type: " + stateHandle.getClass()); } }
/** * Creates a new {@link NestedMapsStateTable} for the given key context and meta info. * * @param keyContext the key context. * @param metaInfo the meta information for this state table. */ public NestedMapsStateTable(InternalKeyContext<K> keyContext, RegisteredKeyValueStateBackendMetaInfo<N, S> metaInfo) { super(keyContext, metaInfo); this.keyGroupOffset = keyContext.getKeyGroupRange().getStartKeyGroup(); @SuppressWarnings("unchecked") Map<N, Map<K, S>>[] state = (Map<N, Map<K, S>>[]) new Map[keyContext.getKeyGroupRange().getNumberOfKeyGroups()]; this.state = state; }
@VisibleForTesting public static void serializeKeyedStateHandle( KeyedStateHandle stateHandle, DataOutputStream dos) throws IOException { if (stateHandle == null) { dos.writeByte(NULL_HANDLE); } else if (stateHandle instanceof KeyGroupsStateHandle) { KeyGroupsStateHandle keyGroupsStateHandle = (KeyGroupsStateHandle) stateHandle; dos.writeByte(KEY_GROUPS_HANDLE); dos.writeInt(keyGroupsStateHandle.getKeyGroupRange().getStartKeyGroup()); dos.writeInt(keyGroupsStateHandle.getKeyGroupRange().getNumberOfKeyGroups()); for (int keyGroup : keyGroupsStateHandle.getKeyGroupRange()) { dos.writeLong(keyGroupsStateHandle.getOffsetForKeyGroup(keyGroup)); } serializeStreamStateHandle(keyGroupsStateHandle.getDelegateStateHandle(), dos); } else { throw new IllegalStateException("Unknown KeyedStateHandle type: " + stateHandle.getClass()); } }
/** * Creates a new {@link NestedMapsStateTable} for the given key context and meta info. * * @param keyContext the key context. * @param metaInfo the meta information for this state table. */ public NestedMapsStateTable(InternalKeyContext<K> keyContext, RegisteredKeyValueStateBackendMetaInfo<N, S> metaInfo) { super(keyContext, metaInfo); this.keyGroupOffset = keyContext.getKeyGroupRange().getStartKeyGroup(); @SuppressWarnings("unchecked") Map<N, Map<K, S>>[] state = (Map<N, Map<K, S>>[]) new Map[keyContext.getKeyGroupRange().getNumberOfKeyGroups()]; this.state = state; }
/** * Creates a new {@link NestedMapsStateTable} for the given key context and meta info. * * @param keyContext the key context. * @param metaInfo the meta information for this state table. */ public NestedMapsStateTable(InternalKeyContext<K> keyContext, RegisteredKeyedBackendStateMetaInfo<N, S> metaInfo) { super(keyContext, metaInfo); this.keyGroupOffset = keyContext.getKeyGroupRange().getStartKeyGroup(); @SuppressWarnings("unchecked") Map<N, Map<K, S>>[] state = (Map<N, Map<K, S>>[]) new Map[keyContext.getKeyGroupRange().getNumberOfKeyGroups()]; this.state = state; }
/** * Creates a new {@link NestedMapsStateTable} for the given key context and meta info. * * @param keyContext the key context. * @param metaInfo the meta information for this state table. */ public NestedMapsStateTable(InternalKeyContext<K> keyContext, RegisteredKeyedBackendStateMetaInfo<N, S> metaInfo) { super(keyContext, metaInfo); this.keyGroupOffset = keyContext.getKeyGroupRange().getStartKeyGroup(); @SuppressWarnings("unchecked") Map<N, Map<K, S>>[] state = (Map<N, Map<K, S>>[]) new Map[keyContext.getKeyGroupRange().getNumberOfKeyGroups()]; this.state = state; }
/** * Creates a new {@link NestedMapsStateTable} for the given key context and meta info. */ public NestedMapsStateTable( AbstractInternalStateBackend internalStateBackend, RegisteredStateMetaInfo stateMetaInfo, boolean usingNamespace ) { super(internalStateBackend, stateMetaInfo, usingNamespace); KeyGroupRange groups = internalStateBackend.getKeyGroupRange(); this.keyGroupOffset = groups.getStartKeyGroup(); this.maxParallelism = internalStateBackend.getNumGroups(); int numberOfKeyGroups = groups.getNumberOfKeyGroups(); @SuppressWarnings("unchecked") Map[] state = new Map[numberOfKeyGroups]; this.state = state; }