This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch elasticity
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/elasticity by this push:
     new b0af344d9a fixes ManagerAssignmentIT test failure (#4657)
b0af344d9a is described below

commit b0af344d9a635c376ebf832128c14c0a4e8fe1cf
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Sat Jun 8 14:42:17 2024 -0400

    fixes ManagerAssignmentIT test failure (#4657)
    
    ManagerAssignmentIT had a test that would manually set an operation
    id on a tablet and then attempt to set the tablet availibility on
    the tablet using public API.  The changes in #4636 caused this public
    API call to block because an opid was present.  Modified the test to
    directly set tablet availability in the API.  Modifed the fate operation
    to log the opid that is blocking it.
---
 .../availability/SetTabletAvailability.java        |  5 ++-
 .../test/functional/ManagerAssignmentIT.java       | 45 ++++++++--------------
 2 files changed, 19 insertions(+), 31 deletions(-)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/availability/SetTabletAvailability.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/availability/SetTabletAvailability.java
index eda81d3ff3..59c010887f 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/availability/SetTabletAvailability.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/availability/SetTabletAvailability.java
@@ -18,6 +18,7 @@
  */
 package org.apache.accumulo.manager.tableOps.availability;
 
+import java.util.Optional;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.Consumer;
 
@@ -90,7 +91,9 @@ public class SetTabletAvailability extends ManagerRepo {
     Consumer<Ample.ConditionalResult> resultsConsumer = result -> {
       if (result.getStatus() != Ample.ConditionalResult.Status.ACCEPTED) {
         notAccepted.incrementAndGet();
-        LOG.debug("{} failed to set tablet availability for {}", fateId, 
result.getExtent());
+        LOG.debug("{} failed to set tablet availability for {} '{}'", fateId, 
result.getExtent(),
+            
Optional.ofNullable(result.readMetadata()).map(TabletMetadata::getOperationId)
+                .orElse(null));
       }
     };
 
diff --git 
a/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java
 
b/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java
index 9494a7e9dc..cfcc90878e 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java
@@ -61,7 +61,6 @@ import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.TableId;
-import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.dataImpl.KeyExtent;
 import org.apache.accumulo.core.fate.FateId;
 import org.apache.accumulo.core.fate.FateInstanceType;
@@ -397,53 +396,39 @@ public class ManagerAssignmentIT extends 
SharedMiniClusterBase {
       c.securityOperations().grantTablePermission(getPrincipal(),
           AccumuloTable.METADATA.tableName(), TablePermission.WRITE);
 
+      var ample = getCluster().getServerContext().getAmple();
+      var extent = new KeyExtent(tableId, new Text("m"), new Text("f"));
+      var opid = TabletOperationId.from(TabletOperationType.SPLITTING, fateId);
+
       // Set the OperationId on one tablet, which will cause that tablet
       // to not be assigned
-      try (var writer = 
c.createBatchWriter(AccumuloTable.METADATA.tableName())) {
-        var extent = new KeyExtent(tableId, new Text("m"), new Text("f"));
-        var opid = TabletOperationId.from(TabletOperationType.SPLITTING, 
fateId);
-        Mutation m = new Mutation(extent.toMetaRow());
-        TabletsSection.ServerColumnFamily.OPID_COLUMN.put(m, new 
Value(opid.canonical()));
-        writer.addMutation(m);
-      }
+      ample.mutateTablet(extent).putOperation(opid).mutate();
+
+      // Host all tablets. Can not call the setTabletAvailability api because 
it will block when an
+      // opid is present, so must directly set it in the metadata table.
+      ample.readTablets().forTable(tableId).build()
+          .forEach(tabletMetadata -> 
ample.mutateTablet(tabletMetadata.getExtent())
+              .putTabletAvailability(TabletAvailability.HOSTED).mutate());
 
-      // Host all tablets.
-      c.tableOperations().setTabletAvailability(tableName, new Range(), 
TabletAvailability.HOSTED);
       Wait.waitFor(() -> countTabletsWithLocation(c, tableId) == 3);
-      var ample = ((ClientContext) c).getAmple();
       assertNull(
           ample.readTablet(new KeyExtent(tableId, new Text("m"), new 
Text("f"))).getLocation());
 
       // Delete the OperationId column, tablet should be assigned
-      try (var writer = 
c.createBatchWriter(AccumuloTable.METADATA.tableName())) {
-        var extent = new KeyExtent(tableId, new Text("m"), new Text("f"));
-        Mutation m = new Mutation(extent.toMetaRow());
-        TabletsSection.ServerColumnFamily.OPID_COLUMN.putDelete(m);
-        writer.addMutation(m);
-      }
+      ample.mutateTablet(extent).deleteOperation().mutate();
       Wait.waitFor(() -> countTabletsWithLocation(c, tableId) == 4);
 
       // Set the OperationId on one tablet, which will cause that tablet
       // to be unhosted
-      try (var writer = 
c.createBatchWriter(AccumuloTable.METADATA.tableName())) {
-        var extent = new KeyExtent(tableId, new Text("m"), new Text("f"));
-        var opid = TabletOperationId.from(TabletOperationType.SPLITTING, 
fateId);
-        Mutation m = new Mutation(extent.toMetaRow());
-        TabletsSection.ServerColumnFamily.OPID_COLUMN.put(m, new 
Value(opid.canonical()));
-        writer.addMutation(m);
-      }
+      ample.mutateTablet(extent).putOperation(opid).mutate();
+
       // there are four tablets, three should be assigned as one has a 
OperationId
       Wait.waitFor(() -> countTabletsWithLocation(c, tableId) == 3);
       assertNull(
           ample.readTablet(new KeyExtent(tableId, new Text("m"), new 
Text("f"))).getLocation());
 
       // Delete the OperationId column, tablet should be assigned again
-      try (var writer = 
c.createBatchWriter(AccumuloTable.METADATA.tableName())) {
-        var extent = new KeyExtent(tableId, new Text("m"), new Text("f"));
-        Mutation m = new Mutation(extent.toMetaRow());
-        TabletsSection.ServerColumnFamily.OPID_COLUMN.putDelete(m);
-        writer.addMutation(m);
-      }
+      ample.mutateTablet(extent).deleteOperation().mutate();
 
       // after the operation id is deleted the tablet should be assigned
       Wait.waitFor(() -> countTabletsWithLocation(c, tableId) == 4);

Reply via email to