keith-turner commented on a change in pull request #960: Use 
NewTableConfiguration (and also trivial code cleanup)
URL: https://github.com/apache/fluo/pull/960#discussion_r147243299
 
 

 ##########
 File path: 
modules/core/src/main/java/org/apache/fluo/core/client/FluoAdminImpl.java
 ##########
 @@ -221,23 +225,46 @@ private void initialize(Connector conn) throws Exception 
{
         CuratorUtil.NodeExistsPolicy.FAIL);
     CuratorUtil.putData(curator, ZookeeperPath.ORACLE_GC_TIMESTAMP, new byte[] 
{'0'},
         CuratorUtil.NodeExistsPolicy.FAIL);
+  }
 
-    conn.tableOperations().create(config.getAccumuloTable(), false);
-    Map<String, Set<Text>> groups = new HashMap<>();
-    groups.put("notify", 
Collections.singleton(ByteUtil.toText(ColumnConstants.NOTIFY_CF)));
-    conn.tableOperations().setLocalityGroups(config.getAccumuloTable(), 
groups);
-
-    IteratorSetting gcIter = new IteratorSetting(10, "gc", 
GarbageCollectionIterator.class);
-    GarbageCollectionIterator.setZookeepers(gcIter, config.getAppZookeepers());
+  private String encodeColumnFamily(Bytes cf) {
+    StringBuilder sb = new StringBuilder();
+    for (int i = 0; i < cf.length(); i++) {
+      int c = 0xff & cf.byteAt(i);
+      if (c == '\\') {
+        sb.append("\\\\");
+      } else if (c >= 32 && c <= 126 && c != ',') {
+        sb.append((char) c);
+      } else {
+        sb.append("\\x").append(String.format("%02X", c));
+      }
+    }
+    return sb.toString();
+  }
 
-    conn.tableOperations().attachIterator(config.getAccumuloTable(), gcIter,
-        EnumSet.of(IteratorUtil.IteratorScope.majc, 
IteratorUtil.IteratorScope.minc));
+  private Map<String, String> initializeApplicationTableProps() {
+    Map<String, String> ntcProps = new HashMap<>();
+    ntcProps.put("table.group.notify", 
encodeColumnFamily(ColumnConstants.NOTIFY_CF));
 
 Review comment:
   It would be nice to create constants for these props in AccumuloProps class.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to