This is an automated email from the ASF dual-hosted git repository. cshannon pushed a commit to branch elasticity in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit d36fa05772faee6f36f602e87e5184441b006d8c Merge: e4f1f3c79f b4578f62a4 Author: Christopher L. Shannon (cshannon) <christopher.l.shan...@gmail.com> AuthorDate: Thu Oct 12 08:04:10 2023 -0400 Merge branch 'main' into elasticity .../core/metadata/CompactableFileImpl.java | 3 +- .../metadata/schema/ReferencedTabletFileTest.java | 10 +- .../core/metadata/schema/TabletMetadataTest.java | 8 +- .../accumulo/server/metadata/ServerAmpleImpl.java | 4 +- .../constraints/MetadataConstraintsTest.java | 213 +++++++++------------ .../java/org/apache/accumulo/test/CloneIT.java | 5 +- .../test/functional/GarbageCollectorIT.java | 18 +- 7 files changed, 115 insertions(+), 146 deletions(-) diff --cc core/src/main/java/org/apache/accumulo/core/metadata/CompactableFileImpl.java index a8296ce495,9944245f97..80e334ba68 --- a/core/src/main/java/org/apache/accumulo/core/metadata/CompactableFileImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/CompactableFileImpl.java @@@ -31,9 -30,7 +30,9 @@@ public class CompactableFileImpl implem private final DataFileValue dataFileValue; public CompactableFileImpl(URI uri, long size, long entries) { + // TODO this normalizes the path passing it through URI defeating the purpose of + // StoredTabletFile - this.storedTabletFile = StoredTabletFile.of(uri, new Range()); + this.storedTabletFile = StoredTabletFile.of(uri); this.dataFileValue = new DataFileValue(size, entries); } diff --cc server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java index bbbccd2d72,38f6d27ad2..d369fe99b6 --- 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 @@@ -23,10 -23,8 +23,9 @@@ import static org.junit.jupiter.api.Ass import static org.junit.jupiter.api.Assertions.assertNull; import java.lang.reflect.Method; - import java.net.URI; import java.util.Base64; import java.util.List; +import java.util.Set; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@@ -142,17 -158,27 +141,15 @@@ public class MetadataConstraintsTest Mutation m; List<Short> violations; - // inactive txid - 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("12345")); - m.put( - DataFileColumnFamily.NAME, StoredTabletFile - .of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")).getMetadataText(), - new DataFileValue(1, 1).encodeAsValue()); - assertViolation(mc, m, (short) 8); - // txid that throws exception m = new Mutation(new Text("0;foo")); - m.put(BulkFileColumnFamily.NAME, - StoredTabletFile - .of(URI.create("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range()) - .getMetadataText(), + m.put( + BulkFileColumnFamily.NAME, StoredTabletFile + .of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")).getMetadataText(), - new Value("9")); + new Value("bad value")); - m.put(DataFileColumnFamily.NAME, - StoredTabletFile - .of(URI.create("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range()) - .getMetadataText(), + m.put( + DataFileColumnFamily.NAME, StoredTabletFile + .of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")).getMetadataText(), new DataFileValue(1, 1).encodeAsValue()); assertViolation(mc, m, (short) 8); @@@ -303,11 -309,12 +280,12 @@@ // Missing beginning of path m = new Mutation(new Text("0;foo")); - m.put(BulkFileColumnFamily.NAME, new Text(StoredTabletFile - .of(URI.create("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range()) - .getMetadata().replace("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile", "/someFile")), + m.put(BulkFileColumnFamily.NAME, + new Text(StoredTabletFile.of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")) + .getMetadata() + .replace("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile", "/someFile")), new Value("5")); - assertViolation(mc, m, (short) 9); + assertViolation(mc, m, (short) 12); // Missing tables directory in path m = new Mutation(new Text("0;foo")); @@@ -317,13 -323,13 +294,12 @@@ .getMetadata().replace("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile", "hdfs://1.2.3.4/accumulo/2a/t-0003/someFile")), new Value("5")); - assertViolation(mc, m, (short) 9); + assertViolation(mc, m, (short) 12); - // No DataFileColumnFamily included m = new Mutation(new Text("0;foo")); - m.put(BulkFileColumnFamily.NAME, - StoredTabletFile - .of(URI.create("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range()) - .getMetadataText(), + m.put( + BulkFileColumnFamily.NAME, StoredTabletFile + .of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")).getMetadataText(), new Value("5")); assertViolation(mc, m, (short) 8); @@@ -355,11 -361,10 +331,10 @@@ // {"path":"","startRow":"","endRow":""} m = new Mutation(new Text("0;foo")); m.put(BulkFileColumnFamily.NAME, - new Text(StoredTabletFile - .of(URI.create("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range()) + new Text(StoredTabletFile.of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")) .getMetadata().replaceFirst("\"path\":\".*\",\"startRow", "\"path\":\"\",\"startRow")), new Value("5")); - assertViolation(mc, m, (short) 9); + assertViolation(mc, m, (short) 12); // Bad Json - test startRow key replaced with empty string so validation should fail // {"path":"hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile","":"","endRow":""} @@@ -380,12 -385,13 +355,13 @@@ // Bad Json - endRow will be replaced with encoded row without the exclusive byte 0x00 which is // required for an endRow so will fail validation m = new Mutation(new Text("0;foo")); - m.put(BulkFileColumnFamily.NAME, new Text(StoredTabletFile - .of(URI.create("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range("a", "b")) - .getMetadata() - .replaceFirst("\"endRow\":\".*\"", "\"endRow\":\"" + encodeRowForMetadata("bad") + "\"")), + m.put(BulkFileColumnFamily.NAME, + new Text(StoredTabletFile + .of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range("a", "b")) + .getMetadata().replaceFirst("\"endRow\":\".*\"", + "\"endRow\":\"" + encodeRowForMetadata("bad") + "\"")), new Value("5")); - assertViolation(mc, m, (short) 9); + assertViolation(mc, m, (short) 12); } @@@ -406,11 -412,12 +382,12 @@@ // Missing beginning of path m = new Mutation(new Text("0;foo")); - m.put(columnFamily, new Text(StoredTabletFile - .of(URI.create("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range()) - .getMetadata().replace("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile", "/someFile")), + m.put(columnFamily, + new Text(StoredTabletFile.of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")) + .getMetadata() + .replace("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile", "/someFile")), value); - assertViolation(mc, m, (short) 9); + assertViolation(mc, m, (short) 12); // Bad Json - only path (old format) so should fail parsing m = new Mutation(new Text("0;foo")); @@@ -430,11 -437,10 +407,10 @@@ // {"path":"","startRow":"","endRow":""} m = new Mutation(new Text("0;foo")); m.put(columnFamily, - new Text(StoredTabletFile - .of(URI.create("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range()) + new Text(StoredTabletFile.of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile")) .getMetadata().replaceFirst("\"path\":\".*\",\"startRow", "\"path\":\"\",\"startRow")), value); - assertViolation(mc, m, (short) 9); + assertViolation(mc, m, (short) 12); // Bad Json - test startRow key replaced with empty string so validation should fail // {"path":"hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile","":"","endRow":""} @@@ -465,12 -471,13 +441,13 @@@ // Bad Json - endRow will be replaced with encoded row without the exclusive byte 0x00 which is // required for an endRow so this will fail validation m = new Mutation(new Text("0;foo")); - m.put(columnFamily, new Text(StoredTabletFile - .of(URI.create("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range("a", "b")) - .getMetadata() - .replaceFirst("\"endRow\":\".*\"", "\"endRow\":\"" + encodeRowForMetadata("b") + "\"")), + m.put(columnFamily, + new Text(StoredTabletFile + .of(new Path("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/someFile"), new Range("a", "b")) + .getMetadata() + .replaceFirst("\"endRow\":\".*\"", "\"endRow\":\"" + encodeRowForMetadata("b") + "\"")), value); - assertViolation(mc, m, (short) 9); + assertViolation(mc, m, (short) 12); // Missing tables directory in path m = new Mutation(new Text("0;foo"));