ivakegg commented on code in PR #3142:
URL: https://github.com/apache/accumulo/pull/3142#discussion_r1073833133


##########
server/base/src/main/java/org/apache/accumulo/server/manager/state/ZooTabletStateStore.java:
##########
@@ -134,6 +138,18 @@ public void setLocations(Collection<Assignment> 
assignments) throws DistributedS
 
     TabletMutator tabletMutator = ample.mutateTablet(assignment.tablet);
     tabletMutator.putLocation(assignment.server, LocationType.CURRENT);
+    if 
("assignment".equals(context.getConfiguration().get(Property.TSERV_LAST_LOCATION_MODE)))
 {
+      TabletMetadata lastMetadata =
+          ample.readTablet(assignment.tablet, TabletMetadata.ColumnType.LAST);
+      if (lastMetadata != null && lastMetadata.getLast() != null) {
+        if (!lastMetadata.getLast().equals(assignment.server)) {
+          tabletMutator.putLocation(assignment.server, LocationType.LAST);
+          tabletMutator.deleteLocation(lastMetadata.getLast(), 
LocationType.LAST);
+        }
+      } else {
+        tabletMutator.putLocation(assignment.server, LocationType.LAST);
+      }
+    }

Review Comment:
   I refactored the location updating into methods in the ManagerMetadataUtil 
class.  If you want them located elsewhere or in their own class just let me 
know.



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