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


##########
server/base/src/main/java/org/apache/accumulo/server/manager/state/TabletStateChangeIterator.java:
##########
@@ -72,40 +75,39 @@ public class TabletStateChangeIterator extends 
SkippingIterator {
   public void init(SortedKeyValueIterator<Key,Value> source, 
Map<String,String> options,
       IteratorEnvironment env) throws IOException {
     super.init(source, options, env);
-    current = parseServers(options.get(SERVERS_OPTION));
-    onlineTables = parseTableIDs(options.get(TABLES_OPTION));
+    current = parseServers(ServerIteratorOptions.decompressOption(options, 
SERVERS_OPTION));
+    onlineTables = 
parseTableIDs(ServerIteratorOptions.decompressOption(options, TABLES_OPTION));
     merges = parseMerges(options.get(MERGES_OPTION));
     debug = options.containsKey(DEBUG_OPTION);
-    migrations = parseMigrations(options.get(MIGRATIONS_OPTION));
+    migrations = ServerIteratorOptions.decompressOption(options, 
MIGRATIONS_OPTION,
+        TabletStateChangeIterator::decodeMigrations);
     try {
       managerState = ManagerState.valueOf(options.get(MANAGER_STATE_OPTION));
     } catch (Exception ex) {
       if (options.get(MANAGER_STATE_OPTION) != null) {
         log.error("Unable to decode managerState {}", 
options.get(MANAGER_STATE_OPTION));
       }
     }
-    Set<TServerInstance> shuttingDown = 
parseServers(options.get(SHUTTING_DOWN_OPTION));
+    Set<TServerInstance> shuttingDown =
+        parseServers(ServerIteratorOptions.decompressOption(options, 
SHUTTING_DOWN_OPTION));
     if (current != null && shuttingDown != null) {
       current.removeAll(shuttingDown);
     }
   }
 
-  private Set<KeyExtent> parseMigrations(String migrations) {
-    if (migrations == null) {
+  static Set<KeyExtent> decodeMigrations(DataInput input) throws IOException {
+    if (input == null) {
       return Collections.emptySet();
     }
-    try {
-      Set<KeyExtent> result = new HashSet<>();
-      DataInputBuffer buffer = new DataInputBuffer();
-      byte[] data = Base64.getDecoder().decode(migrations);
-      buffer.reset(data, data.length);
-      while (buffer.available() > 0) {
-        result.add(KeyExtent.readFrom(buffer));
-      }
-      return result;
-    } catch (Exception ex) {
-      throw new RuntimeException(ex);
+    Set<KeyExtent> result = new HashSet<>();
+    // TODO this integer will make this code incompat w/ 2.1.3 even when not 
using compression.
+    // Could not get the InputStream.available() function to work reliably for 
compressed data of
+    // the empty string/set.

Review Comment:
   You could write the size to a different option ("__MIGRATIONS_COUNT"). If 
that exists, then this is 2.1.4 and compression could be used. If it doesn't 
exist, then compression is not used.



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