diff --git a/src/common/meta/Common.h b/src/common/meta/Common.h index 5b6f9c44e7d..3841ada4a2a 100644 --- a/src/common/meta/Common.h +++ b/src/common/meta/Common.h @@ -62,7 +62,6 @@ using RemoteListeners = std::unordered_map>>; - } // namespace meta } // namespace nebula diff --git a/src/graph/validator/AdminValidator.cpp b/src/graph/validator/AdminValidator.cpp index 7138501aafd..c644e15b0f1 100644 --- a/src/graph/validator/AdminValidator.cpp +++ b/src/graph/validator/AdminValidator.cpp @@ -21,8 +21,9 @@ Status CreateSpaceValidator::validateImpl() { auto status = Status::OK(); spaceDesc_.space_name_ref() = std::move(*(sentence->spaceName())); if (sentence->zoneNames()) { - spaceDesc_.zone_names_ref() = sentence->zoneNames()->zoneNames(); + return Status::SemanticError("Create space with zone is unsupported"); } + StatusOr retStatusOr; std::string result; auto *charsetInfo = qctx_->getCharsetInfo(); @@ -393,10 +394,6 @@ Status ListDrainersValidator::toPlan() { } Status AddHostsValidator::validateImpl() { - return Status::OK(); -} - -Status AddHostsValidator::toPlan() { auto sentence = static_cast(sentence_); auto hosts = sentence->hosts()->hosts(); if (hosts.empty()) { @@ -407,7 +404,12 @@ Status AddHostsValidator::toPlan() { if (it != hosts.end()) { return Status::SemanticError("Host have duplicated"); } + return Status::OK(); +} +Status AddHostsValidator::toPlan() { + auto sentence = static_cast(sentence_); + auto hosts = sentence->hosts()->hosts(); auto *addHost = AddHosts::make(qctx_, nullptr, hosts); root_ = addHost; tail_ = root_; @@ -415,10 +417,6 @@ Status AddHostsValidator::toPlan() { } Status DropHostsValidator::validateImpl() { - return Status::OK(); -} - -Status DropHostsValidator::toPlan() { auto sentence = static_cast(sentence_); auto hosts = sentence->hosts()->hosts(); if (hosts.empty()) { @@ -429,7 +427,12 @@ Status DropHostsValidator::toPlan() { if (it != hosts.end()) { return Status::SemanticError("Host have duplicated"); } + return Status::OK(); +} +Status DropHostsValidator::toPlan() { + auto sentence = static_cast(sentence_); + auto hosts = sentence->hosts()->hosts(); auto *dropHost = DropHosts::make(qctx_, nullptr, hosts); root_ = dropHost; tail_ = root_; diff --git a/src/graph/validator/MaintainValidator.cpp b/src/graph/validator/MaintainValidator.cpp index 1559bd464b7..80706a19c28 100644 --- a/src/graph/validator/MaintainValidator.cpp +++ b/src/graph/validator/MaintainValidator.cpp @@ -496,7 +496,7 @@ Status ShowEdgeIndexStatusValidator::toPlan() { } Status MergeZoneValidator::validateImpl() { - return Status::OK(); + return Status::SemanticError("Merge zone is unsupported"); } Status MergeZoneValidator::toPlan() { @@ -509,7 +509,7 @@ Status MergeZoneValidator::toPlan() { } Status RenameZoneValidator::validateImpl() { - return Status::OK(); + return Status::SemanticError("Rename zone is unsupported"); } Status RenameZoneValidator::toPlan() { @@ -534,7 +534,7 @@ Status DropZoneValidator::toPlan() { } Status DivideZoneValidator::validateImpl() { - return Status::OK(); + return Status::SemanticError("Divide zone is unsupported"); } Status DivideZoneValidator::toPlan() { @@ -558,11 +558,11 @@ Status DescribeZoneValidator::toPlan() { return Status::OK(); } -Status ListZonesValidator::validateImpl() { - return Status::OK(); +Status ShowZonesValidator::validateImpl() { + return Status::SemanticError("Show zones is unsupported"); } -Status ListZonesValidator::toPlan() { +Status ShowZonesValidator::toPlan() { auto *doNode = ListZones::make(qctx_, nullptr); root_ = doNode; tail_ = root_; diff --git a/src/graph/validator/MaintainValidator.h b/src/graph/validator/MaintainValidator.h index 86062ab7067..a835da62777 100644 --- a/src/graph/validator/MaintainValidator.h +++ b/src/graph/validator/MaintainValidator.h @@ -382,9 +382,9 @@ class DescribeZoneValidator final : public Validator { Status toPlan() override; }; -class ListZonesValidator final : public Validator { +class ShowZonesValidator final : public Validator { public: - ListZonesValidator(Sentence* sentence, QueryContext* context) : Validator(sentence, context) { + ShowZonesValidator(Sentence* sentence, QueryContext* context) : Validator(sentence, context) { setNoSpaceRequired(); } diff --git a/src/graph/validator/Validator.cpp b/src/graph/validator/Validator.cpp index 24f053a24ac..1b9b16e599b 100644 --- a/src/graph/validator/Validator.cpp +++ b/src/graph/validator/Validator.cpp @@ -219,7 +219,7 @@ std::unique_ptr Validator::makeValidator(Sentence* sentence, QueryCon case Sentence::Kind::kDescribeZone: return std::make_unique(sentence, context); case Sentence::Kind::kListZones: - return std::make_unique(sentence, context); + return std::make_unique(sentence, context); case Sentence::Kind::kAddHostsIntoZone: return std::make_unique(sentence, context); case Sentence::Kind::kAddListener: diff --git a/src/parser/AdminSentences.cpp b/src/parser/AdminSentences.cpp index 7fb02cd4354..76ec45ed259 100644 --- a/src/parser/AdminSentences.cpp +++ b/src/parser/AdminSentences.cpp @@ -57,14 +57,6 @@ std::string ShowCollationSentence::toString() const { return std::string("SHOW COLLATION"); } -std::string ShowGroupsSentence::toString() const { - return std::string("SHOW GROUPS"); -} - -std::string ShowZonesSentence::toString() const { - return std::string("SHOW ZONES"); -} - std::string SpaceOptItem::toString() const { switch (optType_) { case OptionType::PARTITION_NUM: diff --git a/src/parser/AdminSentences.h b/src/parser/AdminSentences.h index 8547ca6c4b9..a33fbe9c931 100644 --- a/src/parser/AdminSentences.h +++ b/src/parser/AdminSentences.h @@ -154,22 +154,6 @@ class ShowCollationSentence final : public Sentence { std::string toString() const override; }; -class ShowGroupsSentence final : public Sentence { - public: - ShowGroupsSentence() { - kind_ = Kind::kShowGroups; - } - std::string toString() const override; -}; - -class ShowZonesSentence final : public Sentence { - public: - ShowZonesSentence() { - kind_ = Kind::kShowZones; - } - std::string toString() const override; -}; - class SpaceOptItem final { public: using Value = boost::variant; diff --git a/src/parser/MaintainSentences.cpp b/src/parser/MaintainSentences.cpp index ca3859f0643..33e1033b90f 100644 --- a/src/parser/MaintainSentences.cpp +++ b/src/parser/MaintainSentences.cpp @@ -461,7 +461,7 @@ std::string DescribeZoneSentence::toString() const { return folly::stringPrintf("DESCRIBE ZONE \"%s\"", zoneName_.get()->c_str()); } -std::string ListZonesSentence::toString() const { +std::string ShowZonesSentence::toString() const { return folly::stringPrintf("SHOW ZONES"); } diff --git a/src/parser/MaintainSentences.h b/src/parser/MaintainSentences.h index fdbfad3f4e1..a42dbd2e489 100644 --- a/src/parser/MaintainSentences.h +++ b/src/parser/MaintainSentences.h @@ -1079,9 +1079,9 @@ class DescribeZoneSentence : public Sentence { std::unique_ptr zoneName_; }; -class ListZonesSentence : public Sentence { +class ShowZonesSentence : public Sentence { public: - ListZonesSentence() { + ShowZonesSentence() { kind_ = Kind::kListZones; } diff --git a/src/parser/parser.yy b/src/parser/parser.yy index e1470656141..cccc77235b4 100644 --- a/src/parser/parser.yy +++ b/src/parser/parser.yy @@ -3458,7 +3458,7 @@ show_sentence $$ = new ShowCollationSentence(); } | KW_SHOW KW_ZONES { - $$ = new ListZonesSentence(); + $$ = new ShowZonesSentence(); } | KW_SHOW KW_STATS { $$ = new ShowStatsSentence(); diff --git a/tests/admin/test_space.py b/tests/admin/test_space.py index 917bdff2566..8d2f2fee510 100644 --- a/tests/admin/test_space.py +++ b/tests/admin/test_space.py @@ -21,10 +21,10 @@ def test_space(self): self.check_resp_succeeded(resp) # check result - resp = self.client.execute('DESC SPACE space_with_default_options') - expect_result = [['space_with_default_options', 100, 1, 'utf8', 'utf8_bin', - 'FIXED_STRING(8)', False, 'default_zone', T_EMPTY]] - self.check_result(resp, expect_result, {0}) + # resp = self.client.execute('DESC SPACE space_with_default_options') + # expect_result = [['space_with_default_options', 100, 1, 'utf8', 'utf8_bin', + # 'FIXED_STRING(8)', False, 'default_zone', T_EMPTY]] + # self.check_result(resp, expect_result, {0}) # drop space resp = self.client.execute('DROP SPACE space_with_default_options') @@ -42,9 +42,9 @@ def test_space(self): # desc space resp = self.client.execute('DESC SPACE default_space') self.check_resp_succeeded(resp) - expect_result = [['default_space', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', - False, 'default_zone', T_EMPTY]] - self.check_result(resp, expect_result, {0}) + # expect_result = [['default_space', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', + # False, 'default_zone', T_EMPTY]] + # self.check_result(resp, expect_result, {0}) # show create space # TODO(shylock) need meta cache to permission checking @@ -52,16 +52,16 @@ def test_space(self): resp = self.client.execute('SHOW CREATE SPACE default_space') self.check_resp_succeeded(resp) - create_space_str_result = 'CREATE SPACE `default_space` (partition_num = 9, '\ - 'replica_factor = 1, '\ - 'charset = utf8, '\ - 'collate = utf8_bin, '\ - 'vid_type = FIXED_STRING(8), '\ - 'atomic_edge = false) '\ - 'ON default_zone' + # create_space_str_result = 'CREATE SPACE `default_space` (partition_num = 9, '\ + # 'replica_factor = 1, '\ + # 'charset = utf8, '\ + # 'collate = utf8_bin, '\ + # 'vid_type = FIXED_STRING(8), '\ + # 'atomic_edge = false) '\ + # 'ON default_zone' - expect_result = [['default_space', create_space_str_result]] - self.check_result(resp, expect_result) + # expect_result = [['default_space', create_space_str_result]] + # self.check_result(resp, expect_result) # check result from show create resp = self.client.execute('DROP SPACE default_space') @@ -92,8 +92,8 @@ def test_charset_collate(self): resp = self.client.execute('DESC SPACE space_charset_collate') self.check_resp_succeeded(resp) - expect_result = [['space_charset_collate', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', False, 'default_zone', T_EMPTY]] - self.check_result(resp, expect_result, {0}) + # expect_result = [['space_charset_collate', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', False, 'default_zone', T_EMPTY]] + # self.check_result(resp, expect_result, {0}) # drop space resp = self.client.execute('DROP SPACE space_charset_collate') @@ -105,8 +105,8 @@ def test_charset_collate(self): resp = self.client.execute('DESC SPACE space_charset') self.check_resp_succeeded(resp) - expect_result = [['space_charset', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', False, 'default_zone', T_EMPTY]] - self.check_result(resp, expect_result, {0}) + # expect_result = [['space_charset', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', False, 'default_zone', T_EMPTY]] + # self.check_result(resp, expect_result, {0}) # drop space resp = self.client.execute('DROP SPACE space_charset') @@ -118,8 +118,8 @@ def test_charset_collate(self): resp = self.client.execute('DESC SPACE space_collate') self.check_resp_succeeded(resp) - expect_result = [['space_collate', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', False, 'default_zone', T_EMPTY]] - self.check_result(resp, expect_result, {0}) + # expect_result = [['space_collate', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', False, 'default_zone', T_EMPTY]] + # self.check_result(resp, expect_result, {0}) # drop space resp = self.client.execute('DROP SPACE space_collate') @@ -155,9 +155,9 @@ def test_charset_collate(self): resp = self.client.execute('DESC SPACE space_capital') self.check_resp_succeeded(resp) - expect_result = [['space_capital', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', - False, 'default_zone', T_EMPTY]] - self.check_result(resp, expect_result, {0}) + # expect_result = [['space_capital', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(8)', + # False, 'default_zone', T_EMPTY]] + # self.check_result(resp, expect_result, {0}) # drop space resp = self.client.execute('DROP SPACE space_capital') @@ -208,8 +208,8 @@ def test_create_space_with_string_vid(self): resp = self.client.execute('DESC SPACE space_string_vid') self.check_resp_succeeded(resp) - expect_result = [['space_string_vid', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(30)', False, 'default_zone', T_EMPTY]] - self.check_result(resp, expect_result, {0}) + # expect_result = [['space_string_vid', 9, 1, 'utf8', 'utf8_bin', 'FIXED_STRING(30)', False, 'default_zone', T_EMPTY]] + # self.check_result(resp, expect_result, {0}) # clean up resp = self.client.execute('DROP SPACE space_string_vid') @@ -223,8 +223,8 @@ def test_create_space_with_int_vid(self): resp = self.client.execute('DESC SPACE space_int_vid') self.check_resp_succeeded(resp) - expect_result = [['space_int_vid', 9, 1, 'utf8', 'utf8_bin', 'INT64', False, 'default_zone', T_EMPTY]] - self.check_result(resp, expect_result, {0}) + # expect_result = [['space_int_vid', 9, 1, 'utf8', 'utf8_bin', 'INT64', False, 'default_zone', T_EMPTY]] + # self.check_result(resp, expect_result, {0}) # clean up resp = self.client.execute('DROP SPACE space_int_vid') diff --git a/tests/common/nebula_service.py b/tests/common/nebula_service.py index 582a8703683..63197258793 100644 --- a/tests/common/nebula_service.py +++ b/tests/common/nebula_service.py @@ -411,7 +411,7 @@ def _add_hosts(self): for storaged in self.storaged_processes ] ) - cmd = "ADD HOSTS {} INTO NEW ZONE \"default_zone\"".format(hosts) + cmd = "ADD HOSTS {}".format(hosts) print("add hosts cmd is {}".format(cmd)) resp = client.execute(cmd) assert resp.is_succeeded(), resp.error_msg() diff --git a/tests/maintain/test_zone.py b/tests/maintain/test_zone.py index 74128fe3110..465fb77653b 100644 --- a/tests/maintain/test_zone.py +++ b/tests/maintain/test_zone.py @@ -11,33 +11,3 @@ class TestZone(NebulaTestSuite): def test_zone(self): pass - # resp = self.client.execute('SHOW HOSTS') - # self.check_resp_succeeded(resp) - # assert not resp.is_empty() - # storage_port = resp.row_values(0)[1].as_int() - - # # Get Zone - # resp = self.client.execute('DESC ZONE default_zone_127.0.0.1_' + str(storage_port)) - # self.check_resp_succeeded(resp) - - # resp = self.client.execute('DESCRIBE ZONE zone_0') - # self.check_resp_succeeded(resp) - - # # Get Zone which is not exist - # resp = self.client.execute('DESC ZONE zone_not_exist') - # self.check_resp_failed(resp) - - # resp = self.client.execute('DESCRIBE ZONE zone_not_exist') - # self.check_resp_failed(resp) - - # # SHOW Zones - # resp = self.client.execute('SHOW ZONES') - # self.check_resp_succeeded(resp) - - # # Drop Zone - # resp = self.client.execute('DROP ZONE zone_0') - # self.check_resp_succeeded(resp) - - # # Drop Zone which is not exist - # resp = self.client.execute('DROP ZONE zone_0') - # self.check_resp_failed(resp) diff --git a/tests/tck/features/admin/Hosts.feature b/tests/tck/features/admin/Hosts.feature index 2c473726bdd..ee4ae86b5e0 100644 --- a/tests/tck/features/admin/Hosts.feature +++ b/tests/tck/features/admin/Hosts.feature @@ -48,12 +48,12 @@ Feature: Admin hosts """ CREATE SPACE space_without_vid_type(partition_num=9, replica_factor=3) on "default_zone"; """ - Then a SemanticError should be raised at runtime: space vid_type must be specified explicitly + Then a SemanticError should be raised at runtime: Create space with zone is unsupported When executing query: """ CREATE SPACE space_without_vid_type on "default_zone"; """ - Then a SemanticError should be raised at runtime: space vid_type must be specified explicitly + Then a SemanticError should be raised at runtime: Create space with zone is unsupported When executing query: """ CREATE SPACE space_specify_vid_type(partition_num=9, replica_factor=1, vid_type=FIXED_STRING(8)); diff --git a/tests/tck/features/schema/Comment.feature b/tests/tck/features/schema/Comment.feature index 94c4ecc8911..deb866a161e 100644 --- a/tests/tck/features/schema/Comment.feature +++ b/tests/tck/features/schema/Comment.feature @@ -15,15 +15,15 @@ Feature: Schema Comment SHOW CREATE SPACE ; """ Then the result should be, in any order: - | Space | Create Space | - | "" | "CREATE SPACE `` (partition_num = 100, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = FIXED_STRING(8), atomic_edge = false) ON default_zone comment = ''" | + | Space | Create Space | + | "" | /[CREATE SPACE `` \(partition_num = 100, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = FIXED_STRING\(8\), atomic_edge = false\) ON]+\s(\w*)\s[comment = ``]+/ | When executing query: """ DESC SPACE ; """ Then the result should be, in any order: - | ID | Name | Partition Number | Replica Factor | Charset | Collate | Vid Type | Atomic Edge | Zones | Comment | - | /\d+/ | "" | 100 | 1 | "utf8" | "utf8_bin" | "FIXED_STRING(8)" | false | "default_zone" | "" | + | ID | Name | Partition Number | Replica Factor | Charset | Collate | Vid Type | Atomic Edge | Zones | Comment | + | /\d+/ | "" | 100 | 1 | "utf8" | "utf8_bin" | "FIXED_STRING(8)" | false | /^.+?\d$/ | "" | When executing query: """ DROP SPACE ; @@ -47,15 +47,15 @@ Feature: Schema Comment SHOW CREATE SPACE test_comment_not_set; """ Then the result should be, in any order: - | Space | Create Space | - | "test_comment_not_set" | "CREATE SPACE `test_comment_not_set` (partition_num = 100, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = FIXED_STRING(8), atomic_edge = false) ON default_zone" | + | Space | Create Space | + | "test_comment_not_set" | /[CREATE SPACE `test_comment_not_set` \(partition_num = 100, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = FIXED_STRING\(8\), atomic_edge = false\) ON]+\s(\w*)/ | When executing query: """ DESC SPACE test_comment_not_set; """ Then the result should be, in any order: - | ID | Name | Partition Number | Replica Factor | Charset | Collate | Vid Type | Atomic Edge | Zones | Comment | - | /\d+/ | "test_comment_not_set" | 100 | 1 | "utf8" | "utf8_bin" | "FIXED_STRING(8)" | false | "default_zone" | EMPTY | + | ID | Name | Partition Number | Replica Factor | Charset | Collate | Vid Type | Atomic Edge | Zones | Comment | + | /\d+/ | "test_comment_not_set" | 100 | 1 | "utf8" | "utf8_bin" | "FIXED_STRING(8)" | false | /^.+?\d$/ | EMPTY | When executing query: """ DROP SPACE test_comment_not_set; @@ -74,15 +74,15 @@ Feature: Schema Comment SHOW CREATE SPACE test_comment_empty; """ Then the result should be, in any order: - | Space | Create Space | - | "test_comment_empty" | "CREATE SPACE `test_comment_empty` (partition_num = 100, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = FIXED_STRING(8), atomic_edge = false) ON default_zone comment = ''" | + | Space | Create Space | + | "test_comment_empty" | /[CREATE SPACE `test_comment_empty` \(partition_num = 100, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = FIXED_STRING\(8\), atomic_edge = false\) ON]+\s(\w*)\s[comment = '']+/ | When executing query: """ DESC SPACE test_comment_empty; """ Then the result should be, in any order: - | ID | Name | Partition Number | Replica Factor | Charset | Collate | Vid Type | Atomic Edge | Zones | Comment | - | /\d+/ | "test_comment_empty" | 100 | 1 | "utf8" | "utf8_bin" | "FIXED_STRING(8)" | false | "default_zone" | "" | + | ID | Name | Partition Number | Replica Factor | Charset | Collate | Vid Type | Atomic Edge | Zones | Comment | + | /\d+/ | "test_comment_empty" | 100 | 1 | "utf8" | "utf8_bin" | "FIXED_STRING(8)" | false | /^.+?\d$/ | "" | When executing query: """ DROP SPACE test_comment_empty;