Skip to content

Issue 6049 - lmdb - changelog is wrongly recreated by reindex task #6050

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 2 commits into from
Jan 25, 2024

Conversation

progier389
Copy link
Contributor

@progier389 progier389 commented Jan 24, 2024

dbmdb_import_all_done called at the end of import, bulk import and reindex is reenabling the backend
which trigger the replication plugin to check if data were not reloaded, but in the reindex case, the backend was not disabled (so the db ruv is not up to date) and changelog is then discarded .
The solution is to set back the backend in not busy mode when doing a reindex.

Issue: #6049

Reviewed by: @tbordaz (Thanks!)

@progier389 progier389 self-assigned this Jan 24, 2024
@progier389 progier389 added this to the 3.0.0 milestone Jan 24, 2024
@progier389 progier389 linked an issue Jan 24, 2024 that may be closed by this pull request
Copy link
Contributor

@tbordaz tbordaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks good. A minor question in the review.

Also something I do not understand, do you know why this problem raise only now. It should have failed similarly with BDB.

@@ -736,7 +736,11 @@ dbmdb_import_all_done(ImportJob *job, int ret)
ldbm_set_last_usn(inst->inst_be);

/* bring backend online again */
slapi_mtn_be_enable(inst->inst_be);
if (job->flags & FLAG_REINDEXING) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at bdb_import_all_done we have similar lines (enable backend even in case of reindex). Should it be also fixed in bdb_import_all_done ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No: Unlike in lmdb, bdb_import_all_done is not called after bdb_db2index (And that is why there is no problem with bdb)
That is due to a difference in the way xxx_db2index are coded:

  • bdb: The function is quite large (864 lines) because it prepares the reindex - performs the reindex - sets back backend in non_busy mode. BTW that is why bdb reindex is slower than import
  • mdb: The function is simpler (85 lines) because it simply prepare the reindex then reuse the import framework pipeline (in lmdb, the reindex processing is quite similar to the import except than data are read from entryid instead of ldif)

@@ -736,7 +736,11 @@ dbmdb_import_all_done(ImportJob *job, int ret)
ldbm_set_last_usn(inst->inst_be);

/* bring backend online again */
slapi_mtn_be_enable(inst->inst_be);
if (job->flags & FLAG_REINDEXING) {
instance_set_not_busy(inst);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks good. A bit painful to retrieve where it was set, I found bdb_db2index and dbmdb_db2index. Do you mind to put a comment from where the BUSY flag was set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will add a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

@tbordaz tbordaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanations.
LGTM

@progier389 progier389 merged commit d7e255a into 389ds:main Jan 25, 2024
@progier389 progier389 deleted the i6049 branch January 25, 2024 12:27
progier389 added a commit that referenced this pull request May 30, 2024
…6050)

* Issue 6049 - using lmdb the changelog is wrongly recreated by reindex task

dbmdb_import_all_done called at the end of import, bulk import and reindex is reenabling the backend
which trigger the replication plugin to check if data were not reloaded, but in the reindex case, the backend was not disabled (so the db ruv is not up to date) and changelog is then discarded .
The solution is to set back the backend in not busy mode when doing a reindex.

Issue: #6049

Reviewed by: @tbordaz (Thanks!)

(cherry picked from commit d7e255a)
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.

using lmdb the changelog is wrongly recreated by reindex task.
2 participants