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

Avoid full object reindex on security reindex #143

Merged
merged 4 commits into from
Sep 9, 2024

Conversation

valipod
Copy link
Contributor

@valipod valipod commented Aug 19, 2024

Add update_metadata=0 parameter to reindexObjectSecurity to avoid a full reindex and instead just reindex allowedRolesAndUsers.

This fixes #142

Add `update_metadata=0` parameter to reindexObjectSecurity to avoid a full reindex instead of just `allowedRolesAndUsers`.
Copy link
Contributor

@d-maurer d-maurer left a comment

Choose a reason for hiding this comment

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

You should at least add a CHANGES.rst entry describing your change.

Ideally, you would also provide a test verifying that your change is effective. However, as this might be difficult and effectiveness obvious, I do not insist on such a test.

@d-maurer
Copy link
Contributor

Add update_metadata=0 parameter to reindexObjectSecurity to avoid a full reindex and instead just reindex allowedRolesAndUsers.

To contribute you should sign a Zope contributor agreement (there is a procedure to contribute without such an agreement, but it is complex and we try to avoid it for this reason). After your signing, you become a member of zopefoundation and can create pull requests directly in the main repository (rather than a private fork). This facilitates cooperation with other zopefoundation members.

@valipod
Copy link
Contributor Author

valipod commented Aug 20, 2024

You should at least add a CHANGES.rst entry describing your change.

Ideally, you would also provide a test verifying that your change is effective. However, as this might be difficult and effectiveness obvious, I do not insist on such a test.

@d-maurer Sorry, I don't really have an explanation as to why I have not initially updated the changelog (but it is done now). And yes, testing in this case would be far too complicated for the simplicity and effectiveness of the fix.

Also, I was under the impression, that the Plone Contributor Agreement is used, which I have signed years ago, I am a contributor on Plone already. But true, back then I specified Plone, not Zope. I have just sent another signed copy to agreements@plone with Zope mentioned.

Please let me know if I need to wait for that to go through and create another branch directly here, or you could merge this private fork.

@d-maurer
Copy link
Contributor

d-maurer commented Aug 20, 2024 via email

@valipod
Copy link
Contributor Author

valipod commented Aug 20, 2024

@d-maurer I have fixed those tests, which were clearly designed to just mirror the incorrect situation where the metadata was updated. I have also fixed the linting error.

@icemac
Copy link
Member

icemac commented Aug 20, 2024

Just a small correction: I am not the one who processes contributor agreements, this is done by the Plone foundation. To bo honest I do not even know who actually does this.

@icemac
Copy link
Member

icemac commented Aug 20, 2024

The broken docs test is fixed in #144 and might require a rebase or merge with master, so it gets also fixed here.

@icemac icemac added the do not merge Merge blocked (e.g. no contributor agreement) label Aug 21, 2024
Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

It would be safer to only skip updating the catalog metadata if one of the _cmf_security_indexes is not also included in the metadata columns.

@d-maurer
Copy link
Contributor

d-maurer commented Aug 22, 2024 via email

@davisagli
Copy link
Member

@d-maurer I mentioned it because I have added allowedRolesAndUsers to the catalog metadata for one project, where I needed to be able to read it from catalog results. This would be a breaking change for that project.

@d-maurer
Copy link
Contributor

d-maurer commented Aug 22, 2024 via email

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

@d-maurer I went to check the project I was thinking of, and can't find it, so perhaps I was remembering wrong. I'll approve this change.

I do wish that the ZCatalog API worked differently here. It should require only passing a list of attributes that changed, and then it should be the catalog's responsibility to efficiently update the indexes and catalog metadata that is based on those attributes, if any. Not possible to change now, but perhaps a new API could be added...

For special purposes, the information could be easily obtained from the
"reverse map" associated with the "allowed_roles_and_users" index

This is a good point -- but as far as I'm aware, there isn't a convenient API for getting this info from a catalog query result.

@d-maurer
Copy link
Contributor

d-maurer commented Aug 23, 2024 via email

@valipod
Copy link
Contributor Author

valipod commented Sep 2, 2024

So the do not merge label can be removed and the merge performed, correct?

@valipod
Copy link
Contributor Author

valipod commented Sep 2, 2024

@icemac Sorry, I forgot to tag you.

@valipod
Copy link
Contributor Author

valipod commented Sep 5, 2024

@icemac Also perhaps worth mentioning that I have signed the contributor agreement and I have been approved as a contributor.

@icemac icemac removed the do not merge Merge blocked (e.g. no contributor agreement) label Sep 6, 2024
@icemac
Copy link
Member

icemac commented Sep 6, 2024

@valipod Thank you for signing the contributor agreement.
The PR has been approved, as a member of the project, you are now able to merge the PR yourself. (This is the default for the zopefoundation projects: the creator of a PR merges it. This way we assure the member role and that the creator is satisfied with the PR.)

@valipod valipod merged commit a054d06 into zopefoundation:master Sep 9, 2024
10 checks passed
@valipod
Copy link
Contributor Author

valipod commented Sep 26, 2024

@d-maurer Can we have new release?

@dataflake
Copy link
Member

I'll do a release after #145 is reviewed and merged.

@dataflake
Copy link
Member

Release 3.6 is now live.

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.

reindexObjectSecurity missing update_metadata parameter (has the effect of full reindex)
5 participants