Skip to content

Commit

Permalink
Update async_delta_writer_test.cpp
Browse files Browse the repository at this point in the history
Signed-off-by: meegoo <[email protected]>
  • Loading branch information
meegoo authored Nov 8, 2024
1 parent e8b4110 commit a59edd6
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions be/test/storage/lake/async_delta_writer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,43 +515,4 @@ TEST_F(LakeAsyncDeltaWriterTest, test_concurrent_write_and_close) {

SyncPoint::GetInstance()->DisableProcessing();
}

TEST_F(LakeAsyncDeltaWriterTest, test_flush) {
// Prepare data for writing
static const int kChunkSize = 128;
auto chunk0 = generate_data(kChunkSize);
auto indexes = std::vector<uint32_t>(kChunkSize);
for (int i = 0; i < kChunkSize; i++) {
indexes[i] = i;
}

auto txn_id = next_id();
auto tablet_id = _tablet_metadata->id();
ASSIGN_OR_ABORT(auto delta_writer, AsyncDeltaWriterBuilder()
.set_tablet_manager(_tablet_mgr.get())
.set_tablet_id(tablet_id)
.set_txn_id(txn_id)
.set_partition_id(_partition_id)
.set_mem_tracker(_mem_tracker.get())
.set_schema_id(_tablet_schema->id())
.build());
ASSERT_OK(delta_writer->open());
delta_writer->write(&chunk0, indexes.data(), indexes.size(), [&](const Status& st) { ASSERT_OK(st); });
delta_writer->flush([&](const Status& st) {
ASSERT_OK(st);
});
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
while (delta_writer->queueing_memtable_num() > 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
EXPECT_EQ(0, delta_writer->queueing_memtable_num());

// test flush after close
SyncPoint::GetInstance()->LoadDependency({{"AsyncDeltaWriterImpl::close:2", "AsyncDeltaWriterImpl::execute:1"}});
SyncPoint::GetInstance()->EnableProcessing();
DeferOp defer([&]() { SyncPoint::GetInstance()->DisableProcessing(); });
delta_writer->flush([&](const Status& st) { ASSERT_ERROR(st); });
delta_writer->close();
}

} // namespace starrocks::lake

0 comments on commit a59edd6

Please sign in to comment.