Skip to content

Commit

Permalink
refactor: cleanup unused methods in Bufferer trait (#25012)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiltontj committed May 16, 2024
1 parent adeb1a1 commit 4901982
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
14 changes: 0 additions & 14 deletions influxdb3_write/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub mod persister;
pub mod wal;
pub mod write_buffer;

use crate::catalog::Catalog;
use crate::paths::{ParquetFilePath, SegmentWalFilePath};
use async_trait::async_trait;
use bytes::Bytes;
Expand Down Expand Up @@ -85,19 +84,6 @@ pub trait Bufferer: Debug + Send + Sync + 'static {
precision: Precision,
) -> write_buffer::Result<BufferedWriteRequest>;

/// Closes the open segment and returns it so that it can be persisted or thrown away. A new segment will be opened
/// with the catalog rolling over.
async fn close_open_segment(&self) -> Result<Arc<dyn BufferSegment>>;

/// Once a process opens segments with the Persister, they'll know the last segment that was persisted.
/// This can be used with a `Bufferer` to pass into this method, which will look for any WAL segments with an
/// ID greater than the one passed in.
async fn load_segments_after(
&self,
segment_id: SegmentId,
catalog: Catalog,
) -> Result<Vec<Arc<dyn BufferSegment>>>;

/// Returns the configured WAL, if there is one.
fn wal(&self) -> Option<Arc<impl Wal>>;

Expand Down
2 changes: 1 addition & 1 deletion influxdb3_write/src/wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ fn segment_id_from_file_name(name: &str) -> Result<SegmentId> {
#[cfg(test)]
mod tests {
use super::*;
use crate::Catalog;
use crate::catalog::Catalog;
use crate::LpWriteOp;
use crate::Precision;

Expand Down
18 changes: 3 additions & 15 deletions influxdb3_write/src/write_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use crate::write_buffer::flusher::WriteBufferFlusher;
use crate::write_buffer::loader::load_starting_state;
use crate::write_buffer::segment_state::{run_buffer_segment_persist_and_cleanup, SegmentState};
use crate::{
BufferSegment, BufferedWriteRequest, Bufferer, ChunkContainer, LpWriteOp, Persister, Precision,
SegmentDuration, SegmentId, SequenceNumber, Wal, WalOp, WriteBuffer, WriteLineError,
BufferedWriteRequest, Bufferer, ChunkContainer, LpWriteOp, Persister, Precision,
SegmentDuration, SequenceNumber, Wal, WalOp, WriteBuffer, WriteLineError,
};
use async_trait::async_trait;
use data_types::{
Expand Down Expand Up @@ -394,18 +394,6 @@ impl<W: Wal, T: TimeProvider> Bufferer for WriteBufferImpl<W, T> {
.await
}

async fn close_open_segment(&self) -> crate::Result<Arc<dyn BufferSegment>> {
todo!()
}

async fn load_segments_after(
&self,
_segment_id: SegmentId,
_catalog: Catalog,
) -> crate::Result<Vec<Arc<dyn BufferSegment>>> {
todo!()
}

fn wal(&self) -> Option<Arc<impl Wal>> {
self.wal.clone()
}
Expand Down Expand Up @@ -843,7 +831,7 @@ mod tests {
use super::*;
use crate::persister::PersisterImpl;
use crate::wal::WalImpl;
use crate::{SequenceNumber, WalOpBatch};
use crate::{SegmentId, SequenceNumber, WalOpBatch};
use arrow::record_batch::RecordBatch;
use arrow_util::assert_batches_eq;
use datafusion_util::config::register_iox_object_store;
Expand Down

0 comments on commit 4901982

Please sign in to comment.