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

Do not allow run concurrent sweep instances #8320

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TreeHunter9
Copy link
Contributor

Old code has a bug where if we already have a sweep instance running, and some one call sweep once more, allowSweepRun() will return false and we are gonna call clearSweepFlags(), that will reset sweep flags and release a sweep lock. This will open an opportunity to run a second sweep instance for both Super and Classic server.

@AlexPeshkoff
Copy link
Member

As far as I can see isc_sweep_concurrent_instance is returned to the client which started sweep. Where is is handled in a case when sweep started automatically? IMO it should be silently ignored.

@AlexPeshkoff AlexPeshkoff self-assigned this Nov 18, 2024
@TreeHunter9
Copy link
Contributor Author

TreeHunter9 commented Nov 18, 2024

As I can see, allowSweepThread() will not allow us to run auto sweep if we have concurrent instances, but I added a check for isc_sweep_concurrent_instance anyway, just in case.

@AlexPeshkoff
Copy link
Member

AlexPeshkoff commented Nov 18, 2024

OK. I reviewed the code once again. Initial problem can be fixed much simpler:

diff --git a/src/jrd/tra.cpp b/src/jrd/tra.cpp
index 3acd848976..f289c0d923 100644
--- a/src/jrd/tra.cpp
+++ b/src/jrd/tra.cpp
@@ -1848,7 +1848,6 @@ void TRA_sweep(thread_db* tdbb)

        if (!dbb->allowSweepRun(tdbb))
        {
-               dbb->clearSweepFlags(tdbb);
                return;
        }

But suggested patch contains new feature - user is notified what happened, without it sweep silently finishes in a moment. But I do not understand - why no diags in cases of RO database and explicitly set ATT_no_cleanup? If you want to add diags for sweep startup failure all cases should better be taken into an account.

@TreeHunter9
Copy link
Contributor Author

If you want to add diags for sweep startup failure all cases should better be taken into an account.

Yeah, I agree. I will add more error messages.

@hvlad
Copy link
Member

hvlad commented Nov 18, 2024

But suggested patch contains new feature - user is notified what happened, without it sweep silently finishes in a moment.

How it works for auto-sweep ?

@AlexPeshkoff
Copy link
Member

But suggested patch contains new feature - user is notified what happened, without it sweep silently finishes in a moment.

How it works for auto-sweep ?

See
#8320 (comment)

src/jrd/Database.cpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants