keith-turner commented on code in PR #4996:
URL: https://github.com/apache/accumulo/pull/4996#discussion_r1806992721


##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java:
##########
@@ -117,6 +121,20 @@ public void upgradeZookeeper(@NonNull ServerContext 
context) {
         zrw.overwritePersistentData(rootBase, rtm.toJson().getBytes(UTF_8), 
stat.getVersion());
         log.info("Root metadata in ZooKeeper after upgrade: {}", rtm.toJson());
       }
+
+      String zPath = Constants.ZROOT + "/" + context.getInstanceID() + 
Constants.ZNAMESPACES;
+      ZooReaderWriter zoo = context.getZooReaderWriter();
+      Map<String,String> namespaceMap = new HashMap<>();
+      List<String> namespaceIdList = zoo.getChildren(zPath);
+      for (String namespaceId : namespaceIdList) {
+        @SuppressWarnings("deprecation")
+        String namespaceNamePath = zPath + "/" + namespaceId + 
Constants.ZNAMESPACE_NAME;
+        namespaceMap.put(namespaceId, new 
String(zoo.getData(namespaceNamePath), UTF_8));
+        zoo.delete(namespaceNamePath);

Review Comment:
   Also the code may want to check if the new stuff is there and not change it 
if it is.  Would not want to the following to happen.
   
    1. Read 10 of the old nodes from ZK
    2. Compute the new data for the 10 nodes and write it out
    3. Delete 5 of the old nodes from ZK and the process diesl
    4. Manager is restarted and starts running upgrade code again
    5. Read 5 of the old nodes from ZK
    6. Compute the new data for the 5 nodes and write it out
    7. Delete the rest of the olds nodes from ZK
   
   So if the new data is there in ZK, need to assume the old data may have been 
partially deleted. So if the new data exists, do not need to recompute it only 
need to delete anything that is still hanging around.



-- 
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]

Reply via email to