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

[Segment Replication] Expose utility to denote whether data can be stale #9566

Closed
dreamer-89 opened this issue Aug 27, 2023 · 1 comment · Fixed by #9593
Closed

[Segment Replication] Expose utility to denote whether data can be stale #9566

dreamer-89 opened this issue Aug 27, 2023 · 1 comment · Fixed by #9593
Assignees
Labels
discuss Issues intended to help drive brainstorming and decision making distributed framework Plugins v2.10.0

Comments

@dreamer-89
Copy link
Member

dreamer-89 commented Aug 27, 2023

With #8211, few plugins resorted to _primary preference to support strong reads for all search requests (e.g sql). This is not needed for DOCUMENT replication and thus, puts un-necessary burden on primary. To keep plugins/consumers agnostic of replication strategy, core can expose a utility to identify if replica can return stale data and thus hint consumers to add _primary preference only when needed.

In core, we can expose a utility which returns boolean denoting that client should use _primary preference if latest data is desired

Alternative

  1. Do not change anything. All requests will land on primary including requests for DOCUMENT replication type indices
  2. Use _primary preference only for SEGMENT replication enabled indices. This needs clients to know about underlying replication strategy.
@dreamer-89 dreamer-89 added discuss Issues intended to help drive brainstorming and decision making Plugins distributed framework labels Aug 27, 2023
@dreamer-89 dreamer-89 changed the title [Segment Replication] Allow [Segment Replication] Expose utility to denote whether data can be stale Aug 27, 2023
@mch2
Copy link
Member

mch2 commented Aug 28, 2023

Hi @dreamer-89.

A better long term solution here is to set a consistency policy in requests. I'm working on getting a proposal going for this cc @nknize

Until we have that though, clients that need a strong read with SR will need to add the _primary preference to search requests based on replication strategy. To make this lookup easy can we reuse a function on ClusterState proposed with https://github.com/opensearch-project/OpenSearch/pull/9536/files#r1304689150?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Issues intended to help drive brainstorming and decision making distributed framework Plugins v2.10.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants