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] Wrong number of responses error from query using multi-column index with yb_hash_code clause #17043

Closed
1 task done
timothy-e opened this issue Apr 26, 2023 · 2 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@timothy-e
Copy link
Contributor

timothy-e commented Apr 26, 2023

Jira Link: DB-6354

Description

CREATE TABLE t as select x, x as y from generate_series(1, 10) x;
CREATE INDEX t_x_hash_y_asc_idx ON t (x HASH, y ASC);
EXPLAIN ANALYZE SELECT yb_hash_code(x), y FROM t WHERE yb_hash_code(x) = 2675 AND y IN (5, 6);
-- or --
EXPLAIN ANALYZE SELECT yb_hash_code(x), y FROM t WHERE yb_hash_code(x) < 4000 AND y IN (5, 6);

terminates with error

ERROR:  Wrong number of responses: 0, while 1 expected: 0 vs 1
FATAL:  terminating connection due to administrator command

The query does not fail if:

  • the y condition is just y = 5
  • the x condition is just x = 5 instead of yb_hash_code

This issue could also be used to reproduce a case for to help with #16445, because the session is terminated but the ysqlsh does not disconnect:

yugabyte=# EXPLAIN ANALYZE SELECT yb_hash_code(x), y FROM t WHERE yb_hash_code(x) = 2675 AND y IN (5, 6);
ERROR:  Wrong number of responses: 0, while 1 expected: 0 vs 1
FATAL:  terminating connection due to administrator command
yugabyte=#
yugabyte=# \d
SSL connection has been closed unexpectedly
The connection to the server was lost. Attempting reset: Failed.
!>
!>
!> \d
You are currently not connected to a database.
!> \d
You are currently not connected to a database.
!>

Possibly related to #16761 or #17042 because of similar error messages.

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
@timothy-e timothy-e added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Apr 26, 2023
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue and removed status/awaiting-triage Issue awaiting triage labels Apr 26, 2023
@fizaaluthra
Copy link
Member

JFYI the Wrong number of responses error was a regression that was masking RPC layer errors -- fixed by commit eb6fae3

The unmasked error is:

yugabyte=# EXPLAIN ANALYZE SELECT yb_hash_code(x), y FROM t WHERE yb_hash_code(x) = 2675 AND y IN (5, 6);
ERROR:  recvmsg error: Connection reset by peer

Also, I believe this is a regression because I had to git pull to latest master to repro it locally.

@fizaaluthra
Copy link
Member

fizaaluthra commented Jul 31, 2023

Regression after commit fc57665 cc @tanujnay112

@yugabyte-ci yugabyte-ci reopened this Aug 3, 2023
tanujnay112 added a commit that referenced this issue Aug 3, 2023
…g hash key options in scanspec

Summary:
Original commit: dea1831 / D27424
It appeared that the check in doc_pgsql_scanspec.cc to see if there are hash IN options to bind was incomplete. It checks to see if there are options to bind in a hash partitioned table without checking to see if any of these options were relevant to the hash keys. In the case where a bound on the hash code is specified, range options would be pushed down and break the preexisting logic. This change fixes that check.

This fix does not apply to YCQL as that code does not appear to be checking for hash IN options in the same way.

Fixes regression introduced by: fc57665 in 2.17.3
Backport required: Y
Backport-through: 2.18
Closes: #17043
Jira: DB-6354

Test Plan: ./yb_build.sh --java-test org.yb.pgsql.TestPgRegressProc

Reviewers: kpopali

Reviewed By: kpopali

Subscribers: yql, ybase

Differential Revision: https://phorge.dev.yugabyte.com/D27467
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

5 participants