diff --git a/src/graph/executor/admin/ShowHostsExecutor.cpp b/src/graph/executor/admin/ShowHostsExecutor.cpp index 84d4a85bb88..f02a8acabed 100644 --- a/src/graph/executor/admin/ShowHostsExecutor.cpp +++ b/src/graph/executor/admin/ShowHostsExecutor.cpp @@ -30,7 +30,8 @@ folly::Future ShowHostsExecutor::showHosts() { "Status", "Leader count", "Leader distribution", - "Partition distribution"}); + "Partition distribution", + "Version"}); std::map leaderPartsCount; std::map allPartsCount; @@ -82,6 +83,7 @@ folly::Future ShowHostsExecutor::showHosts() { r.emplace_back(leaderCount); r.emplace_back(leaders.str()); r.emplace_back(parts.str()); + r.emplace_back(host.version_ref().has_value() ? Value(*host.version_ref()) : Value()); v.emplace_back(std::move(r)); } // row loop { @@ -148,7 +150,7 @@ folly::Future ShowHostsExecutor::showHosts() { LOG(ERROR) << resp.status(); return resp.status(); } - auto value = std::move(resp).value(); + auto value = std::forward(resp).value(); if (type == meta::cpp2::ListHostType::ALLOC) { return finish(makeTraditionalResult(value)); } diff --git a/tests/admin/test_show_hosts.py b/tests/admin/test_show_hosts.py index 3392cb0760c..49fe6e465e7 100644 --- a/tests/admin/test_show_hosts.py +++ b/tests/admin/test_show_hosts.py @@ -26,13 +26,15 @@ def test_show_hosts(self): 'Status', 'Leader count', 'Leader distribution', - 'Partition distribution'] + 'Partition distribution', + 'Version'] expected_result_format = [[re.compile(r'\S+'), re.compile(r'\d+'), re.compile(r'ONLINE|OFFLINE'), re.compile(r'\d+'), re.compile(r'No valid partition|(\S+:\d+, )*\S+:\d+'), - re.compile(r'No valid partition|(\S+:\d+, )*\S+:\d+')]] + re.compile(r'No valid partition|(\S+:\d+, )*\S+:\d+'), + re.compile(r'(^$)|(v\d+\.\d+\.\d+)')]] resp = self.execute(query) self.check_resp_succeeded(resp) self.check_column_names(resp, expected_column_names) diff --git a/tests/tck/features/admin/Hosts.feature b/tests/tck/features/admin/Hosts.feature index 0d1b629cb31..2c473726bdd 100644 --- a/tests/tck/features/admin/Hosts.feature +++ b/tests/tck/features/admin/Hosts.feature @@ -9,8 +9,8 @@ Feature: Admin hosts SHOW HOSTS; """ Then the result should contain: - | Host | Port | Status | Leader count | Leader distribution | Partition distribution | - | /\w+/ | /\d+/ | "ONLINE" | /\d+/ | /.*/ | /.*/ | + | Host | Port | Status | Leader count | Leader distribution | Partition distribution | Version | + | /\w+/ | /\d+/ | "ONLINE" | /\d+/ | /.*/ | /.*/ | /.*/ | When executing query: """ SHOW HOSTS GRAPH; diff --git a/tests/tck/features/parser/Example.feature b/tests/tck/features/parser/Example.feature index a561ea48cd2..43e4d866206 100644 --- a/tests/tck/features/parser/Example.feature +++ b/tests/tck/features/parser/Example.feature @@ -24,8 +24,8 @@ Feature: Feature examples SHOW HOSTS """ Then the result should contain: - | Host | Port | Status | Leader count | Leader distribution | Partition distribution | - | /\w+/ | /\d+/ | "ONLINE" | /\d+/ | /.*/ | /.*/ | + | Host | Port | Status | Leader count | Leader distribution | Partition distribution | Version | + | /\w+/ | /\d+/ | "ONLINE" | /\d+/ | /.*/ | /.*/ | /.*/ | When executing query: """ SHOW HOSTS