keith-turner commented on a change in pull request #2320:
URL: https://github.com/apache/accumulo/pull/2320#discussion_r761361369
##########
File path:
server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
##########
@@ -794,6 +802,55 @@ public void run() {
}
}, 0, 5000, TimeUnit.MILLISECONDS);
+ int tabletCheckFrequency = 30 + random.nextInt(31); // random 30-60 minute
delay
+ // Periodically check that metadata of tablets matches what is held in
memory
+
ThreadPools.createGeneralScheduledExecutorService(aconf).scheduleWithFixedDelay(()
-> {
+ final SortedMap<KeyExtent,Tablet> onlineTabletsSnapshot =
onlineTablets.snapshot();
+
+ final SortedSet<KeyExtent> userExtents = new TreeSet<>();
+ final SortedSet<KeyExtent> nonUserExtents = new TreeSet<>();
+
+ // Create subsets of tablets based on DataLevel: one set who's DataLevel
is USER and another
+ // containing the remaining tablets (those who's DataLevel is ROOT or
METADATA).
+ // This needs to happen so we can use .readTablets() on the
DataLevel.USER tablets in order
+ // to reduce RPCs.
+ // TODO: Push this partitioning, based on DataLevel, to ample - accumulo
issue #2373
+ onlineTabletsSnapshot.forEach((ke, tablet) -> {
+ if (Ample.DataLevel.of(ke.tableId()) == Ample.DataLevel.USER) {
+ userExtents.add(ke);
+ } else {
+ nonUserExtents.add(ke);
+ }
+ });
+
+ Map<KeyExtent,Long> updateCounts = new HashMap<>();
+
+ // gather updateCounts for each tablet
+ onlineTabletsSnapshot.forEach((ke, tablet) -> {
+ updateCounts.put(ke, tablet.getUpdateCount());
+ });
+
+ // gather metadata for all tablets with DataLevel.USER using
readTablets()
+ Stream<TabletMetadata> userTablets;
+ try (TabletsMetadata tabletsMetadata =
getContext().getAmple().readTablets()
+ .forTablets(userExtents).fetch(FILES, LOGS, ECOMP,
PREV_ROW).build()) {
+ userTablets = tabletsMetadata.stream();
Review comment:
This stream is being used after tabletsMetadata is closed, not sure that
is safe. May want the try w/ resources block to cover the lifetime of the
stream. So maybe pull all the code after this block into the block.
--
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]