dlmarion commented on code in PR #5668: URL: https://github.com/apache/accumulo/pull/5668#discussion_r2205606427
########## test/src/main/java/org/apache/accumulo/test/functional/TabletManagementIteratorIT.java: ########## @@ -284,30 +304,109 @@ public void test() throws AccumuloException, AccumuloSecurityException, TableExi Map.of(new Path("file:/vol1/accumulo/inst_id"), new Path("file:/vol2/accumulo/inst_id")); tabletMgmtParams = createParameters(client, replacements); expected = Map.of(prevR4, Set.of(NEEDS_VOLUME_REPLACEMENT)); - assertEquals(expected, findTabletsNeedingAttention(client, metaCopy4, tabletMgmtParams), + assertEquals(expected, + findTabletsNeedingAttention(client, metaCopy4, tabletMgmtParams, false), "Should have one tablet that needs a volume replacement"); // In preparation for split an offline testing ensure nothing needs attention tabletMgmtParams = createParameters(client); addFiles(client, metaCopy6, t4); expected = Map.of(); - assertEquals(expected, findTabletsNeedingAttention(client, metaCopy6, tabletMgmtParams), + assertEquals(expected, + findTabletsNeedingAttention(client, metaCopy6, tabletMgmtParams, false), "No tablets should need attention"); // Lower the split threshold for the table, should cause the files added to need attention. client.tableOperations().setProperty(tables[3], Property.TABLE_SPLIT_THRESHOLD.getKey(), "1K"); expected = Map.of(prevR4, Set.of(NEEDS_SPLITTING)); - assertEquals(expected, findTabletsNeedingAttention(client, metaCopy6, tabletMgmtParams), + assertEquals(expected, + findTabletsNeedingAttention(client, metaCopy6, tabletMgmtParams, false), "Should have one tablet that needs splitting"); // Take the table offline which should prevent the tablet from being returned for needing to // split client.tableOperations().offline(tables[3], false); tabletMgmtParams = createParameters(client); expected = Map.of(); - assertEquals(expected, findTabletsNeedingAttention(client, metaCopy6, tabletMgmtParams), + assertEquals(expected, + findTabletsNeedingAttention(client, metaCopy6, tabletMgmtParams, false), "No tablets should need attention"); + // Bring the table back online to re-confirm that it needs splitting. Introduce some errors + // into the metadata table. + client.tableOperations().online(tables[3]); + tabletMgmtParams = createParameters(client); + expected = Map.of(prevR4, Set.of(NEEDS_SPLITTING)); + assertEquals(expected, + findTabletsNeedingAttention(client, metaCopy6, tabletMgmtParams, false), + "Should have one tablet that needs splitting"); + + // insert an errant entry into the metadata between tables 1 and 2. + TableId badTableId = TableId.of(tableId2.canonical() + "1"); + try (TabletsMutatorImpl mut = new TabletsMutatorImpl(getServerContext(), (dl) -> metaCopy6)) { + KeyExtent nonExistantTable = new KeyExtent(badTableId, null, null); + TabletMutator tm = mut.mutateTablet(nonExistantTable); + tm.putLocation(Location.current("fakeServer", "fakeSession")); + tm.automaticallyPutServerLock(false); + tm.mutate(); + } + IllegalStateException ise = assertThrows(IllegalStateException.class, + () -> findTabletsNeedingAttention(client, metaCopy6, createParameters(client), false)); + assertEquals("No prev endrow seen. tableId: " + badTableId + " endrow: null", + ise.getMessage()); + + // with errors suppressed, should return prior state + tabletMgmtParams = createParameters(client); + expected = Map.of(prevR4, Set.of(NEEDS_SPLITTING)); + assertEquals(expected, findTabletsNeedingAttention(client, metaCopy6, tabletMgmtParams, true), + "Should have one tablet that needs splitting"); + + // Remove the errant entry + try (TabletsMutatorImpl mut = new TabletsMutatorImpl(getServerContext(), (dl) -> metaCopy6)) { + KeyExtent nonExistantTable = new KeyExtent(badTableId, null, null); + TabletMutator tm = mut.mutateTablet(nonExistantTable); + tm.deleteLocation(Location.current("fakeServer", "fakeSession")); + tm.automaticallyPutServerLock(false); + tm.mutate(); + } + // should return prior state without error suppression + tabletMgmtParams = createParameters(client); + expected = Map.of(prevR4, Set.of(NEEDS_SPLITTING)); + assertEquals(expected, + findTabletsNeedingAttention(client, metaCopy6, tabletMgmtParams, false), + "Should have one tablet that needs splitting"); + + // Remove the metadata constraint from metaCopy6 so we can insert some bad json + client.tableOperations().removeConstraint(metaCopy6, 1); Review Comment: Removed this in e626bce -- 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