Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bigtable-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ async fn main() -> anyhow::Result<()> {
instance_name: args.instance.clone(),
table_name: args.table.clone(),
connections: Some(args.pool),
rpc_timeout: Duration::from_secs(2),
cogs: None,
},
&ChangeStreamFactory::default(),
Expand Down
3 changes: 3 additions & 0 deletions objectstore-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ mod tests {
};
let HighVolumeStorageConfig::BigTable(hv) = &c.high_volume;
assert_eq!(hv.project_id, "my-project");
assert_eq!(hv.rpc_timeout, Duration::from_secs(2));
let MultipartUploadStorageConfig::Gcs(lt) = &c.long_term else {
panic!("expected gcs long_term");
};
Expand All @@ -940,6 +941,7 @@ mod tests {
jail.set_env("OS__STORAGE__HIGH_VOLUME__PROJECT_ID", "my-project");
jail.set_env("OS__STORAGE__HIGH_VOLUME__INSTANCE_NAME", "my-instance");
jail.set_env("OS__STORAGE__HIGH_VOLUME__TABLE_NAME", "my-table");
jail.set_env("OS__STORAGE__HIGH_VOLUME__RPC_TIMEOUT", "750ms");
jail.set_env("OS__STORAGE__LONG_TERM__TYPE", "filesystem");
jail.set_env("OS__STORAGE__LONG_TERM__PATH", "/data/lt");

Expand All @@ -952,6 +954,7 @@ mod tests {
assert_eq!(hv.project_id, "my-project");
assert_eq!(hv.instance_name, "my-instance");
assert_eq!(hv.table_name, "my-table");
assert_eq!(hv.rpc_timeout, Duration::from_millis(750));
let MultipartUploadStorageConfig::FileSystem(lt) = &c.long_term else {
panic!("expected filesystem long_term");
};
Expand Down
25 changes: 21 additions & 4 deletions objectstore-service/src/backend/bigtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ pub struct BigTableConfig {
/// - `OS__STORAGE__CONNECTIONS=16` (optional)
pub connections: Option<usize>,

/// Timeout for an individual Bigtable RPC attempt.
///
/// # Default
///
/// `2s`
///
/// # Environment Variables
///
/// - `OS__STORAGE__RPC_TIMEOUT=2s`
/// - `OS__STORAGE__HIGH_VOLUME__RPC_TIMEOUT=2s` (tiered storage)
#[serde(default = "default_rpc_timeout", with = "humantime_serde")]
pub rpc_timeout: Duration,

/// Reports what this backend stores, for per-usecase cost attribution.
///
/// # Default
Expand All @@ -142,8 +155,10 @@ pub struct BigTableConfig {
pub cogs: Option<CostTrackerStreamConfig>,
}

/// Connection timeout used for the initial connection to Bigtable.
const CONNECT_TIMEOUT: Duration = Duration::from_secs(10);
fn default_rpc_timeout() -> Duration {
Duration::from_secs(2)
}

/// Maximum age for connections (GRPC channels) to Bigtable, after which they will be swapped with
/// new ones in the background.
/// This is intended to avoid latency spikes that could occur every hour or so, when the server
Expand Down Expand Up @@ -784,6 +799,7 @@ impl BigTableBackend {
instance_name,
table_name,
connections,
rpc_timeout,
cogs,
} = config;
let change_stream = streams.build(cogs.as_ref());
Expand All @@ -794,15 +810,15 @@ impl BigTableBackend {
&project_id,
&instance_name,
false, // is_read_only
Some(CONNECT_TIMEOUT),
Some(rpc_timeout),
)?
} else {
let token_provider = PrefetchingTokenProvider::gcp_auth(TOKEN_SCOPES).await?;
BigTableConnection::new_with_managed_transport(
&project_id,
&instance_name,
false, // is_read_only
Some(CONNECT_TIMEOUT),
Some(rpc_timeout),
Arc::new(token_provider),
connections.unwrap_or(1),
true, // prime_channels
Expand Down Expand Up @@ -1471,6 +1487,7 @@ mod tests {
instance_name: "objectstore".into(),
table_name: "objectstore".into(),
connections: None,
rpc_timeout: default_rpc_timeout(),
cogs: None,
}
}
Expand Down
1 change: 1 addition & 0 deletions objectstore-service/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ mod tests {
instance_name: "objectstore".into(),
table_name: "objectstore".into(),
connections: None,
rpc_timeout: Duration::from_secs(2),
cogs: None,
};
let gcs_config = GcsConfig {
Expand Down
Loading