tkalkirill commented on code in PR #1011:
URL: https://github.com/apache/ignite-3/pull/1011#discussion_r946647242
##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbTableStorage.java:
##########
@@ -223,10 +232,63 @@ public void start() throws StorageException {
}
}
+ /**
+ * Returns a future to wait next flush operation from the current point in
time. Uses {@link RocksDB#getLatestSequenceNumber()} to
+ * achieve this.
+ *
+ * @param schedule {@code true} if {@link RocksDB#flush(FlushOptions)}
should be explicitly triggerred in the near future.
+ *
+ * @see #scheduleFlush()
+ */
+ public CompletableFuture<Void> awaitFlush(boolean schedule) {
+ CompletableFuture<Void> future;
+
+ long dbSequenceNumber = db.getLatestSequenceNumber();
+
+ synchronized (this) {
+ if (dbSequenceNumber <= latestPersistedSequenceNumber) {
+ return CompletableFuture.completedFuture(null);
+ }
+
+ future =
flushFuturesBySequenceNumber.computeIfAbsent(dbSequenceNumber, l -> new
CompletableFuture<>());
+ }
+
+ if (schedule) {
+ scheduleFlush();
+ }
+
+ return future;
+ }
+
+ /**
+ * Completes all futures in {@link #flushFuturesBySequenceNumber} up to a
given sequence number.
+ */
+ void completeFutures(long sequenceNumber) {
+ synchronized (this) {
Review Comment:
Why not mux?
##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbTableStorage.java:
##########
@@ -223,10 +232,63 @@ public void start() throws StorageException {
}
}
+ /**
+ * Returns a future to wait next flush operation from the current point in
time. Uses {@link RocksDB#getLatestSequenceNumber()} to
+ * achieve this.
+ *
+ * @param schedule {@code true} if {@link RocksDB#flush(FlushOptions)}
should be explicitly triggerred in the near future.
+ *
+ * @see #scheduleFlush()
+ */
+ public CompletableFuture<Void> awaitFlush(boolean schedule) {
+ CompletableFuture<Void> future;
+
+ long dbSequenceNumber = db.getLatestSequenceNumber();
+
+ synchronized (this) {
Review Comment:
Why not mux?
##########
modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbTableStorageTest.java:
##########
@@ -97,15 +97,6 @@ public void setUp(
assertThat(((RocksDbDataStorageView)
tableCfg.dataStorage().value()).dataRegion(),
equalTo(DEFAULT_DATA_REGION_NAME));
- CompletableFuture<Void> changeEngineFuture =
rocksDbEngineConfig.defaultRegion()
Review Comment:
Why remove?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]