Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
DevilExileSu committed Sep 12, 2023
1 parent 1cd27d4 commit 4cd7aaa
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/mito2/src/engine/truncate_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use object_store::util::join_path;
use smallvec::SmallVec;
use store_api::region_engine::RegionEngine;
use store_api::region_request::{
RegionCloseRequest, RegionFlushRequest, RegionOpenRequest, RegionRequest, RegionTruncateRequest,
RegionFlushRequest, RegionOpenRequest, RegionRequest, RegionTruncateRequest,
};
use store_api::storage::RegionId;
use tokio::sync::oneshot;
Expand Down Expand Up @@ -103,7 +103,7 @@ async fn test_engine_put_data_after_truncate() {
};
put_rows(&engine, region_id, rows).await;

// Scan the region.
// Scan the region.mut
let request = ScanRequest::default();
let stream = engine.handle_query(region_id, request).await.unwrap();
let batches = RecordBatches::try_collect(stream).await.unwrap();
Expand Down Expand Up @@ -234,19 +234,17 @@ async fn test_engine_truncate_reopen() {
};
put_rows(&engine, region_id, rows).await;

let region = engine.get_region(region_id).unwrap();
let last_entry_id = region.version_control.current().last_entry_id;

// Truncate the region
engine
.handle_request(region_id, RegionRequest::Truncate(RegionTruncateRequest {}))
.await
.unwrap();

// Close the region.
engine
.handle_request(region_id, RegionRequest::Close(RegionCloseRequest {}))
.await
.unwrap();

// Reopen the region again.
let engine = env.reopen_engine(engine, MitoConfig::default()).await;
engine
.handle_request(
region_id,
Expand All @@ -259,6 +257,9 @@ async fn test_engine_truncate_reopen() {
.await
.unwrap();

let region = engine.get_region(region_id).unwrap();
assert_eq!(last_entry_id, region.version().flushed_entry_id);

// Scan the region.
let request = ScanRequest::default();
let stream = engine.handle_query(region_id, request).await.unwrap();
Expand Down

0 comments on commit 4cd7aaa

Please sign in to comment.