Skip to content
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

Better handling for runtime exception in Tablet.commit #5213

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
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 @@ -469,6 +469,7 @@ private void flush(UpdateSession us) {
}
} catch (Exception e) {
TraceUtil.setException(span2, e, true);
log.error("Error logging mutations sent from {}", TServerUtils.clientAddress.get(), e);
throw e;
} finally {
span2.end();
Expand Down Expand Up @@ -496,6 +497,10 @@ private void flush(UpdateSession us) {
us.commitTimes.addStat(t2 - t1);

updateAvgCommitTime(t2 - t1, sendables.size());
} catch (Exception e) {
TraceUtil.setException(span3, e, true);
log.error("Error committing mutations sent from {}", TServerUtils.clientAddress.get(), e);
throw e;
} finally {
span3.end();
}
Expand Down Expand Up @@ -675,6 +680,7 @@ public void update(TInfo tinfo, TCredentials credentials, TKeyExtent tkeyExtent,
session.commit(mutations);
} catch (Exception e) {
TraceUtil.setException(span3, e, true);
log.error("Error committing mutations sent from {}", TServerUtils.clientAddress.get(), e);
throw e;
} finally {
span3.end();
Expand Down Expand Up @@ -831,6 +837,7 @@ private void writeConditionalMutations(Map<KeyExtent,List<ServerConditionalMutat
updateAvgCommitTime(t2 - t1, sendables.size());
} catch (Exception e) {
TraceUtil.setException(span3, e, true);
log.error("Error committing mutations sent from {}", TServerUtils.clientAddress.get(), e);
throw e;
} finally {
span3.end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,22 +877,21 @@ public void commit(CommitSession commitSession, List<Mutation> mutations) {
totalBytes += mutation.numBytes();
}

getTabletMemory().mutate(commitSession, mutations, totalCount);

synchronized (this) {
if (isCloseComplete()) {
throw new IllegalStateException(
"Tablet " + extent + " closed with outstanding messages to the logger");
try {
getTabletMemory().mutate(commitSession, mutations, totalCount);
synchronized (this) {
getTabletMemory().updateMemoryUsageStats();
if (isCloseComplete()) {
throw new IllegalStateException(
"Tablet " + extent + " closed with outstanding messages to the logger");
}
numEntries += totalCount;
numEntriesInMemory += totalCount;
ingestCount += totalCount;
ingestBytes += totalBytes;
dlmarion marked this conversation as resolved.
Show resolved Hide resolved
}
// decrement here in case an exception is thrown below
} finally {
decrementWritesInProgress(commitSession);

getTabletMemory().updateMemoryUsageStats();

numEntries += totalCount;
numEntriesInMemory += totalCount;
ingestCount += totalCount;
ingestBytes += totalBytes;
}
}

Expand Down
Loading