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

upgrade recipes: missing reindexing of users and other indices #1914

Closed
ppanero opened this issue Oct 3, 2022 · 7 comments
Closed

upgrade recipes: missing reindexing of users and other indices #1914

ppanero opened this issue Oct 3, 2022 · 7 comments
Labels
bug Something isn't working stale No activity for more than 60 days.

Comments

@ppanero
Copy link
Member

ppanero commented Oct 3, 2022

Package version (if known): v10

Describe the bug

When upgrading the instance, sometimes we need to wipe out indices. Then we recreate. However, we only recreate some (records, communities, vocabularies) but not users and others.

Steps to Reproduce

  1. invenio index destroy --yes-i-know
  2. invenio index init
  3. invenio rdm-records rebuild-index
  4. invenio communities rebuild-index

Expected behavior

All indices should be rebuilt

Additional context

Potential solution:

  • index init should allow to create only one (or several, but not all) indices. That way we could make use of the same functionality in index destroy, which is already available.
  • reubild-indices should accept a name and rebuild only thata
    • encapsulate in invenio-cli
    • vocabularies should be in invenio-vocabularies not in rdm-records, alternatively include also communities. The command should be made parametrizable so we can use the target destroy-recreate-reindex.

At the moment we need to run this extra lines in a invenio-cli pyshell

from invenio_access.permissions import system_identity
from invenio_communities.proxies import current_communities
from invenio_records_resources.proxies import current_service_registry
from invenio_requests.proxies import current_events_service, current_requests_service

# reindex users
users_service = current_service_registry.get("users")
users_service.rebuild_index(system_identity)

# reindex groups
groups_service = current_service_registry.get("groups")
groups_service.rebuild_index(system_identity)

# reindex members and archived invitations
members_service = current_communities.service.members
members_service.rebuild_index(system_identity)

# reindex requests
for req_meta in current_requests_service.record_cls.model_cls.query.all():
    request = current_requests_service.record_cls(req_meta.data, model=req_meta)
    if not request.is_deleted:
        current_requests_service.indexer.index(request)

# reindex requests events
for event_meta in current_events_service.record_cls.model_cls.query.all():
    event = current_events_service.record_cls(event_meta.data, model=event_meta)
    current_events_service.indexer.index(event)
        
@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2022

This issue was automatically marked as stale.

@github-actions github-actions bot added the stale No activity for more than 60 days. label Dec 6, 2022
@ppanero
Copy link
Member Author

ppanero commented Dec 7, 2022

@zzacharo @kpsherva this is kinda important mostly for future releases (v11?)

@github-actions github-actions bot removed the stale No activity for more than 60 days. label Dec 8, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2023

This issue was automatically marked as stale.

@github-actions github-actions bot added the stale No activity for more than 60 days. label Feb 7, 2023
@ntarocco
Copy link
Contributor

@ppanero is this still valid for v12?

@ppanero
Copy link
Member Author

ppanero commented Aug 11, 2023

@ntarocco I haven't followed in depth the changes in indexer, so for context:

IIRC, when doing the migration v9 to v10 we had to remove indices because there were changes in the mappings. Then there is no complete re-index command (there is one in rdm-records, but it does not take into account subservices and the like). On the other hand this is only needed if there are changes to the mapping. Otherwise, if the records/users/etc. change but the mapping does not a simple re-index would work and there would be no need to remove the indices. In this latest case, the code above is only needed if we have to reindex users, groups, members, requrests, or events.

Idea: Maybe the work in access requests requires this since it adds some properties to the users (and I guess requests)

@github-actions github-actions bot removed the stale No activity for more than 60 days. label Aug 12, 2023
@github-actions
Copy link
Contributor

This issue was automatically marked as stale.

@github-actions github-actions bot added the stale No activity for more than 60 days. label Oct 12, 2023
@utnapischtim
Copy link
Contributor

documented in inveniosoftware/docs-invenio-rdm#607 and therefore fixed. the line invenio rdm rebuild-all-indices does the job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale No activity for more than 60 days.
Projects
Status: Done
Development

No branches or pull requests

3 participants