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


##########
server/base/src/main/java/org/apache/accumulo/server/metadata/ConditionalTabletMutatorImpl.java:
##########
@@ -251,6 +254,9 @@ public Ample.ConditionalTabletMutator 
requireSame(TabletMetadata tabletMetadata,
   public void submit(Ample.RejectionHandler rejectionCheck) {
     Preconditions.checkState(updatesEnabled, "Cannot make updates after 
calling mutate.");
     Preconditions.checkState(sawOperationRequirement, "No operation 
requirements were seen");
+    if (!prevEndRowSupplied && !requireAbsentTabletCalled) {
+      requireAbsentTablet();
+    }

Review Comment:
   Could add the end row condition check here if require absent was not called.
   
   ```suggestion
       if (!requireAbsentTabletCalled) {
         // TODO add end row condition check
       }
   ```
   
   If doing that then could remove the mutateTablet method that takes an endRow



##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/Ample.java:
##########
@@ -296,7 +296,7 @@ public interface ConditionalTabletsMutator extends 
AutoCloseable {
      * @return A fluent interface to conditional mutating a tablet. Ensure you 
call
      *         {@link ConditionalTabletMutator#submit(RejectionHandler)} when 
finished.
      */
-    OperationRequirements mutateTablet(KeyExtent extent);
+    OperationRequirements mutateTablet(KeyExtent extent, Text prevEndRow);

Review Comment:
   There would be a lot less redundancy in the code if the prevEndRow was not 
passed and the prev endRow form the extent was used.  Also I am not sure they 
should ever be different.



##########
server/base/src/main/java/org/apache/accumulo/server/metadata/ConditionalTabletMutatorImpl.java:
##########
@@ -68,22 +68,37 @@ public class ConditionalTabletMutatorImpl extends 
TabletMutatorBase<Ample.Condit
   private final ConditionalMutation mutation;
   private final Consumer<ConditionalMutation> mutationConsumer;
   private final Ample.ConditionalTabletsMutator parent;
+  private final boolean prevEndRowSupplied;
 
   private final BiConsumer<KeyExtent,Ample.RejectionHandler> 
rejectionHandlerConsumer;
 
   private final KeyExtent extent;
 
   private boolean sawOperationRequirement = false;
+  private boolean requireAbsentTabletCalled = false;
 
   protected ConditionalTabletMutatorImpl(Ample.ConditionalTabletsMutator 
parent,
-      ServerContext context, KeyExtent extent, Consumer<ConditionalMutation> 
mutationConsumer,
+      ServerContext context, KeyExtent extent, Text prevEndRow,
+      Consumer<ConditionalMutation> mutationConsumer,
       BiConsumer<KeyExtent,Ample.RejectionHandler> rejectionHandlerConsumer) {
     super(new ConditionalMutation(extent.toMetaRow()));
     this.mutation = (ConditionalMutation) super.mutation;
     this.mutationConsumer = mutationConsumer;
     this.parent = parent;
     this.rejectionHandlerConsumer = rejectionHandlerConsumer;
     this.extent = extent;
+
+    // If prevEndRow is null, then we are creating a new Tablet in which case
+    // there is no prevEndRow.
+    if (prevEndRow != null) {

Review Comment:
   The first tablet in a table can have a null prev end row, so this is tricky.



-- 
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: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to