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

vtgate: query planner panic on INSERT INTO ... SELECT #17367

Open
derekperkins opened this issue Dec 11, 2024 · 0 comments
Open

vtgate: query planner panic on INSERT INTO ... SELECT #17367

derekperkins opened this issue Dec 11, 2024 · 0 comments

Comments

@derekperkins
Copy link
Member

derekperkins commented Dec 11, 2024

Overview of the Issue

I'm trying to do a somewhat complicated JOIN and INSERT operation that causes a panic every single time. I don't have a simple repro.

After some more digging, the newly created table hadn't been added to the vschema yet. Once I added prep_to_copy_rankings to the vschema, it quit panicking.

server.go:373] mysql_server caught panic:
runtime error: index out of range [0] with length 0
runtime/panic.go:115 (0x439df3)
vitess.io/vitess/go/vt/vtgate/engine/insert_common.go:179 (0x13dd7d8)
vitess.io/vitess/go/vt/vtgate/engine/insert_select.go:232 (0x13e146e)

Reproduction Steps

  • Sharded on keyword_id
  • Still panics when fields are specified before the SELECT
  • Still panics when rewriting USING to ON
  • SELECT works by itself
  • CREATE TABLE AS SELECT ... also works
INSERT INTO prep_to_copy_rankings
SELECT
    search_id,
    requested,
    keyword_id,
    search_provider_id,
    serp_id,
    html_loc,
    proto_loc,
    extractor_version_id,
    score,
    requested_at,
    retrieved_at,
    extracted_at,
    completed_at,
    s.invalidated_at AS search_invalidated_at,
    prv_p.invalidated_at AS search_provider_invalidated_at,
    srp_p.invalidated_at AS serp_invalidated_at
FROM searches s
LEFT JOIN searches_providers prv USING (search_id, keyword_id)
LEFT JOIN searches_providers_pipeline prv_p USING (search_provider_id, keyword_id)
LEFT JOIN searches_providers_serps srp USING (search_provider_id, keyword_id)
LEFT JOIN searches_providers_serps_pipeline srp_p USING (serp_id, keyword_id)
WHERE search_id >= 10000 AND search_id < 100000;

Binary Version

v21.0.0 Docker Images

Operating System and Environment details

GKE v1.31

Log Fragments

server.go:373] mysql_server caught panic:
runtime error: index out of range [0] with length 0
runtime/panic.go:115 (0x439df3)
vitess.io/vitess/go/vt/vtgate/engine/insert_common.go:179 (0x13dd7d8)
vitess.io/vitess/go/vt/vtgate/engine/insert_select.go:232 (0x13e146e)
vitess.io/vitess/go/vt/vtgate/engine/insert_select.go:185 (0x13e10f0)
vitess.io/vitess/go/vt/vtgate/engine/insert_select.go:318 (0x13e257c)
vitess.io/vitess/go/vt/vtgate/engine/insert_select.go:98 (0x13e0550)
vitess.io/vitess/go/vt/vtgate/vcursor_impl.go:529 (0x1757d84)
vitess.io/vitess/go/vt/vtgate/plan_execute.go:332 (0x1738330)
vitess.io/vitess/go/vt/vtgate/executor.go:434 (0x172bd2b)
vitess.io/vitess/go/vt/vtgate/plan_execute.go:173 (0x1737c42)
vitess.io/vitess/go/vt/vtgate/plan_execute.go:306 (0x17380b5)
vitess.io/vitess/go/vt/vtgate/plan_execute.go:171 (0x17374f8)
vitess.io/vitess/go/vt/vtgate/executor.go:432 (0x172bb96)
vitess.io/vitess/go/vt/vtgate/executor.go:228 (0x172a144)
vitess.io/vitess/go/vt/vtgate/vtgate.go:473 (0x176c977)
vitess.io/vitess/go/vt/vtgate/plugin_mysql_server.go:261 (0x173a89a)
vitess.io/vitess/go/mysql/conn.go:1366 (0x1131b5d)
vitess.io/vitess/go/mysql/conn.go:1351 (0x113183b)
vitess.io/vitess/go/mysql/conn.go:918 (0x112dea4)
vitess.io/vitess/go/mysql/server.go:552 (0x114bd0f)
vitess.io/vitess/go/mysql/server.go:356 (0x114a9ab)
runtime/asm_amd64.s:1700 (0x47e100)
@derekperkins derekperkins added Type: Bug Component: Query Serving Needs Triage This issue needs to be correctly labelled and triaged labels Dec 11, 2024
@GuptaManan100 GuptaManan100 removed the Needs Triage This issue needs to be correctly labelled and triaged label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants