keith-turner commented on code in PR #3931:
URL: https://github.com/apache/accumulo/pull/3931#discussion_r1383842652
##########
test/src/main/java/org/apache/accumulo/test/MetaSplitIT.java:
##########
@@ -136,6 +166,15 @@ public void testMetadataTableSplit() throws Exception {
}
}
+ // Count the number of entries that can be read in the Metadata table
+ // This verifies all the entries can still be read after splits/merges
+ // when ranged files are used
+ private void verifyMetadataTableScan(AccumuloClient client) throws Exception
{
+ // There should be 50 entries, 5 entries per Tablet
+ assertEquals(50,
+ client.createScanner(MetadataTable.NAME,
Authorizations.EMPTY).stream().count());
Review Comment:
Instead of doing a count, this could verify some of the data in the metadata
table. This may also make the test less sensitive changes in the metadata
table (like the lock column may be remove and that would break the count).
```suggestion
var tables = client.tableOperations().tableIdMap();
var expectedExtents =
tables.entrySet().stream().filter(e->!e.getKey().startsWith("accumulo.")).map(Map.Entry::getValue).map(TableId::of).map(tid->new
KeyExtent(tid, null,null)).collect(Collectors.toSet());
assertEquals(10, expectedExtents.size());
var ample = ((ClientContext)client).getAmple();
try(var tablets =
ample.readTablets().forLevel(Ample.DataLevel.USER).build()){
for (var tablet : tablets) {
assertTrue(expectedExtents.remove(tablet.getExtent()));
assertNotNull(tablet.getDirName());
assertNotNull(tablet.getLocation());
}
}
// ensure all expected extents were seen
assertEquals(0, expectedExtents.size());
```
##########
test/src/main/java/org/apache/accumulo/test/MetaSplitIT.java:
##########
@@ -111,23 +116,48 @@ private void addSplits(TableOperations opts, String...
points) throws Exception
@Test
public void testMetadataTableSplit() throws Exception {
try (AccumuloClient client =
Accumulo.newClient().from(getClientProps()).build()) {
+ // disable compactions
+ client.tableOperations().setProperty(MetadataTable.NAME,
Property.TABLE_MAJC_RATIO.getKey(),
+ "9999");
+
TableOperations opts = client.tableOperations();
for (int i = 1; i <= 10; i++) {
opts.create(Integer.toString(i));
}
try {
+ assertEquals(0, countFencedFiles(getServerContext(),
MetadataTable.NAME));
+ verifyMetadataTableScan(client);
opts.merge(MetadataTable.NAME, new Text("01"), new Text("02"));
checkMetadataSplits(1, opts);
+ verifyMetadataTableScan(client);
addSplits(opts, "4 5 6 7 8".split(" "));
checkMetadataSplits(6, opts);
+ verifyMetadataTableScan(client);
+
opts.merge(MetadataTable.NAME, new Text("6"), new Text("9"));
checkMetadataSplits(4, opts);
+ // Merging tablets should produce fenced files because of no-chop merge
+ assertTrue(countFencedFiles(getServerContext(), MetadataTable.NAME) >
0);
+ verifyMetadataTableScan(client);
+
addSplits(opts, "44 55 66 77 88".split(" "));
checkMetadataSplits(9, opts);
+ assertTrue(countFencedFiles(getServerContext(), MetadataTable.NAME) >
0);
+ verifyMetadataTableScan(client);
+
opts.merge(MetadataTable.NAME, new Text("5"), new Text("7"));
checkMetadataSplits(6, opts);
+ assertTrue(countFencedFiles(getServerContext(), MetadataTable.NAME) >
0);
+ verifyMetadataTableScan(client);
+
opts.merge(MetadataTable.NAME, null, null);
checkMetadataSplits(0, opts);
+ assertTrue(countFencedFiles(getServerContext(), MetadataTable.NAME) >
0);
+ verifyMetadataTableScan(client);
+
+ opts.compact(MetadataTable.NAME, new CompactionConfig());
+ // Should be no more fenced files after compaction
+ assertEquals(0, countFencedFiles(getServerContext(),
MetadataTable.NAME));
Review Comment:
```suggestion
assertEquals(0, countFencedFiles(getServerContext(),
MetadataTable.NAME));
verifyMetadataTableScan(client);
```
--
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]