Skip to content

Commit 469a5e9

Browse files
committed
feat: support scan metrics of FileStoreScan to align with ScanMetrics
1 parent 5dc22e7 commit 469a5e9

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/paimon/core/operation/file_store_scan.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Status FileStoreScan::ReadManifests(std::optional<Snapshot>* snapshot_ptr,
160160
}
161161
if (snapshot == std::nullopt) {
162162
filtered_manifests = std::vector<ManifestFileMeta>();
163+
all_manifests = std::vector<ManifestFileMeta>();
163164
return Status::OK();
164165
}
165166
PAIMON_RETURN_NOT_OK(ReadManifestsWithSnapshot(snapshot.value(), &all_manifests));

src/paimon/core/operation/key_value_file_store_scan_test.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,27 @@ TEST_F(KeyValueFileStoreScanTest, TestMaxSequenceNumber) {
144144
CreateFileStoreScan(table_path, scan_filter,
145145
/*table_schema_id=*/0, /*snapshot_id=*/2));
146146

147+
const auto started = std::chrono::high_resolution_clock::now();
147148
ASSERT_OK_AND_ASSIGN(std::shared_ptr<FileStoreScan::RawPlan> raw_plan, scan->CreatePlan());
148149
std::shared_ptr<Metrics> metrics = scan->GetScanMetrics();
149150
ASSERT_TRUE(metrics);
151+
ASSERT_OK_AND_ASSIGN(uint64_t last_scan_duration,
152+
metrics->GetCounter(ScanMetrics::LAST_SCAN_DURATION));
153+
ASSERT_LE(last_scan_duration, std::chrono::duration_cast<std::chrono::milliseconds>(
154+
std::chrono::high_resolution_clock::now() - started)
155+
.count());
150156
ASSERT_OK_AND_ASSIGN(uint64_t last_scanned_snapshot_id,
151157
metrics->GetCounter(ScanMetrics::LAST_SCANNED_SNAPSHOT_ID));
152-
ASSERT_EQ(2u, last_scanned_snapshot_id);
158+
ASSERT_EQ(last_scanned_snapshot_id, 2u);
159+
ASSERT_OK_AND_ASSIGN(uint64_t last_scanned_manifests,
160+
metrics->GetCounter(ScanMetrics::LAST_SCANNED_MANIFESTS));
161+
ASSERT_EQ(last_scanned_manifests, 1u);
162+
ASSERT_OK_AND_ASSIGN(uint64_t last_scan_skipped_table_files,
163+
metrics->GetCounter(ScanMetrics::LAST_SCAN_SKIPPED_TABLE_FILES));
164+
ASSERT_EQ(last_scan_skipped_table_files, 0u);
165+
ASSERT_OK_AND_ASSIGN(uint64_t last_scan_resulted_table_files,
166+
metrics->GetCounter(ScanMetrics::LAST_SCAN_RESULTED_TABLE_FILES));
167+
ASSERT_EQ(last_scan_resulted_table_files, 1u);
153168
int64_t max_sequence_num = GetMaxSequenceNumberOfRawPlan(raw_plan);
154169
ASSERT_EQ(max_sequence_num, 1);
155170
// test multiple scan

0 commit comments

Comments
 (0)