]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: Fix 1 active, multi standy mds condition timing issue
authorJimyeong Lee <jinmyeong.lee@linecorp.com>
Sun, 30 Jul 2023 09:22:23 +0000 (18:22 +0900)
committerRishabh Dave <ridave@redhat.com>
Wed, 8 Nov 2023 17:18:39 +0000 (22:48 +0530)
When there are 1 active MDS and several standby MDSs and the result of standby-MDS comes after the active-MDS's,
the closing square bracket cannot be added.
To Fix this issue, add one more condition

Signed-off-by: Jimyeong Lee <jinmyeong.lee@linecorp.com>
(cherry picked from commit 7cd12779c63a4159eb5388d699e92051fbfd7067)

src/client/Client.cc

index 21940dde6f317d8b43b9d7c40622601eebac679e..6a56f8073ecb60d0f397b11bfe41a8fef1358111 100644 (file)
@@ -6414,7 +6414,6 @@ void Client::handle_command_reply(const MConstRef<MCommandReply>& m)
   if (op.outbl) {
     if (multi_id != 0 && m->r == 0) {
       string prefix;
-      string suffix = "}";
       string mds_name = fmt::format("mds.{}", fsmap->get_info_gid(op.mds_gid).name);
 
       if (op.outbl->length() == 0) { // very first command result
@@ -6423,19 +6422,20 @@ void Client::handle_command_reply(const MConstRef<MCommandReply>& m)
       else {
         prefix = fmt::format(",{{\"{}\":", mds_name);
       }
-
       op.outbl->append(prefix);
       op.outbl->append(m->get_data());
-      op.outbl->append(suffix);
+      op.outbl->append("}");
+    }
 
+    if (multi_id == 0) {
+      *op.outbl = m->get_data();
+    }
+    else {
       // when this command is the last one
-      if (command_table.count_multi_commands(multi_id) == 1) {
+      if (command_table.count_multi_commands(multi_id) <= 1) {
         op.outbl->append("]");
       }
     }
-    else if (multi_id == 0) {
-      *op.outbl = m->get_data();
-    }
   }
   if (op.outs) {
     *op.outs = m->rs;