-
Notifications
You must be signed in to change notification settings - Fork 997
LedgerManager, LedgerTxn tech debt #4725
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
base: master
Are you sure you want to change the base?
Conversation
e053306
to
c9fb8ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks generally good, but a few questions noted inline.
if (mLedgerApplyManager.isApplying()) | ||
{ | ||
trackingHeartBeat(); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this branch on isApplying is new; it's an assert before. is this correct? I can't really follow all the places this gets triggered.
.copySearchableLiveBucketListSnapshot(); | ||
} | ||
releaseAssert(threadIsMain()); | ||
releaseAssert(getLCLState().snapshot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! Did no callers of this rely on the previous lazy population?
@@ -1496,12 +1348,8 @@ LedgerManagerImpl::maybeResetLedgerCloseMetaDebugStream(uint32_t ledgerSeq) | |||
SearchableSnapshotConstPtr | |||
LedgerManagerImpl::getLastClosedSnaphot() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LedgerManagerImpl::getLastClosedSnaphot() | |
LedgerManagerImpl::getLastClosedSnapshot() |
ThreadInvariant::throwIfWrongThread() const | ||
{ | ||
std::lock_guard<std::recursive_mutex> guard(mThreadInvariantMutex); | ||
if (mActiveThreadIdSet && mThreadID != std::this_thread::get_id()) | ||
{ | ||
throw std::runtime_error("ThreadInvariant called from wrong thread"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not complaining about this, but curious: taking a mutex and doing a TLS access on every single method in this class might show up in profiles, considering how hot the ltx sometimes is; does it?
// `commit` and `rollback` terminate the program on an exception, | ||
// because they are marked noexcept SECTION("commit child") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit is somewhat worrying. Or rather: I wonder if the thread-invariant error ought to just be an abort in all cases, rather than an exception? the ltx is exception safe because transactions run in an exception-catch block and use exceptions for "meaningfully recoverable" errors. But a thread-safety violation isn't really recoverable, right? It should probably always be fatal?
Resolves #4592