Skip to content

Issue 6680 - instance read-only mode is broken - #6681

Merged
progier389 merged 3 commits into
389ds:mainfrom
progier389:i4841
Mar 24, 2025
Merged

progier389 merged 3 commits into
389ds:mainfrom
progier389:i4841

Conversation

@progier389

@progier389 progier389 commented Mar 19, 2025 •

Copy link
Copy Markdown
Contributor

Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)

@progier389 progier389 linked an issue Mar 19, 2025 that may be closed by this pull request

@droideck droideck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Besides the minor issues, LGTM!

Comment thread ldap/servers/slapd/dse.c Outdated
char *error = NULL;
const char *regexp = "";

if (dsename) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be if (!dsename) { - or do I miss something?

@progier389 progier389 Mar 20, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch but now I wonder why the testcase is working ?

Comment thread ldap/servers/slapd/dse.c Outdated
Comment thread ldap/servers/slapd/dse.c
Comment on lines +1127 to +1130
if (ro) {
/* read-only mode and dse is up to date ==> Do not modify it. */
return ro;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the tests worked because we return here.
I can't recall exactly the order config init operates on the start-up, but I think it has the config read into memory at this point.

And the core part of the fix is is_rejected_op func.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The impact of the dsename bug is that is_readonly_set_in_dse always returns false, so ro variable stays false and internal operation get written in the dse.file.
I think that the reason the testcase pass is because it does not check that dse file is not modified after the restart.
I will improve that.

@tbordaz tbordaz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

inst.config.replace(attr, val)
inst.config.replace(RO_ATTR, 'off')
inst.restart
assert inst.config.get_attr_val_utf8(RO_ATTR) == "off"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it missing the step 7 - update a config attribute when RO is disabled

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I do not understand what do you mean. Could you precise ?
|Oh, I guess you meant Step 8: Try to modify another config attribute
(That is now step 14. I will add it)

Comment thread ldap/servers/slapd/dse.c
static bool
is_readonly_set_in_dse(const char *dsename)
{
Slapi_Regex *re_config = recomp("^dn:\\s+cn=config\\s*$");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't it match only for a line ending with 'cn=config' ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Matching a line ending with 'cn=config' would also work because cn=config is always the first entry that match the ending with 'cn=config' condition
But since the function is searching for nsslapd-readonly in cn=config entry, doing an exact match is more logical.
FYI: nsslapd-readonly is also an attribute of the backend config entry and we should ignore it.

}

/* Tombstone fixup are not rejected. */
if (operation_is_flag_set(op, OP_FLAG_TOMBSTONE_FIXUP)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we also accept RUV update (OP_FLAG_REPL_RUV) ? As there are no update, RUV should not change so it is probably fine to ignore RUV.
Or it may be handle by later test that accept all internal operation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Internal op are accepted only on dse backendthat is not replicated and has no tombstone ...
Since old code was already only checking OP_FLAG_TOMBSTONE_FIXUP, I think that your first assumption is right: no write operation means no RUV nor tombstone change

@progier389
progier389 merged commit fba3643 into 389ds:main Mar 24, 2025
progier389 added a commit to progier389/389-ds-base that referenced this pull request Apr 2, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: 389ds#6680

Reviewed by: @droideck, @tbordaz (thanks!)
@progier389
progier389 deleted the i4841 branch May 20, 2025 13:04
vashirov pushed a commit that referenced this pull request Jul 21, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)
vashirov pushed a commit that referenced this pull request Jul 21, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)
vashirov pushed a commit that referenced this pull request Jul 21, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)
vashirov pushed a commit that referenced this pull request Jul 21, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)
vashirov pushed a commit that referenced this pull request Jul 21, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)
vashirov pushed a commit that referenced this pull request Jul 21, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)
vashirov pushed a commit that referenced this pull request Jul 21, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)
vashirov pushed a commit that referenced this pull request Jul 21, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)
vashirov pushed a commit that referenced this pull request Jul 21, 2025
Read only mode is broken because some plugins fails to starts as they are not able to create/updates some entries in the dse backend.
Solution is to allow interrnal operations to write in dse.backend but not modify the dse.ldif (except for the special case when trying to modify nsslapd-readonly flags (to be allowed to set/unset the readonly mode)

Issue: #6680

Reviewed by: @droideck, @tbordaz (thanks!)
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.

instance read-only mode is broken.

3 participants