cockroachdb / cockroach

CockroachDB - the open source, cloud-native distributed SQL database.
https://www.cockroachlabs.com
Other
29.51k stars 3.7k forks source link

roachtest: unoptimized-query-oracle: missing DOid.name population when decoding from disk #123816

Open cockroach-teamcity opened 2 months ago

cockroach-teamcity commented 2 months ago

roachtest.unoptimized-query-oracle/disable-rules=all/rand-tables failed with artifacts on release-24.1 @ 7c259a1b369b9de45995d76609e41028e5ee0ab4:

(query_comparison_util.go:389).runOneRoundQueryComparison: . 2717 statements run: expected unoptimized and optimized results to be equal
  []string{
-   "table_3",
+   "106",
  }
sql: SELECT
    (
        SELECT
            tab_2051."c\\xdf😠ol3\v_2" AS col_6395
        FROM
            defaultdb.public.table_3 AS tab_2051
            JOIN defaultdb.public.table_3 AS tab_2052 ON (tab_2051."c\\xdf😠ol3\v_2") = (tab_2052."c\\xdf😠ol3\v_2")
        ORDER BY
            col_6395 DESC NULLS FIRST
        LIMIT
            1:::INT8
    )
        AS col_6396
ORDER BY
    col_6396 DESC
LIMIT
    100:::INT8
test artifacts and logs in: /artifacts/unoptimized-query-oracle/disable-rules=all/rand-tables/run_1

Parameters:

See: roachtest README

See: How To Investigate (internal)

See: Grafana

This test on roachdash | Improve this report!

Jira issue: CRDB-38559

yuzefovich commented 1 month ago

Reduced repro:

CREATE TABLE t (col REGCLASS NULL);
INSERT INTO t VALUES (NULL);
UPDATE t SET col = t.tableoid WHERE true;
SELECT col FROM t;

Postgres returns t whereas we return the Oid integer (like 104). The bug is present in both execution engines, and I think we're supposed perform Oid resolution for each Oid value when decoding it from disk in order to populate DOid.name. This would have a significant performance overhead, so let's put it onto the backlog for now. AFAIU this has existed since forever.