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

import data to a TTL table with lightning will panic #42012

Closed
Tracked by #39262
lcwangchao opened this issue Mar 8, 2023 · 1 comment · Fixed by #42014
Closed
Tracked by #39262

import data to a TTL table with lightning will panic #42012

lcwangchao opened this issue Mar 8, 2023 · 1 comment · Fixed by #42014
Labels
affects-6.6 component/lightning This issue is related to Lightning of TiDB. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@lcwangchao
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

import data to a TTL table with lightning

2. What did you expect to see? (Required)

No error

3. What did you see instead (Required)

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x110 pc=0x10409fc68]

goroutine 349 [running]:
github.com/pingcap/tidb/table/tables.(*TableCommon).AddRecord(0x14000afaa20, {0x106253ca8, 0x140014e0100}, {0x14000e3c0e0, 0x2, 0x3}, {0x0, 0x0, 0x14000fb3118?})
        /Users/wangchao/Code/pingcap/tidb/table/tables/tables.go:934 +0x1798
github.com/pingcap/tidb/br/pkg/lightning/backend/kv.(*tableKVEncoder).Encode(0x1400100dd40, {0x14000b7f600?}, {0x1400016c480?, 0x2, 0x10}, 0x1, {0x14001138900, 0x3, 0x14000fb34b8?}, {0x102b945dc?, ...}, ...)
        /Users/wangchao/Code/pingcap/tidb/br/pkg/lightning/backend/kv/sql2kv.go:425 +0x89c
github.com/pingcap/tidb/br/pkg/lightning/importer.(*chunkProcessor).encodeLoop(0x14000673700, {0x1061ed1c8, 0x1400029c870}, 0xc?, 0x14001025300, {0x102b35654?}, {0x1061d4330, 0x1400100dd40}, 0x58?, 0x14000e3e820)
        /Users/wangchao/Code/pingcap/tidb/br/pkg/lightning/importer/chunk_process.go:314 +0xa58
github.com/pingcap/tidb/br/pkg/lightning/importer.(*chunkProcessor).process(0x14000673700, {0x1061ed1c8, 0x1400029c870}, 0x14001025300, 0x0, 0x14000673720, 0x14000673740, 0x14000e3e820)
        /Users/wangchao/Code/pingcap/tidb/br/pkg/lightning/importer/chunk_process.go:179 +0x4cc
github.com/pingcap/tidb/br/pkg/lightning/importer.(*TableImporter).preprocessEngine.func4(0x0?, 0x14000673700)
        /Users/wangchao/Code/pingcap/tidb/br/pkg/lightning/importer/table_import.go:704 +0x14c
created by github.com/pingcap/tidb/br/pkg/lightning/importer.(*TableImporter).preprocessEngine
        /Users/wangchao/Code/pingcap/tidb/br/pkg/lightning/importer/table_import.go:694 +0xb64

4. What is your TiDB version? (Required)

master and 6.6.0

@lcwangchao lcwangchao added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/major component/lightning This issue is related to Lightning of TiDB. labels Mar 8, 2023
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Mar 8, 2023
@lcwangchao lcwangchao added affects-6.6 and removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-6.1 may-affects-6.5 labels Mar 8, 2023
@lcwangchao
Copy link
Collaborator Author

The bug is introduced by #41155 . When importing data, lightning is using a different sessionctx.Context without TxnCtx in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.6 component/lightning This issue is related to Lightning of TiDB. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants