@@ -164,8 +164,9 @@ void CompactionSubmitRegistry::jsonfy_compaction_status(std::string* result) {
164164 root.SetObject ();
165165
166166 auto add_node = [&root](const std::string& name, const Registry& registry) {
167- rapidjson::Value key;
168- key.SetString (name.c_str (), cast_set<uint32_t >(name.length ()), root.GetAllocator ());
167+ rapidjson::Value compaction_name;
168+ compaction_name.SetString (name.c_str (), cast_set<uint32_t >(name.length ()),
169+ root.GetAllocator ());
169170 rapidjson::Document path_obj;
170171 path_obj.SetObject ();
171172 for (const auto & it : registry) {
@@ -177,15 +178,16 @@ void CompactionSubmitRegistry::jsonfy_compaction_status(std::string* result) {
177178 arr.SetArray ();
178179
179180 for (const auto & tablet : it.second ) {
180- rapidjson::Value temp_key;
181- auto key_str = std::to_string (tablet->tablet_id ());
182- temp_key.SetString (key_str.c_str (), cast_set<uint32_t >(key_str.length ()),
183- root.GetAllocator ());
184- arr.PushBack (key, root.GetAllocator ());
181+ rapidjson::Value tablet_id;
182+ auto tablet_id_str = std::to_string (tablet->tablet_id ());
183+ tablet_id.SetString (tablet_id_str.c_str (),
184+ cast_set<uint32_t >(tablet_id_str.length ()),
185+ root.GetAllocator ());
186+ arr.PushBack (tablet_id, root.GetAllocator ());
185187 }
186188 path_obj.AddMember (path_key, arr, root.GetAllocator ());
187189 }
188- root.AddMember (key , path_obj, root.GetAllocator ());
190+ root.AddMember (compaction_name , path_obj, root.GetAllocator ());
189191 };
190192
191193 std::unique_lock<std::mutex> l (_tablet_submitted_compaction_mutex);
0 commit comments