@Test public void getRangeAtBoundThresholdIdentifiesTheCorrectRange() { InternalSchemaMetadata internalSchemaMetadata = InternalSchemaMetadata.builder() .timestampToTransactionsTableSchemaVersion( TimestampPartitioningMap.of( ImmutableRangeMap.<Long, Integer>builder() .put(Range.closedOpen(1L, TIMESTAMP_1), 1) .put(Range.closedOpen(TIMESTAMP_1, TIMESTAMP_2), 2) .put(Range.atLeast(TIMESTAMP_2), 3) .build())) .build(); assertThat(manager.getRangeAtBoundThreshold(ValueAndBound.of(internalSchemaMetadata, 1L))).satisfies( entry -> { assertThat(entry.getKey()).isEqualTo(Range.closedOpen(1L, TIMESTAMP_1)); assertThat(entry.getValue()).isEqualTo(1); }); assertThat(manager.getRangeAtBoundThreshold(ValueAndBound.of(internalSchemaMetadata, TIMESTAMP_1))).satisfies( entry -> { assertThat(entry.getKey()).isEqualTo(Range.closedOpen(TIMESTAMP_1, TIMESTAMP_2)); assertThat(entry.getValue()).isEqualTo(2); }); assertThat(manager.getRangeAtBoundThreshold(ValueAndBound.of(internalSchemaMetadata, TIMESTAMP_2))).satisfies( entry -> { assertThat(entry.getKey()).isEqualTo(Range.atLeast(TIMESTAMP_2)); assertThat(entry.getValue()).isEqualTo(3); }); }
@VisibleForTesting Map.Entry<Range<Long>, Integer> getRangeAtBoundThreshold(ValueAndBound<InternalSchemaMetadata> valueAndBound) { return valueAndBound.value() .orElseThrow(() -> new SafeIllegalStateException("Unexpectedly found no value in store")) .timestampToTransactionsTableSchemaVersion() .rangeMapView() .getEntry(valueAndBound.bound()); }
TransactionSchemaManager { @VisibleForTesting Map.Entry<Range<Long>, Integer> getRangeAtBoundThreshold(ValueAndBound<InternalSchemaMetadata> valueAndBound) { return valueAndBound.value() .orElseThrow(() -> new SafeIllegalStateException("Unexpectedly found no value in store")) .timestampToTransactionsTableSchemaVersion() .rangeMapView() .getEntry(valueAndBound.bound()); } }
TransactionSchemaManager { @VisibleForTesting Map.Entry<Range<Long>, Integer> getRangeAtBoundThreshold(ValueAndBound<InternalSchemaMetadata> valueAndBound) { return valueAndBound.value() .orElseThrow(() -> new SafeIllegalStateException("Unexpectedly found no value in store")) .timestampToTransactionsTableSchemaVersion() .rangeMapView() .getEntry(valueAndBound.bound()); } TransactionSchemaManager(CoordinationService<InternalSchemaMetadata> coordinationService); }
TransactionSchemaManager { @VisibleForTesting Map.Entry<Range<Long>, Integer> getRangeAtBoundThreshold(ValueAndBound<InternalSchemaMetadata> valueAndBound) { return valueAndBound.value() .orElseThrow(() -> new SafeIllegalStateException("Unexpectedly found no value in store")) .timestampToTransactionsTableSchemaVersion() .rangeMapView() .getEntry(valueAndBound.bound()); } TransactionSchemaManager(CoordinationService<InternalSchemaMetadata> coordinationService); int getTransactionsSchemaVersion(long timestamp); boolean tryInstallNewTransactionsSchemaVersion(int newVersion); }
TransactionSchemaManager { @VisibleForTesting Map.Entry<Range<Long>, Integer> getRangeAtBoundThreshold(ValueAndBound<InternalSchemaMetadata> valueAndBound) { return valueAndBound.value() .orElseThrow(() -> new SafeIllegalStateException("Unexpectedly found no value in store")) .timestampToTransactionsTableSchemaVersion() .rangeMapView() .getEntry(valueAndBound.bound()); } TransactionSchemaManager(CoordinationService<InternalSchemaMetadata> coordinationService); int getTransactionsSchemaVersion(long timestamp); boolean tryInstallNewTransactionsSchemaVersion(int newVersion);  }