test: shared mock LifecycleHandle impl
Moves the NoopLifecycleHandle to the Ingester's test_utils to share it across multiple components.pull/24376/head
parent
d7677c1b1d
commit
f0885612e9
|
@ -5,6 +5,8 @@
|
|||
//! some absolute number and individual Parquet files that get persisted below some number. It
|
||||
//! is expected that they may be above or below the absolute thresholds.
|
||||
|
||||
pub mod mock_handle;
|
||||
|
||||
use std::{collections::BTreeMap, sync::Arc, time::Duration};
|
||||
|
||||
use data_types::{NamespaceId, PartitionId, SequenceNumber, ShardId, TableId};
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
//! A mock [`LifecycleHandle`] impl for testing.
|
||||
|
||||
use data_types::{NamespaceId, PartitionId, SequenceNumber, ShardId, TableId};
|
||||
|
||||
use super::LifecycleHandle;
|
||||
|
||||
/// Special [`LifecycleHandle`] that never persists and always accepts more data.
|
||||
///
|
||||
/// This is useful to control persists manually.
|
||||
#[derive(Debug, Default, Clone, Copy)]
|
||||
pub struct NoopLifecycleHandle;
|
||||
|
||||
impl LifecycleHandle for NoopLifecycleHandle {
|
||||
fn log_write(
|
||||
&self,
|
||||
_partition_id: PartitionId,
|
||||
_shard_id: ShardId,
|
||||
_namespace_id: NamespaceId,
|
||||
_table_id: TableId,
|
||||
_sequence_number: SequenceNumber,
|
||||
_bytes_written: usize,
|
||||
_rows_written: usize,
|
||||
) -> bool {
|
||||
// do NOT pause ingest
|
||||
false
|
||||
}
|
||||
|
||||
fn can_resume_ingest(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ use super::DbScenario;
|
|||
use async_trait::async_trait;
|
||||
use backoff::BackoffConfig;
|
||||
use data_types::{
|
||||
DeletePredicate, IngesterMapping, NamespaceId, NonEmptyString, ParquetFileId, PartitionId,
|
||||
PartitionKey, Sequence, SequenceNumber, ShardId, ShardIndex, TableId, TombstoneId,
|
||||
DeletePredicate, IngesterMapping, NonEmptyString, ParquetFileId, PartitionId, PartitionKey,
|
||||
Sequence, SequenceNumber, ShardIndex, TombstoneId,
|
||||
};
|
||||
use dml::{DmlDelete, DmlMeta, DmlOperation, DmlWrite};
|
||||
use futures::StreamExt;
|
||||
|
@ -18,7 +18,7 @@ use ingester::{
|
|||
partition::resolver::CatalogPartitionResolver, FlatIngesterQueryResponse, IngesterData,
|
||||
IngesterQueryResponse, Persister,
|
||||
},
|
||||
lifecycle::LifecycleHandle,
|
||||
lifecycle::mock_handle::NoopLifecycleHandle,
|
||||
querier_handler::prepare_data_to_querier,
|
||||
};
|
||||
use iox_catalog::interface::get_schema_by_name;
|
||||
|
@ -964,31 +964,6 @@ impl MockIngester {
|
|||
}
|
||||
}
|
||||
|
||||
/// Special [`LifecycleHandle`] that never persists and always accepts more data.
|
||||
///
|
||||
/// This is useful to control persists manually.
|
||||
struct NoopLifecycleHandle {}
|
||||
|
||||
impl LifecycleHandle for NoopLifecycleHandle {
|
||||
fn log_write(
|
||||
&self,
|
||||
_partition_id: PartitionId,
|
||||
_shard_id: ShardId,
|
||||
_namespace_id: NamespaceId,
|
||||
_table_id: TableId,
|
||||
_sequence_number: SequenceNumber,
|
||||
_bytes_written: usize,
|
||||
_rows_written: usize,
|
||||
) -> bool {
|
||||
// do NOT pause ingest
|
||||
false
|
||||
}
|
||||
|
||||
fn can_resume_ingest(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl IngesterFlightClient for MockIngester {
|
||||
async fn query(
|
||||
|
|
Loading…
Reference in New Issue