Skip to content

Commit

Permalink
add http port
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener committed Jan 26, 2022
1 parent 93693d9 commit 02b305b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/graph/executor/admin/ShowHostsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -27,6 +28,7 @@ folly::Future<Status> ShowHostsExecutor::showHosts() {
auto makeTraditionalResult = [&](const std::vector<meta::cpp2::HostItem> &hostVec) -> DataSet {
DataSet v({"Host",
"Port",
"HTTP port",
"Status",
"Leader count",
"Leader distribution",
Expand All @@ -40,6 +42,7 @@ folly::Future<Status> 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()) {
Expand Down
10 changes: 5 additions & 5 deletions src/graph/validator/MatchValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<MatchClause *>(clauses[i].get());
auto *matchClause = static_cast<MatchClause *>(clause.get());

auto matchClauseCtx = getContext<MatchClauseContext>();
matchClauseCtx->isOptional = matchClause->isOptional();
Expand Down Expand Up @@ -64,7 +64,7 @@ Status MatchValidator::validateImpl() {
break;
}
case ReadingClause::Kind::kUnwind: {
auto *unwindClause = static_cast<UnwindClause *>(clauses[i].get());
auto *unwindClause = static_cast<UnwindClause *>(clause.get());
auto unwindClauseCtx = getContext<UnwindClauseContext>();
unwindClauseCtx->aliasesAvailable = aliasesAvailable;
NG_RETURN_IF_ERROR(validateUnwind(unwindClause, *unwindClauseCtx));
Expand All @@ -79,7 +79,7 @@ Status MatchValidator::validateImpl() {
break;
}
case ReadingClause::Kind::kWith: {
auto *withClause = static_cast<WithClause *>(clauses[i].get());
auto *withClause = static_cast<WithClause *>(clause.get());
auto withClauseCtx = getContext<WithClauseContext>();
auto withYieldCtx = getContext<YieldClauseContext>();
withClauseCtx->yield = std::move(withYieldCtx);
Expand Down
2 changes: 2 additions & 0 deletions tests/admin/test_show_hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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+'),
Expand Down
4 changes: 2 additions & 2 deletions tests/tck/features/admin/Hosts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/tck/features/parser/Example.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 02b305b

Please sign in to comment.