dlmarion commented on code in PR #5781:
URL: https://github.com/apache/accumulo/pull/5781#discussion_r2319888486


##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader12to13.java:
##########
@@ -438,4 +447,51 @@ void addTableMappingsToZooKeeper(ServerContext context) {
           "Could not read or write metadata in ZooKeeper because of ZooKeeper 
exception", ex);
     }
   }
+
+  void moveTableProperties(ServerContext context) {
+    try {
+      final SystemPropKey spk = SystemPropKey.of();
+      final VersionedProperties sysProps = context.getPropStore().get(spk);
+      final Map<String,String> sysTableProps = new HashMap<>();
+      sysProps.asMap().entrySet().stream()
+          .filter(e -> e.getKey().startsWith(Property.TABLE_PREFIX.getKey()))
+          .forEach(e -> sysTableProps.put(e.getKey(), e.getValue()));
+      LOG.info("Adding the following table properties to namespaces unless 
overridden:");
+      sysTableProps.forEach((k, v) -> LOG.info("{} -> {}", k, v));
+
+      for (String ns : context.namespaceOperations().list()) {
+        final NamespacePropKey nsk = NamespacePropKey.of(NamespaceId.of(ns));
+        final Map<String,String> nsProps = 
context.getPropStore().get(nsk).asMap();
+        final Map<String,String> nsPropAdditions = new HashMap<>();
+
+        for (Entry<String,String> e : sysTableProps.entrySet()) {
+          final String nsVal = nsProps.get(e.getKey());
+          // If it's not set, then add the system table property
+          // to the namespace. If it is set, then it doesnt matter
+          // what the value is, we can ignore it.
+          if (nsVal == null) {
+            nsPropAdditions.put(e.getKey(), e.getValue());
+          }
+        }
+        try {
+          context.getPropStore().putAll(nsk, nsPropAdditions);
+          LOG.debug("Added table properties to namespace {}:", ns);
+          nsPropAdditions.forEach((k, v) -> LOG.debug("{} -> {}", k, v));
+        } catch (IllegalStateException e1) {
+          throw e1;
+        }

Review Comment:
   Fixed in 4908965



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