commit | fc29c99d30e991c7e927380773159ca8caed4fec | [log] [tgz] |
---|---|---|
author | Michael Blow <michael.blow@couchbase.com> | Sat Oct 28 13:51:18 2023 -0400 |
committer | Michael Blow <michael.blow@couchbase.com> | Sat Oct 28 13:51:18 2023 -0400 |
tree | deb76c5f3c76c02b9480daa8da991172b0726f33 | |
parent | 4cb70d8dd5d4ee241062155e41a90d847fb59a46 [diff] | |
parent | 36d6b7366ba44b0a86b767e2b8698f4ff34b1e51 [diff] |
Merge branch 'gerrit/neo' into 'gerrit/trinity' Change-Id: I0f44ce0d7da3a12765f2ce9deed5910e63d733e3
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 290734f..34f0cb1 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
@@ -128,6 +128,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 beb8e07..9777879 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
@@ -140,4 +140,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()); + } } } }