diff --git a/src/graph/executor/admin/ShowHostsExecutor.cpp b/src/graph/executor/admin/ShowHostsExecutor.cpp index f02a8acabed..ccb10003e17 100644 --- a/src/graph/executor/admin/ShowHostsExecutor.cpp +++ b/src/graph/executor/admin/ShowHostsExecutor.cpp @@ -10,6 +10,7 @@ #include "common/time/ScopedTimer.h" #include "graph/context/QueryContext.h" #include "graph/planner/plan/Admin.h" +#include "webservice/WebService.h" namespace nebula { namespace graph { @@ -27,6 +28,7 @@ folly::Future ShowHostsExecutor::showHosts() { auto makeTraditionalResult = [&](const std::vector &hostVec) -> DataSet { DataSet v({"Host", "Port", + "HTTP port", "Status", "Leader count", "Leader distribution", @@ -40,6 +42,7 @@ folly::Future ShowHostsExecutor::showHosts() { for (const auto &host : hostVec) { nebula::Row r({host.get_hostAddr().host, host.get_hostAddr().port, + FLAGS_ws_http_port, apache::thrift::util::enumNameSafe(host.get_status())}); int64_t leaderCount = 0; for (const auto &spaceEntry : host.get_leader_parts()) { diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index b079c3e7709..3cb3471beb0 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -30,11 +30,11 @@ Status MatchValidator::validateImpl() { retClauseCtx->yield = std::move(retYieldCtx); cypherCtx_->queryParts.emplace_back(); - for (size_t i = 0; i < clauses.size(); ++i) { - auto kind = clauses[i]->kind(); + for (auto &clause : clauses) { + auto kind = clause->kind(); switch (kind) { case ReadingClause::Kind::kMatch: { - auto *matchClause = static_cast(clauses[i].get()); + auto *matchClause = static_cast(clause.get()); auto matchClauseCtx = getContext(); matchClauseCtx->isOptional = matchClause->isOptional(); @@ -64,7 +64,7 @@ Status MatchValidator::validateImpl() { break; } case ReadingClause::Kind::kUnwind: { - auto *unwindClause = static_cast(clauses[i].get()); + auto *unwindClause = static_cast(clause.get()); auto unwindClauseCtx = getContext(); unwindClauseCtx->aliasesAvailable = aliasesAvailable; NG_RETURN_IF_ERROR(validateUnwind(unwindClause, *unwindClauseCtx)); @@ -79,7 +79,7 @@ Status MatchValidator::validateImpl() { break; } case ReadingClause::Kind::kWith: { - auto *withClause = static_cast(clauses[i].get()); + auto *withClause = static_cast(clause.get()); auto withClauseCtx = getContext(); auto withYieldCtx = getContext(); withClauseCtx->yield = std::move(withYieldCtx); diff --git a/tests/admin/test_show_hosts.py b/tests/admin/test_show_hosts.py index 49fe6e465e7..f4b6846d8dd 100644 --- a/tests/admin/test_show_hosts.py +++ b/tests/admin/test_show_hosts.py @@ -23,12 +23,14 @@ def test_show_hosts(self): query = "SHOW HOSTS"; expected_column_names = ['Host', 'Port', + 'HTTP port', 'Status', 'Leader count', 'Leader distribution', 'Partition distribution', 'Version'] expected_result_format = [[re.compile(r'\S+'), + re.compile(r'\d+'), re.compile(r'\d+'), re.compile(r'ONLINE|OFFLINE'), re.compile(r'\d+'), diff --git a/tests/tck/features/admin/Hosts.feature b/tests/tck/features/admin/Hosts.feature index ee4ae86b5e0..af80fef46d6 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 | Version | - | /\w+/ | /\d+/ | "ONLINE" | /\d+/ | /.*/ | /.*/ | /.*/ | + | Host | Port | HTTP port | Status | Leader count | Leader distribution | Partition distribution | Version | + | /\w+/ | /\d+/ | /\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 43e4d866206..0880a474a74 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 | Version | - | /\w+/ | /\d+/ | "ONLINE" | /\d+/ | /.*/ | /.*/ | /.*/ | + | Host | Port | HTTP port | Status | Leader count | Leader distribution | Partition distribution | Version | + | /\w+/ | /\d+/ | /\d+/ | "ONLINE" | /\d+/ | /.*/ | /.*/ | /.*/ | When executing query: """ SHOW HOSTS