Commit 4fd63913 authored by Huachao Huang's avatar Huachao Huang Committed by GitHub

Add some compaction job info stats. (#120)

parent b95e696f
......@@ -1643,6 +1643,16 @@ crocksdb_compactionjobinfo_table_properties(
&info->rep.table_properties);
}
uint64_t crocksdb_compactionjobinfo_elapsed_micros(
const crocksdb_compactionjobinfo_t* info) {
return info->rep.stats.elapsed_micros;
}
uint64_t crocksdb_compactionjobinfo_num_corrupt_keys(
const crocksdb_compactionjobinfo_t* info) {
return info->rep.stats.num_corrupt_keys;
}
/* ExternalFileIngestionInfo */
const char* crocksdb_externalfileingestioninfo_cf_name(
......
......@@ -625,6 +625,10 @@ crocksdb_compactionjobinfo_output_file_at(const crocksdb_compactionjobinfo_t*,
extern C_ROCKSDB_LIBRARY_API const crocksdb_table_properties_collection_t*
crocksdb_compactionjobinfo_table_properties(
const crocksdb_compactionjobinfo_t*);
extern C_ROCKSDB_LIBRARY_API uint64_t
crocksdb_compactionjobinfo_elapsed_micros(const crocksdb_compactionjobinfo_t*);
extern C_ROCKSDB_LIBRARY_API uint64_t
crocksdb_compactionjobinfo_num_corrupt_keys(const crocksdb_compactionjobinfo_t*);
/* External file ingestion info */
......
......@@ -1064,6 +1064,10 @@ extern "C" {
-> *const c_char;
pub fn crocksdb_compactionjobinfo_table_properties(info: *const DBCompactionJobInfo)
-> *const DBTablePropertiesCollection;
pub fn crocksdb_compactionjobinfo_elapsed_micros(info: *const DBCompactionJobInfo)
-> uint64_t;
pub fn crocksdb_compactionjobinfo_num_corrupt_keys(info: *const DBCompactionJobInfo)
-> uint64_t;
pub fn crocksdb_externalfileingestioninfo_cf_name(info: *const DBIngestionInfo,
size: *mut size_t)
......
......@@ -80,6 +80,14 @@ impl CompactionJobInfo {
TablePropertiesCollectionView::from_ptr(prop)
}
}
pub fn elapsed_micros(&self) -> u64 {
unsafe { crocksdb_ffi::crocksdb_compactionjobinfo_elapsed_micros(&self.0) }
}
pub fn num_corrupt_keys(&self) -> u64 {
unsafe { crocksdb_ffi::crocksdb_compactionjobinfo_num_corrupt_keys(&self.0) }
}
}
pub struct IngestionInfo(DBIngestionInfo);
......
......@@ -61,6 +61,9 @@ impl EventListener for EventCounter {
let props = info.table_properties();
assert_eq!(props.len(), output_file_count + input_file_count);
assert_ne!(info.elapsed_micros(), 0);
assert_eq!(info.num_corrupt_keys(), 0);
self.compaction.fetch_add(1, Ordering::SeqCst);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment