Skip to content

HBASE-28850 Only return from ReplicationSink.replicationEntries while… #6271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,33 @@ private void batch(TableName tableName, Collection<List<Row>> allRows, int batch
}
futures.addAll(batchRows.stream().map(table::batchAll).collect(Collectors.toList()));
}

// Here we will always wait until all futures are finished, even if there are failures when
// getting from a future in the middle. This is because this method may be called in a rpc call,
// so the batch operations may reference some off heap cells(through CellScanner). If we return
// earlier here, the rpc call may be finished and they will release the off heap cells before
// some of the batch operations finish, and then cause corrupt data or even crash the region
// server. See HBASE-28584 and HBASE-28850 for more details.
IOException error = null;
for (Future<?> future : futures) {
try {
FutureUtils.get(future);
} catch (RetriesExhaustedException e) {
IOException ioe;
if (e.getCause() instanceof TableNotFoundException) {
throw new TableNotFoundException("'" + tableName + "'");
ioe = new TableNotFoundException("'" + tableName + "'");
} else {
ioe = e;
}
if (error == null) {
error = ioe;
} else {
error.addSuppressed(ioe);
}
throw e;
}
}
if (error != null) {
throw error;
}
}

/**
Expand Down