-
Notifications
You must be signed in to change notification settings - Fork 560
Add a metastore read replica role for read-only routing #6548
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
Open
shuheiktgw
wants to merge
16
commits into
quickwit-oss:main
Choose a base branch
from
shuheiktgw:metastore-read-replica-role
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
cd6b3d3
Add metastore read replica role and config
shuheiktgw 41beabb
Support resolving a read-only PostgreSQL metastore
shuheiktgw 91eeb40
Serve a read-only metastore for the read replica role
shuheiktgw f644a32
Route search-path metastore reads to the read replica
shuheiktgw 8f60c0e
Document the metastore read replica and test read-only resolution
shuheiktgw 91d17f0
Use a read-only MetastoreReadService trait for read routing
shuheiktgw e50cd29
Avoid primary fallback for read replica routing
shuheiktgw f405a5f
Fix clippy warning in read replica config validation
shuheiktgw 902134b
Add searcher metastore read replica setting
shuheiktgw 2b0308b
Remove config URI validation for read replica
shuheiktgw 4832972
Fix metastore gRPC mount comment
shuheiktgw ae8f916
Update metastore readiness checks
shuheiktgw 1828871
Require metastore read replica standalone role
shuheiktgw 150174e
Remove unnecessary unit tests
shuheiktgw 2002587
Refine metastore read replica wiring
shuheiktgw 09c32ad
Fix default service startup in tests
shuheiktgw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -343,6 +343,9 @@ pub struct SearcherConfig { | |
| #[serde(default)] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub storage_timeout_policy: Option<StorageTimeoutPolicy>, | ||
| /// Routes read-only metastore requests from searchers, including DataFusion when enabled, to | ||
| /// nodes running the `metastore_read_replica` service. | ||
| pub use_metastore_read_replica: bool, | ||
| pub warmup_memory_budget: ByteSize, | ||
| pub warmup_single_split_initial_allocation: ByteSize, | ||
| /// Lambda configuration for serverless leaf search execution. | ||
|
|
@@ -566,6 +569,7 @@ impl Default for SearcherConfig { | |
| request_timeout_secs: Self::default_request_timeout_secs(), | ||
| leaf_request_timeout_secs: Self::default_request_timeout_secs(), | ||
| storage_timeout_policy: None, | ||
| use_metastore_read_replica: false, | ||
| warmup_memory_budget: ByteSize::gb(100), | ||
| warmup_single_split_initial_allocation: ByteSize::mb(300), | ||
| lambda: None, | ||
|
|
@@ -812,6 +816,10 @@ pub struct NodeConfig { | |
| pub peer_seeds: Vec<String>, | ||
| pub data_dir_path: PathBuf, | ||
| pub metastore_uri: Uri, | ||
| /// Optional PostgreSQL read replica URI. It is used as the connection URI by nodes running the | ||
| /// [`QuickwitService::MetastoreReadReplica`] role. | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub metastore_read_replica_uri: Option<Uri>, | ||
| pub default_index_root_uri: Uri, | ||
| pub rest_config: RestConfig, | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
|
|
@@ -872,6 +880,9 @@ impl NodeConfig { | |
| pub fn redact(&mut self) { | ||
| self.metastore_configs.redact(); | ||
| self.metastore_uri.redact(); | ||
| if let Some(metastore_read_replica_uri) = &mut self.metastore_read_replica_uri { | ||
| metastore_read_replica_uri.redact(); | ||
| } | ||
| self.storage_configs.redact(); | ||
| } | ||
|
|
||
|
|
@@ -896,6 +907,26 @@ mod tests { | |
| use super::*; | ||
| use crate::IndexerConfig; | ||
|
|
||
| #[test] | ||
| fn test_node_config_redact_metastore_uris() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| let mut config = NodeConfig::for_test(); | ||
| config.metastore_uri = Uri::for_test("postgresql://username:password@host:5432/db"); | ||
| config.metastore_read_replica_uri = Some(Uri::for_test( | ||
| "postgresql://replica-user:replica-password@replica-host:5432/db", | ||
| )); | ||
|
|
||
| config.redact(); | ||
|
|
||
| assert_eq!( | ||
| config.metastore_uri, | ||
| "postgresql://username:***redacted***@host:5432/db" | ||
| ); | ||
| assert_eq!( | ||
| config.metastore_read_replica_uri.unwrap(), | ||
| "postgresql://replica-user:***redacted***@replica-host:5432/db" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_indexer_config_serialization() { | ||
| { | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason we need this flag in addition to
metastore_read_replica_uriis that users can setmetastore_read_replica_urivia theQW_METASTORE_READ_REPLICA_URIenvironment variable. Without this flag, searchers would need access to that same environment variable even though they don’t need the secret itself.