Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add http port for show #3808

Merged
merged 8 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/graph/executor/admin/ShowHostsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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 +41,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
2 changes: 2 additions & 0 deletions src/graph/executor/admin/ShowHostsExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "graph/executor/Executor.h"

DECLARE_int32(ws_http_port);

namespace nebula {
namespace graph {

Expand Down
1 change: 1 addition & 0 deletions src/graph/executor/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This source code is licensed under Apache 2.0 License.

SET(EXEC_QUERY_TEST_OBJS
$<TARGET_OBJECTS:ws_obj>
$<TARGET_OBJECTS:expression_obj>
$<TARGET_OBJECTS:network_obj>
$<TARGET_OBJECTS:process_obj>
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