Unverified Commit 12a953bc authored by Connor's avatar Connor Committed by GitHub

add picked level and num_input_files_at_output_level (#634)

Add picked level of ingestion info and num_input_files_at_output_level of compaction info
Signed-off-by: 's avatarConnor1996 <zbk602423539@gmail.com>
parent e50d6e77
...@@ -2147,6 +2147,11 @@ int crocksdb_compactionjobinfo_output_level( ...@@ -2147,6 +2147,11 @@ int crocksdb_compactionjobinfo_output_level(
return info->rep.output_level; return info->rep.output_level;
} }
size_t crocksdb_compactionjobinfo_num_input_files_at_output_level(
const crocksdb_compactionjobinfo_t* info) {
return info->rep.stats.num_input_files_at_output_level;
}
uint64_t crocksdb_compactionjobinfo_input_records( uint64_t crocksdb_compactionjobinfo_input_records(
const crocksdb_compactionjobinfo_t* info) { const crocksdb_compactionjobinfo_t* info) {
return info->rep.stats.num_input_records; return info->rep.stats.num_input_records;
...@@ -2221,6 +2226,11 @@ crocksdb_externalfileingestioninfo_table_properties( ...@@ -2221,6 +2226,11 @@ crocksdb_externalfileingestioninfo_table_properties(
&info->rep.table_properties); &info->rep.table_properties);
} }
const int crocksdb_externalfileingestioninfo_picked_level(
const crocksdb_externalfileingestioninfo_t* info) {
return info->rep.picked_level;
}
/* External write stall info */ /* External write stall info */
extern C_ROCKSDB_LIBRARY_API const char* crocksdb_writestallinfo_cf_name( extern C_ROCKSDB_LIBRARY_API const char* crocksdb_writestallinfo_cf_name(
const crocksdb_writestallinfo_t* info, size_t* size) { const crocksdb_writestallinfo_t* info, size_t* size) {
......
...@@ -837,6 +837,9 @@ crocksdb_compactionjobinfo_total_input_bytes( ...@@ -837,6 +837,9 @@ crocksdb_compactionjobinfo_total_input_bytes(
extern C_ROCKSDB_LIBRARY_API uint64_t extern C_ROCKSDB_LIBRARY_API uint64_t
crocksdb_compactionjobinfo_total_output_bytes( crocksdb_compactionjobinfo_total_output_bytes(
const crocksdb_compactionjobinfo_t*); const crocksdb_compactionjobinfo_t*);
extern C_ROCKSDB_LIBRARY_API size_t
crocksdb_compactionjobinfo_num_input_files_at_output_level(
const crocksdb_compactionjobinfo_t* info);
/* Subcompaction job info */ /* Subcompaction job info */
extern C_ROCKSDB_LIBRARY_API void crocksdb_subcompactionjobinfo_status( extern C_ROCKSDB_LIBRARY_API void crocksdb_subcompactionjobinfo_status(
...@@ -860,6 +863,9 @@ crocksdb_externalfileingestioninfo_internal_file_path( ...@@ -860,6 +863,9 @@ crocksdb_externalfileingestioninfo_internal_file_path(
extern C_ROCKSDB_LIBRARY_API const crocksdb_table_properties_t* extern C_ROCKSDB_LIBRARY_API const crocksdb_table_properties_t*
crocksdb_externalfileingestioninfo_table_properties( crocksdb_externalfileingestioninfo_table_properties(
const crocksdb_externalfileingestioninfo_t*); const crocksdb_externalfileingestioninfo_t*);
extern C_ROCKSDB_LIBRARY_API const int
crocksdb_externalfileingestioninfo_picked_level(
const crocksdb_externalfileingestioninfo_t*);
/* External write stall info */ /* External write stall info */
extern C_ROCKSDB_LIBRARY_API const char* crocksdb_writestallinfo_cf_name( extern C_ROCKSDB_LIBRARY_API const char* crocksdb_writestallinfo_cf_name(
......
Subproject commit 3ddff2eddd3ea997d8097759298c2f51dbfcbb3f Subproject commit a2b20bddc303e5ac6fc75ebf657944307c4e2bc9
...@@ -2155,6 +2155,9 @@ extern "C" { ...@@ -2155,6 +2155,9 @@ extern "C" {
pub fn crocksdb_compactionjobinfo_output_records(info: *const DBCompactionJobInfo) -> u64; pub fn crocksdb_compactionjobinfo_output_records(info: *const DBCompactionJobInfo) -> u64;
pub fn crocksdb_compactionjobinfo_total_input_bytes(info: *const DBCompactionJobInfo) -> u64; pub fn crocksdb_compactionjobinfo_total_input_bytes(info: *const DBCompactionJobInfo) -> u64;
pub fn crocksdb_compactionjobinfo_total_output_bytes(info: *const DBCompactionJobInfo) -> u64; pub fn crocksdb_compactionjobinfo_total_output_bytes(info: *const DBCompactionJobInfo) -> u64;
pub fn crocksdb_compactionjobinfo_num_input_files_at_output_level(
info: *const DBCompactionJobInfo,
) -> size_t;
pub fn crocksdb_compactionjobinfo_compaction_reason( pub fn crocksdb_compactionjobinfo_compaction_reason(
info: *const DBCompactionJobInfo, info: *const DBCompactionJobInfo,
) -> CompactionReason; ) -> CompactionReason;
...@@ -2185,6 +2188,7 @@ extern "C" { ...@@ -2185,6 +2188,7 @@ extern "C" {
pub fn crocksdb_externalfileingestioninfo_table_properties( pub fn crocksdb_externalfileingestioninfo_table_properties(
info: *const DBIngestionInfo, info: *const DBIngestionInfo,
) -> *const DBTableProperties; ) -> *const DBTableProperties;
pub fn crocksdb_externalfileingestioninfo_picked_level(info: *const DBIngestionInfo) -> c_int;
pub fn crocksdb_writestallinfo_cf_name( pub fn crocksdb_writestallinfo_cf_name(
info: *const DBWriteStallInfo, info: *const DBWriteStallInfo,
......
...@@ -129,6 +129,10 @@ impl CompactionJobInfo { ...@@ -129,6 +129,10 @@ impl CompactionJobInfo {
unsafe { crocksdb_ffi::crocksdb_compactionjobinfo_total_output_bytes(&self.0) } unsafe { crocksdb_ffi::crocksdb_compactionjobinfo_total_output_bytes(&self.0) }
} }
pub fn num_input_files_at_output_level(&self) -> usize {
unsafe { crocksdb_ffi::crocksdb_compactionjobinfo_num_input_files_at_output_level(&self.0) }
}
pub fn compaction_reason(&self) -> CompactionReason { pub fn compaction_reason(&self) -> CompactionReason {
unsafe { crocksdb_ffi::crocksdb_compactionjobinfo_compaction_reason(&self.0) } unsafe { crocksdb_ffi::crocksdb_compactionjobinfo_compaction_reason(&self.0) }
} }
...@@ -183,6 +187,10 @@ impl IngestionInfo { ...@@ -183,6 +187,10 @@ impl IngestionInfo {
TableProperties::from_ptr(prop) TableProperties::from_ptr(prop)
} }
} }
pub fn picked_level(&self) -> i32 {
unsafe { crocksdb_ffi::crocksdb_externalfileingestioninfo_picked_level(&self.0) }
}
} }
#[repr(transparent)] #[repr(transparent)]
......
...@@ -55,6 +55,7 @@ impl EventListener for EventCounter { ...@@ -55,6 +55,7 @@ impl EventListener for EventCounter {
let path = info.input_file_at(i); let path = info.input_file_at(i);
assert!(path.exists()); assert!(path.exists());
} }
assert_eq!(info.num_input_files_at_output_level(), 0);
let output_file_count = info.output_file_count(); let output_file_count = info.output_file_count();
assert_ne!(output_file_count, 0); assert_ne!(output_file_count, 0);
...@@ -89,6 +90,7 @@ impl EventListener for EventCounter { ...@@ -89,6 +90,7 @@ impl EventListener for EventCounter {
assert!(!info.cf_name().is_empty()); assert!(!info.cf_name().is_empty());
assert!(info.internal_file_path().exists()); assert!(info.internal_file_path().exists());
assert_ne!(info.table_properties().data_size(), 0); assert_ne!(info.table_properties().data_size(), 0);
assert_ne!(info.picked_level(), 0);
self.ingestion.fetch_add(1, Ordering::SeqCst); self.ingestion.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