Skip to content

index sharing groups and members for large databases #4863

Description

@shepilov

Problem

Sharing group and member updates currently call sharing.FindActive, which
queries the active index with a limit of 1,000 documents, and then filters
the returned sharings in Go.

This pattern is used for:

  • contact additions and removals in shared groups
  • group metadata updates
  • deleted group revocation
  • member matching for invitation updates

On instances with more than 1,000 active sharings, matching sharings can be
omitted and group or member updates may not be propagated.

The sharing doctype currently has an index only on active. Group IDs are
stored in groups[].id, while member identities are stored in fields such as
members[].email and members[].instance.

Expected improvement

  • Add suitable CouchDB indexes or indexed denormalized fields for sharing
    group IDs and member identities.
  • Add sharing lookup helpers that query only the relevant active sharings by
    group or member.
  • Replace full FindActive scans in group and member event paths where
    possible.
  • Ensure all matching sharings are processed on databases containing more
    than 1,000 active sharings.
  • Add regression tests covering group and member lookups beyond the current
    query limit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions