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

dcapwell pushed a commit to branch cep-15-accord
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cep-15-accord by this push:
     new 58789ef29c Ninja: When starting up AccordService set the instance 
before startup to avoid an edge case when doing node restart and replying 
topology history
58789ef29c is described below

commit 58789ef29c6222744c46ec4ba9a8ae7b8e664d16
Author: David Capwell <dcapw...@apache.org>
AuthorDate: Thu Oct 3 17:51:44 2024 -0700

    Ninja: When starting up AccordService set the instance before startup to 
avoid an edge case when doing node restart and replying topology history
---
 .../cassandra/service/accord/AccordService.java    | 25 +++++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/java/org/apache/cassandra/service/accord/AccordService.java 
b/src/java/org/apache/cassandra/service/accord/AccordService.java
index 6fdf9e8586..8d0fe78a71 100644
--- a/src/java/org/apache/cassandra/service/accord/AccordService.java
+++ b/src/java/org/apache/cassandra/service/accord/AccordService.java
@@ -359,16 +359,25 @@ public class AccordService implements IAccordService, 
Shutdownable
             return;
         }
         AccordService as = new 
AccordService(AccordTopology.tcmIdToAccord(tcmId));
-        as.startup();
-        if (StorageService.instance.isReplacingSameAddress())
+        // Set the instance early as there is an edge case on startup where we 
reply topology history, and AccordConfigurationService reaches out to 
AccordService.instance
+        instance = as;
+        try
         {
-            // when replacing another node but using the same ip the hostId 
will also match, this causes no TCM transactions
-            // to be committed...
-            // In order to bootup correctly, need to pull in the current epoch
-            ClusterMetadata current = ClusterMetadata.current();
-            as.configurationService().notifyPostCommit(current, current, 
false);
+            as.startup();
+            if (StorageService.instance.isReplacingSameAddress())
+            {
+                // when replacing another node but using the same ip the 
hostId will also match, this causes no TCM transactions
+                // to be committed...
+                // In order to bootup correctly, need to pull in the current 
epoch
+                ClusterMetadata current = ClusterMetadata.current();
+                as.configurationService().notifyPostCommit(current, current, 
false);
+            }
+        }
+        catch (Throwable t)
+        {
+            instance = null;
+            throw t;
         }
-        instance = as;
 
         as.journal().replay();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to