Skip to content

Commit 9967c32

Browse files
zaidoon1facebook-github-bot
authored andcommitted
expose flush reason for flush job info as well as compaction reason for sub compaction job info via c api (facebook#13770)
Summary: follow up to facebook#13601 Pull Request resolved: facebook#13770 Reviewed By: hx235 Differential Revision: D78426229 Pulled By: cbi42 fbshipit-source-id: d583288b87f9ab0d05421b3daeb57e297edf5ad6
1 parent 2850ccb commit 9967c32

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

db/c.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,10 @@ void rocksdb_backup_engine_options_destroy(
925925
delete options;
926926
}
927927

928+
void rocksdb_status_ptr_get_error(rocksdb_status_ptr_t* status, char** errptr) {
929+
SaveError(errptr, *(status->rep));
930+
}
931+
928932
rocksdb_checkpoint_t* rocksdb_checkpoint_object_create(rocksdb_t* db,
929933
char** errptr) {
930934
Checkpoint* checkpoint;
@@ -3061,6 +3065,10 @@ uint64_t rocksdb_flushjobinfo_smallest_seqno(
30613065
return info->rep.smallest_seqno;
30623066
}
30633067

3068+
uint32_t rocksdb_flushjobinfo_flush_reason(const rocksdb_flushjobinfo_t* info) {
3069+
return static_cast<uint32_t>(info->rep.flush_reason);
3070+
}
3071+
30643072
void rocksdb_reset_status(rocksdb_status_ptr_t* status_ptr) {
30653073
auto ptr = status_ptr->rep;
30663074
*ptr = Status::OK();
@@ -3192,6 +3200,11 @@ int rocksdb_subcompactionjobinfo_output_level(
31923200
return info->rep.output_level;
31933201
}
31943202

3203+
uint32_t rocksdb_subcompactionjobinfo_compaction_reason(
3204+
const rocksdb_subcompactionjobinfo_t* info) {
3205+
return static_cast<uint32_t>(info->rep.compaction_reason);
3206+
}
3207+
31953208
/* ExternalFileIngestionInfo */
31963209

31973210
const char* rocksdb_externalfileingestioninfo_cf_name(

include/rocksdb/c.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,8 @@ extern ROCKSDB_LIBRARY_API uint64_t
11711171
rocksdb_flushjobinfo_smallest_seqno(const rocksdb_flushjobinfo_t*);
11721172
extern ROCKSDB_LIBRARY_API void rocksdb_reset_status(
11731173
rocksdb_status_ptr_t* status_ptr);
1174+
extern ROCKSDB_LIBRARY_API uint32_t
1175+
rocksdb_flushjobinfo_flush_reason(const rocksdb_flushjobinfo_t* info);
11741176

11751177
/* Compaction job info */
11761178
extern ROCKSDB_LIBRARY_API void rocksdb_compactionjobinfo_status(
@@ -1221,6 +1223,9 @@ extern ROCKSDB_LIBRARY_API int rocksdb_subcompactionjobinfo_base_input_level(
12211223
const rocksdb_subcompactionjobinfo_t*);
12221224
extern ROCKSDB_LIBRARY_API int rocksdb_subcompactionjobinfo_output_level(
12231225
const rocksdb_subcompactionjobinfo_t*);
1226+
extern ROCKSDB_LIBRARY_API uint32_t
1227+
rocksdb_subcompactionjobinfo_compaction_reason(
1228+
const rocksdb_subcompactionjobinfo_t* info);
12241229

12251230
/* External file ingestion info */
12261231
extern ROCKSDB_LIBRARY_API const char*

0 commit comments

Comments
 (0)