keith-turner commented on code in PR #3317:
URL: https://github.com/apache/accumulo/pull/3317#discussion_r1181683689


##########
server/base/src/main/java/org/apache/accumulo/server/manager/state/AbstractTabletStateStore.java:
##########
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.manager.state;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.ConditionalWriter;
+import org.apache.accumulo.core.clientImpl.ClientContext;
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.core.metadata.TabletLocationState;
+import org.apache.accumulo.core.metadata.schema.Ample;
+import org.apache.accumulo.core.metadata.schema.TabletMetadata;
+import org.apache.accumulo.core.tabletserver.log.LogEntry;
+import org.apache.accumulo.server.util.ManagerMetadataUtil;
+import org.apache.hadoop.fs.Path;
+
+import com.google.common.base.Preconditions;
+
+public abstract class AbstractTabletStateStore implements TabletStateStore {
+
+  private final ClientContext context;
+  private final Ample ample;
+
+  protected AbstractTabletStateStore(ClientContext context) {
+    this.context = context;
+    this.ample = context.getAmple();
+  }
+
+  @Override
+  public void setLocations(Collection<Assignment> assignments) throws 
DistributedStoreException {
+    try (var tabletsMutator = ample.conditionallyMutateTablets()) {
+      for (Assignment assignment : assignments) {
+        var conditionalMutator = tabletsMutator.mutateTablet(assignment.tablet)
+            .requireAbsentOperation()
+            .requireLocation(TabletMetadata.Location.future(assignment.server))
+            .putLocation(TabletMetadata.Location.current(assignment.server))
+            
.deleteLocation(TabletMetadata.Location.future(assignment.server)).deleteSuspension();

Review Comment:
   So what happens on the server is
   
    1. it gets a lock on the row
    2. it checks the cf=future and cq=session match what was specified in 
requireLocation(TabletMetadata.Location.future(assignment.server))
    3. If the above check was succesful it deletes the future col and sets the 
current col
    4. releases the row lock



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