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

[YSQL] Pre-split multi-tablet range tables SPLIT AT VALUES clause split rows ordering issue #11476

Open
yifanguan opened this issue Feb 14, 2022 · 2 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@yifanguan
Copy link
Contributor

yifanguan commented Feb 14, 2022

Jira Link: DB-1282

Description

CREATE TABLE tbl_floating_point_nan (
  a DOUBLE PRECISION,
  PRIMARY KEY(a ASC)
) SPLIT AT VALUES (('NaN'), (100), (200), ('NaN'));

The above CREATE TABLE statement hangs and generates the error in ysqlsh.

ERROR:  Timed out: Read(tablet: 00000000000000000000000000000000, num_ops: 1, num_attempts: 3, txn: 00000000-0000-0000-0000-000000000000, subtxn: [none]) passed its deadline 494430.885s (passed: 121.139s): Network error (yb/util/net/socket.cc:540): recvmsg error: Connection refused (system error 61)

The master error log is:

F0319 23:36:50.679088 109367296 catalog_entity_info.cc:419] Two tablets with the same partition key start and split depth: state: PREPARING table_id: "000033e1000030008000000000004000" partition { partition_key_start: "D\377\370\000\000\000\000\000\000!" partition_key_end: "" } table_ids: "000033e1000030008000000000004000" and 

On the other hand,

CREATE TABLE tbl_floating_point_nan (
  a DOUBLE PRECISION,
  PRIMARY KEY(a ASC)
) SPLIT AT VALUES (('NaN'), (100), (200));

and

CREATE TABLE tbl_floating_point_nan (
  a DOUBLE PRECISION,
  PRIMARY KEY(a ASC)
) SPLIT AT VALUES ((100), (200), ('NaN'));

work fine.

CREATE TABLE tbl_floating_point_nan (
  a DOUBLE PRECISION,
  PRIMARY KEY(a ASC)
) SPLIT AT VALUES ((100), (200), ('NaN'), ('NaN'));
ERROR:  Invalid argument: Cannot have duplicate split rows

works as expected.

@yifanguan yifanguan added the area/ysql Yugabyte SQL (YSQL) label Feb 14, 2022
@yifanguan
Copy link
Contributor Author

This example seems to be related to this issue.

CREATE TABLE tbl_floating_point_nan (
  a DOUBLE PRECISION,
  PRIMARY KEY(a ASC)
) SPLIT AT VALUES (('NaN'), (100), (200));

CREATE TABLE tbl_has_nan_value (
  a DOUBLE PRECISION
);
INSERT INTO tbl_has_nan_value VALUES ('NAN'), (100), (200);
SELECT * FROM tbl_has_nan_value ORDER BY a ASC;
  a
-----
 100
 200
 NaN
(3 rows)

Table tbl_floating_point_nan specifies ASC for column a. The SPLIT AT clause allows 'NaN' to be present before 100 and 200, but in reality, it is greater than 100 and 200.

@yifanguan yifanguan changed the title [YSQL] Create pre-split multi-tablet range tables hangs when 'NaN' specified as both lower and upper bounds [YSQL] Pre-split multi-tablet range tables SPLIT AT VALUES clause split rows ordering issue Mar 20, 2022
@yifanguan
Copy link
Contributor Author

There are split rows ordering issues with MINVALUE and MAXVALUE as well.
Example:

CREATE TABLE tbl(
  a int,
  primary key(a asc)
) SPLIT AT VALUES((MINVALUE), (100));
CREATE TABLE

CREATE TABLE tbl2(
  a int,
  primary key(a desc)
) SPLIT AT VALUES((MINVALUE), (100));
CREATE TABLE

CREATE TABLE tbl3(
  a int,
  primary key(a desc)
) SPLIT AT VALUES((MAXVALUE), (100));
ERROR:  Invalid argument: Split rows ordering does not match column ordering

The creation of tbl2 should fail, and the creation of tbl3 should succeed based on column ordering of column a.

@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants