mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-15 01:32:56 +00:00
chore: print series count after wal replay (#6344)
* chore/print-series-count-after-wal-replay: ### Add Series Count Functionality and Logging Enhancements - **`time_partition.rs`**: Introduced `series_count` method to calculate the total timeseries count across all time partitions. - **`opener.rs`**: Enhanced logging to include the total timeseries replayed during WAL replay. - **`version.rs`**: Added `series_count` method to `VersionControlData` for approximating timeseries count in the current version. - **`handler.rs`**: Added entry and exit logging for the `sql` function to trace execution flow. Signed-off-by: Lei, HUANG <mrsatangel@gmail.com> * chore/print-series-count-after-wal-replay: ### Remove Unused Import - **File Modified**: `src/servers/src/http/handler.rs` - **Change Summary**: Removed the unused `info` import from `common_telemetry`. Signed-off-by: Lei, HUANG <mrsatangel@gmail.com> --------- Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
This commit is contained in:
@@ -656,6 +656,11 @@ impl TimePartitions {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Timeseries count in all time partitions.
|
||||
pub(crate) fn series_count(&self) -> usize {
|
||||
self.inner.lock().unwrap().series_count()
|
||||
}
|
||||
}
|
||||
|
||||
/// Computes the start timestamp of the partition for `ts`.
|
||||
@@ -697,6 +702,13 @@ impl PartitionsInner {
|
||||
self.next_memtable_id += 1;
|
||||
id
|
||||
}
|
||||
|
||||
pub(crate) fn series_count(&self) -> usize {
|
||||
self.parts
|
||||
.iter()
|
||||
.map(|p| p.memtable.stats().series_count)
|
||||
.sum()
|
||||
}
|
||||
}
|
||||
|
||||
/// Time range of a partition.
|
||||
|
||||
@@ -665,9 +665,10 @@ where
|
||||
// to avoid reading potentially incomplete entries in the future.
|
||||
(on_region_opened)(region_id, flushed_entry_id, provider).await?;
|
||||
|
||||
let series_count = version_control.current().series_count();
|
||||
info!(
|
||||
"Replay WAL for region: {}, rows recovered: {}, last entry id: {}",
|
||||
region_id, rows_replayed, last_entry_id
|
||||
"Replay WAL for region: {}, rows recovered: {}, last entry id: {}, total timeseries replayed: {}",
|
||||
region_id, rows_replayed, last_entry_id, series_count
|
||||
);
|
||||
Ok(last_entry_id)
|
||||
}
|
||||
|
||||
@@ -249,6 +249,13 @@ pub(crate) struct VersionControlData {
|
||||
pub(crate) is_dropped: bool,
|
||||
}
|
||||
|
||||
impl VersionControlData {
|
||||
/// Approximate timeseries count in current version.
|
||||
pub(crate) fn series_count(&self) -> usize {
|
||||
self.version.memtables.mutable.series_count()
|
||||
}
|
||||
}
|
||||
|
||||
/// Static metadata of a region.
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct Version {
|
||||
|
||||
Reference in New Issue
Block a user