meatballspaghetti commented on code in PR #4996:
URL: https://github.com/apache/accumulo/pull/4996#discussion_r1811552847


##########
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:
   Okay, updated. Moved node deletion to after the mapping 
creation/persistence, used strict mock. Added check for existing data in the 
upgrade code: if the mapping does not yet exist under namespaces, then compute 
the mapping and delete name nodes; if non-zero data exists under namespaces, 
then skip the mapping computation and just delete name nodes.



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