cshannon commented on code in PR #3957:
URL: https://github.com/apache/accumulo/pull/3957#discussion_r1398259152
##########
server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java:
##########
@@ -954,28 +992,55 @@ private void mergeMetadataRecords(MergeInfo info) throws
AccumuloException {
// delete any entries for external compactions
extCompIds.forEach(ecid ->
m.putDelete(ExternalCompactionColumnFamily.STR_NAME, ecid));
- if (!m.getUpdates().isEmpty()) {
- bw.addMutation(m);
- }
+ // Add a marker so we know the tablets have been fenced in case the
merge operation
+ // needs to be recovered and restarted to finish later.
+ MergedColumnFamily.MERGED_COLUMN.put(m, MergedColumnFamily.MERGED_VALUE);
+ // Add the prev row column update to the same mutation as the
+ // file updates so it will be atomic and only update the prev row
+ // if the tablets were fenced
+ Preconditions.checkState(firstPrevRowValue != null,
+ "Previous row entry for lowest tablet was not found.");
+ stop = new KeyExtent(stop.tableId(), stop.endRow(),
+ TabletColumnFamily.decodePrevEndRow(firstPrevRowValue));
+ TabletColumnFamily.PREV_ROW_COLUMN.put(m,
+ TabletColumnFamily.encodePrevEndRow(stop.prevEndRow()));
+ Manager.log.debug("Setting the prevRow for last tablet: {}", stop);
+ bw.addMutation(m);
bw.flush();
Manager.log.debug("Moved {} files to {}", fileCount, stop);
+ } catch (Exception ex) {
+ throw new AccumuloException(ex);
+ }
+ }
- if (firstPrevRowValue == null) {
- Manager.log.debug("tablet already merged");
- return;
- }
+ private void deleteMergedTablets(MergeInfo info) throws AccumuloException {
+ KeyExtent range = info.getExtent();
+ Manager.log.debug("Deleting merged tablets for {}", range);
+ HighTablet highTablet = getHighTablet(range);
Review Comment:
That's a good point, it probably doesn't matter either way but still can
return early as no reason to execute the following code if the merge marker is
gone
--
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]