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


##########
server/base/src/main/java/org/apache/accumulo/server/manager/state/MetaDataStateStore.java:
##########
@@ -102,6 +119,21 @@ private void unassign(Collection<TabletLocationState> 
tablets,
       for (TabletLocationState tls : tablets) {
         TabletMutator tabletMutator = tabletsMutator.mutateTablet(tls.extent);
         if (tls.current != null) {
+          // if the location mode is assignment, then preserve the current 
location in the last
+          // location value
+          if ("assignment"
+              
.equals(context.getConfiguration().get(Property.TSERV_LAST_LOCATION_MODE))) {
+            TabletMetadata lastMetadata =
+                ample.readTablet(tls.extent, TabletMetadata.ColumnType.LAST);
+            if (lastMetadata != null && lastMetadata.getLast() != null) {
+              if (!lastMetadata.getLast().equals(tls.current)) {
+                tabletMutator.putLocation(tls.current, LocationType.LAST);
+                tabletMutator.deleteLocation(lastMetadata.getLast(), 
LocationType.LAST);
+              }
+            } else {
+              tabletMutator.putLocation(tls.current, LocationType.LAST);
+            }
+          }

Review Comment:
   Yes I do.  This will allow me to change from compaction to assignment on a 
running system and still get the benefit of the last locations being updated 
appropriately when the system is shutdown.



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