This is an automated email from the ASF dual-hosted git repository. cshannon pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new b9e3c9fe36 Use opid column to detect split mutation (#4914) b9e3c9fe36 is described below commit b9e3c9fe3644d0419fbf869e35d98e394db62e3f Author: Christopher L. Shannon <cshan...@apache.org> AuthorDate: Sun Sep 22 14:21:16 2024 -0400 Use opid column to detect split mutation (#4914) MetadataConstraints used to use the presence of a directory column to detect a split mutation. In version 4.0 split mutations will now set an operation id so this change updates the metadata constraints code to check that id vs the directory. This closes #4857 --- .../server/constraints/MetadataConstraints.java | 19 +++++++++++-------- .../server/constraints/MetadataConstraintsTest.java | 13 +++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java b/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java index eb45429ede..8b36ac2c6e 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java +++ b/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java @@ -61,6 +61,7 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.Up import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.UserCompactionRequestedColumnFamily; import org.apache.accumulo.core.metadata.schema.SelectedFiles; import org.apache.accumulo.core.metadata.schema.TabletOperationId; +import org.apache.accumulo.core.metadata.schema.TabletOperationType; import org.apache.accumulo.core.metadata.schema.UnSplittableMetadata; import org.apache.accumulo.core.util.ColumnFQ; import org.apache.accumulo.core.util.cleaner.CleanerUtil; @@ -416,17 +417,19 @@ public class MetadataConstraints implements Constraint { } catch (IllegalArgumentException e) { addViolation(violations, 17); } - - // splits, which also write the time reference, are allowed to write this reference - // even when the transaction is not running because the other half of the tablet is - // holding a reference to the file. - if (bfcValidationData != null) { - bfcValidationData.setIsSplitMutation(true); - } break; case ServerColumnFamily.OPID_QUAL: try { - TabletOperationId.validate(new String(columnUpdate.getValue(), UTF_8)); + // Loading the TabletOperationId will also validate it + var id = TabletOperationId.from(new String(columnUpdate.getValue(), UTF_8)); + if (id.getType() == TabletOperationType.SPLITTING) { + // splits, which also write the time reference, are allowed to write this reference + // even when the transaction is not running because the other half of the tablet is + // holding a reference to the file. + if (bfcValidationData != null) { + bfcValidationData.setIsSplitMutation(true); + } + } } catch (IllegalArgumentException e) { addViolation(violations, 9); } diff --git a/server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java b/server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java index 34ece8a523..2420bcecc6 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java @@ -270,6 +270,19 @@ public class MetadataConstraintsTest { .of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")).getMetadataText(), new Value(fateId1.canonical())); ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value("t-000009x")); + // Missing split column, should fail + assertViolation(mc, m, (short) 8); + + // mutation that looks like split + m = new Mutation(new Text("0;foo")); + m.put( + BulkFileColumnFamily.NAME, StoredTabletFile + .of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")).getMetadataText(), + new Value(fateId1.canonical())); + ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value("t-000009x")); + // Add opid column + ServerColumnFamily.OPID_COLUMN.put(m, + new Value("SPLITTING:FATE:META:12345678-9abc-def1-2345-6789abcdef12")); violations = mc.check(createEnv(), m); assertTrue(violations.isEmpty());