@@ -67,7 +67,7 @@ DeleteBitmapAction::DeleteBitmapAction(DeleteBitmapActionType ctype, ExecEnv* ex
67
67
_engine (engine),
68
68
_delete_bitmap_action_type(ctype) {}
69
69
70
- static Status _check_param (HttpRequest* req, uint64_t * tablet_id) {
70
+ static Status _check_param (HttpRequest* req, uint64_t * tablet_id, bool * verbose ) {
71
71
const auto & req_tablet_id = req->param (TABLET_ID_KEY);
72
72
if (req_tablet_id.empty ()) {
73
73
return Status::InternalError (" tablet id is empty!" );
@@ -77,17 +77,18 @@ static Status _check_param(HttpRequest* req, uint64_t* tablet_id) {
77
77
} catch (const std::exception & e) {
78
78
return Status::InternalError (" convert tablet_id failed, {}" , e.what ());
79
79
}
80
+ if (*tablet_id == 0 ) {
81
+ return Status::InternalError (" check param failed: invalid tablet_id" );
82
+ }
83
+ *verbose = iequal (req->param (" verbose" ), " true" );
80
84
return Status::OK ();
81
85
}
82
86
83
87
Status DeleteBitmapAction::_handle_show_local_delete_bitmap_count (HttpRequest* req,
84
88
std::string* json_result) {
85
89
uint64_t tablet_id = 0 ;
86
- // check & retrieve tablet_id from req if it contains
87
- RETURN_NOT_OK_STATUS_WITH_WARN (_check_param (req, &tablet_id), " check param failed" );
88
- if (tablet_id == 0 ) {
89
- return Status::InternalError (" check param failed: missing tablet_id" );
90
- }
90
+ bool verbose = false ;
91
+ RETURN_NOT_OK_STATUS_WITH_WARN (_check_param (req, &tablet_id, &verbose), " check param failed" );
91
92
92
93
BaseTabletSPtr tablet = nullptr ;
93
94
if (config::is_cloud_mode ()) {
@@ -98,17 +99,33 @@ Status DeleteBitmapAction::_handle_show_local_delete_bitmap_count(HttpRequest* r
98
99
if (tablet == nullptr ) {
99
100
return Status::NotFound (" Tablet not found. tablet_id={}" , tablet_id);
100
101
}
101
- auto count = tablet->tablet_meta ()->delete_bitmap ().get_delete_bitmap_count ();
102
- auto cardinality = tablet-> tablet_meta ()-> delete_bitmap (). cardinality ();
103
- auto size = tablet-> tablet_meta ()-> delete_bitmap (). get_size ();
104
- LOG (INFO) << " show_local_delete_bitmap_count,tablet_id= " << tablet_id << " ,count= " << count
105
- << " ,cardinality =" << cardinality << " ,size =" << size;
106
-
102
+ auto dm = tablet->tablet_meta ()->delete_bitmap ().snapshot ();
103
+ auto count = dm. get_delete_bitmap_count ();
104
+ auto cardinality = dm. cardinality ();
105
+ auto size = dm. get_size ();
106
+ LOG (INFO) << " show_local_delete_bitmap_count for tablet_id =" << tablet_id << " , count =" << count
107
+ << " , cardinality= " << cardinality << " , size= " << size;
107
108
rapidjson::Document root;
108
109
root.SetObject ();
109
110
root.AddMember (" delete_bitmap_count" , count, root.GetAllocator ());
110
111
root.AddMember (" cardinality" , cardinality, root.GetAllocator ());
111
112
root.AddMember (" size" , size, root.GetAllocator ());
113
+ if (verbose) {
114
+ rapidjson::Document dm_arr;
115
+ dm_arr.SetArray ();
116
+ for (auto & [id, bitmap] : dm.delete_bitmap ) {
117
+ auto & [rowset_id, segment_id, version] = id;
118
+ std::stringstream ss;
119
+ ss << " rowset: " << rowset_id.to_string () << " , segment: " << segment_id
120
+ << " , version: " << version << " . cardinality: " << bitmap.cardinality ()
121
+ << " , size: " << bitmap.getSizeInBytes ();
122
+ std::string str = ss.str ();
123
+ rapidjson::Value value;
124
+ value.SetString (str.c_str (), cast_set<uint32_t >(str.length ()), dm_arr.GetAllocator ());
125
+ dm_arr.PushBack (value, dm_arr.GetAllocator ());
126
+ }
127
+ root.AddMember (" delete_bitmap" , dm_arr, root.GetAllocator ());
128
+ }
112
129
113
130
// to json string
114
131
rapidjson::StringBuffer strbuf;
@@ -122,11 +139,9 @@ Status DeleteBitmapAction::_handle_show_local_delete_bitmap_count(HttpRequest* r
122
139
Status DeleteBitmapAction::_handle_show_ms_delete_bitmap_count (HttpRequest* req,
123
140
std::string* json_result) {
124
141
uint64_t tablet_id = 0 ;
125
- // check & retrieve tablet_id from req if it contains
126
- RETURN_NOT_OK_STATUS_WITH_WARN (_check_param (req, &tablet_id), " check param failed" );
127
- if (tablet_id == 0 ) {
128
- return Status::InternalError (" check param failed: missing tablet_id" );
129
- }
142
+ bool verbose = false ;
143
+ RETURN_NOT_OK_STATUS_WITH_WARN (_check_param (req, &tablet_id, &verbose), " check param failed" );
144
+
130
145
TabletMetaSharedPtr tablet_meta;
131
146
auto st = _engine.to_cloud ().meta_mgr ().get_tablet_meta (tablet_id, &tablet_meta);
132
147
if (!st.ok ()) {
0 commit comments