hkeebler commented on a change in pull request #1206: Fix #1181 Update 
MasterMetadataUtil to use new Ample api
URL: https://github.com/apache/accumulo/pull/1206#discussion_r294413789
 
 

 ##########
 File path: 
server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
 ##########
 @@ -69,34 +69,35 @@ public static void addNewTablet(ServerContext context, 
KeyExtent extent, String
       TServerInstance location, Map<FileRef,DataFileValue> datafileSizes,
       Map<Long,? extends Collection<FileRef>> bulkLoadedFiles, String time, 
long lastFlushID,
       long lastCompactID, ZooLock zooLock) {
-    Mutation m = extent.getPrevRowUpdateMutation();
 
-    TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new 
Value(path.getBytes(UTF_8)));
-    TabletsSection.ServerColumnFamily.TIME_COLUMN.put(m, new 
Value(time.getBytes(UTF_8)));
+    TabletMutator mutator = context.getAmple().mutateTablet(extent);
+    mutator.putPrevEndRow(extent.getPrevEndRow());
+    mutator.putZooLock(zooLock);
+    mutator.putDir(path);
+    mutator.putTime(time);
+
     if (lastFlushID > 0)
-      TabletsSection.ServerColumnFamily.FLUSH_COLUMN.put(m,
-          new Value(("" + lastFlushID).getBytes()));
+      mutator.putFlushId(lastFlushID);
+
     if (lastCompactID > 0)
-      TabletsSection.ServerColumnFamily.COMPACT_COLUMN.put(m,
-          new Value(("" + lastCompactID).getBytes()));
+      mutator.putCompactionId(lastCompactID);
 
     if (location != null) {
-      location.putLocation(m);
-      location.clearFutureLocation(m);
+      mutator.putLocation(location, LocationType.CURRENT);
+      mutator.deleteLocation(location, LocationType.FUTURE);
     }
-
+    // are the following collections assumed not null? at least any empty 
collection is passed?
     for (Entry<FileRef,DataFileValue> entry : datafileSizes.entrySet()) {
 
 Review comment:
   I'm less familiar with this newer java construct  but am making this change 
because I love one-liner code although I do think it is less obvious as to what 
is going on here - as to what information is being stored in the metadata 
table.  

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to