This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 36d6b7366ba44b0a86b767e2b8698f4ff34b1e51
Author: Murtadha Hubail <[email protected]>
AuthorDate: Thu Oct 19 20:33:09 2023 +0300

    [ASTERIXDB-3282][STO] Exclude invalid indexes from replication checkpoint
    
    - user model changes: no
    - storage format changes: no
    - interface changes: yes
    
    Details:
    
    - When attempting to checkpoint replicated indexes, exclude invalid
      indexes since they might be in the process of being replciated for
      the first time.
    
    Change-Id: I589b8934d5ab297a0a1507130857929469e8510d
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17869
    Integration-Tests: Jenkins <[email protected]>
    Tested-by: Jenkins <[email protected]>
    Reviewed-by: Ali Alsuliman <[email protected]>
---
 .../java/org/apache/asterix/app/nc/IndexCheckpointManager.java    | 5 +++++
 .../apache/asterix/common/storage/IIndexCheckpointManager.java    | 8 ++++++++
 .../apache/asterix/replication/logging/RemoteLogsNotifier.java    | 4 +++-
 3 files changed, 16 insertions(+), 1 deletion(-)

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 290734f046..34f0cb1385 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
@@ -127,6 +127,11 @@ public class IndexCheckpointManager implements 
IIndexCheckpointManager {
         deleteHistory(Long.MAX_VALUE, 0);
     }
 
+    @Override
+    public synchronized boolean isValidIndex() throws HyracksDataException {
+        return getCheckpointCount() > 0;
+    }
+
     @Override
     public long getValidComponentSequence() throws HyracksDataException {
         if (getCheckpointCount() > 0) {
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 beb8e07e0d..977787941a 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 @@ public interface IIndexCheckpointManager {
      * @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 80bb3c8f75..42a3c0b212 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 @@ class RemoteLogsNotifier implements Runnable {
         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());
+                }
             }
         }
     }

Reply via email to