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

[YCQL] improve error messages related to index DDL #921

Closed
kmuthukk opened this issue Mar 2, 2019 · 2 comments
Closed

[YCQL] improve error messages related to index DDL #921

kmuthukk opened this issue Mar 2, 2019 · 2 comments
Assignees
Labels
kind/enhancement This is an enhancement of an existing feature
Projects

Comments

@kmuthukk
Copy link
Collaborator

kmuthukk commented Mar 2, 2019

Two observations:

  • When creating an index, if another object (say an index or table) with the same name exists, we throw an error as expected, but the error message is confusing. It talks about "Duplicate Table" even when the object that already exists might be an index.

InvalidRequest: Error from server: code=2200 [Invalid query] message="Query error: Duplicate Table. Already present: Target index already exists: 77e586b20dce4ee091b1000704b960a6

The message should be something like:

A table with the name <xyz> already exists
or
An index with the name <xyz> already exists

  • Similarly, when dropping an non-existent index, the current error message could be improved. It should not say "Table Not Found".
cqlsh:k> drop index nonexisting_index_name;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Query error: Table Not Found. Not found: The index does not exist: table_name: "nonexisting_index_name"
namespace {
  name: "k"
}
@kmuthukk kmuthukk added the kind/enhancement This is an enhancement of an existing feature label Mar 2, 2019
@kmuthukk kmuthukk added this to To Do in YCQL via automation Mar 2, 2019
@OlegLoginov
Copy link
Contributor

The error message string includes a few parts - a few different errors in fact. Any part can be updated but the message will include a few parts anyway.

Fixed version for duplicate index (checked a duplicate table and a duplicate index):

> create table t9 (id int primary key, name varchar);
InvalidRequest: Error from server: code=2200 [Invalid query] message="Query error: Duplicate Table. Already present: Target table already exists: 7370a0fcb46b4dd1975b636c61846188
create table t9 (id int primary key, name varchar);
             ^^
 (error -202)"
cqlsh:q> create index i9 on t9(name);
InvalidRequest: Error from server: code=2200 [Invalid query] message="Query error: Duplicate Index. Already present: Target index already exists: f4524f6a02cf40709eb69fd5c401ed90
create index i9 on t9(name);
                   ^^
 (error -224)"

@OlegLoginov
Copy link
Contributor

OlegLoginov commented Mar 4, 2019

Fixed DROP error messages:

cqlsh:q> drop table tttt;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Query error: Table Not Found. Not found: The table does not exist: table_name: "tttt"
namespace {
  name: "q"
}

drop table tttt;
           ^^^^
 (error -301)"

cqlsh:q> drop index iiii;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Query error: Index Not Found. Not found: The index does not exist: table_name: "iiii"
namespace {
  name: "q"
}

drop index iiii;
           ^^^^
 (error -318)"

yugabyte-ci pushed a commit that referenced this issue Mar 19, 2019
Summary:
Updated a few error codes and a set of error messages to rename Table/Index into Object.
Added appropriate tests.

Related doc:   <doc-link>

Test Plan:
ybd  --cxx-test ql-create-index-test
ybd  --cxx-test ql-drop-stmt-test --gtest_filter TestQLDropStmt.TestQLDropIndex

Reviewers: robert, neha, neil

Reviewed By: neil

Subscribers: neha, bogdan, bharat, kannan, eng

Differential Revision: https://phabricator.dev.yugabyte.com/D6264
YCQL automation moved this from To Do to Done Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This is an enhancement of an existing feature
Projects
YCQL
  
Done
Development

No branches or pull requests

2 participants