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


##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java:
##########
@@ -117,6 +120,30 @@ 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;
+      byte[] existingMapData = zrw.getData(zPath);
+      List<String> namespaceIdList = zrw.getChildren(zPath);
+      Map<String,String> namespaceMap = null;
+      if (existingMapData != null) {
+        namespaceMap = NamespaceMapping.deserialize(existingMapData);
+      }
+      if (namespaceMap == null || namespaceMap.isEmpty()) {
+        namespaceMap = new HashMap<>();
+        for (String namespaceId : namespaceIdList) {
+          @SuppressWarnings("deprecation")
+          String namespaceNamePath = zPath + "/" + namespaceId + 
Constants.ZNAMESPACE_NAME;
+          namespaceMap.put(namespaceId, new 
String(zrw.getData(namespaceNamePath), UTF_8));
+        }
+        byte[] mapping = NamespaceMapping.serialize(namespaceMap);
+        zrw.putPersistentData(zPath, mapping, 
ZooUtil.NodeExistsPolicy.OVERWRITE);
+      }
+      for (String namespaceId : namespaceIdList) {
+        @SuppressWarnings("deprecation")
+        String namespaceNamePath = zPath + "/" + namespaceId + 
Constants.ZNAMESPACE_NAME;
+        zrw.delete(namespaceNamePath);

Review Comment:
   > So, the node is still in use by other parts of the code. The only item I 
can think of immediately is the namespace config, but there is possibly other 
ZK nodes under each separate namespace, too, that I just can't remember right 
now.
   
   I looked around in the code and config is still stored there at a path like 
`<root>/namespaces/<namespace id>/config`, did not see any other use.  



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