commit | a2f7ab57eec0a8bb8ffa80ea880e1a76cd6da1be | [log] [tgz] |
---|---|---|
author | Michael Blow <michael.blow@couchbase.com> | Sun Oct 29 20:42:25 2023 -0400 |
committer | Michael Blow <michael.blow@couchbase.com> | Sun Oct 29 20:42:25 2023 -0400 |
tree | 8fd40549a2f1ca1d10f1f0f5dcae9fbccda439ea | |
parent | 56243541c0c67ba5107839ffbfa35451d73f03b4 [diff] | |
parent | fc29c99d30e991c7e927380773159ca8caed4fec [diff] |
Merge branch 'gerrit/trinity' into 'master' Change-Id: Ib4f12c79fdfe5c0ba3a79c45b304e815a600b097
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/IndexCheckpointManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/IndexCheckpointManager.java index 2e43397..77a4f19 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/IndexCheckpointManager.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/IndexCheckpointManager.java
@@ -129,6 +129,11 @@ } @Override + public synchronized boolean isValidIndex() throws HyracksDataException { + return getCheckpointCount() > 0; + } + + @Override public long getValidComponentSequence() throws HyracksDataException { if (getCheckpointCount() > 0) { return getLatest().getValidComponentSequence();
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/IIndexCheckpointManager.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/IIndexCheckpointManager.java index c43f4f0..75557ec 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/IIndexCheckpointManager.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/IIndexCheckpointManager.java
@@ -142,4 +142,12 @@ * @throws HyracksDataException */ void setLastComponentId(long componentId) throws HyracksDataException; + + /** + * Indicates that the index has at least one valid checkpoint + * + * @return true if the index has at least one valid checkpoint. Otherwise false + * @throws HyracksDataException + */ + boolean isValidIndex() throws HyracksDataException; }
diff --git a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/logging/RemoteLogsNotifier.java b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/logging/RemoteLogsNotifier.java index 80bb3c8..42a3c0b 100644 --- a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/logging/RemoteLogsNotifier.java +++ b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/logging/RemoteLogsNotifier.java
@@ -96,7 +96,9 @@ for (DatasetResourceReference replicaIndexRef : replicaIndexesRef) { final IIndexCheckpointManager indexCheckpointManager = indexCheckpointManagerProvider.get(replicaIndexRef); synchronized (indexCheckpointManager) { - indexCheckpointManager.masterFlush(remoteLogMapping.getMasterLsn(), remoteLogMapping.getLSN()); + if (indexCheckpointManager.isValidIndex()) { + indexCheckpointManager.masterFlush(remoteLogMapping.getMasterLsn(), remoteLogMapping.getLSN()); + } } } }