-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
unistore crash on data import #59651
Comments
Note, we don't have a reproducible way of triggering this yet |
Managed to reproduce this:
[performance]
txn-entry-size-limit = 125829120
create table t1(id int primary key auto_increment, b longtext);
INSERT INTO t1(b) VALUES(REPEAT('x',10000000)); |
This doesn't need a container:
|
This is related to the last message before the crash: https://github.com/tikv/client-go/blob/ddec8237fd6314572a2670a72366b4071809877f/txnkv/transaction/2pc.go#L698 |
With some extra debug logging added: diff --git a/pkg/store/mockstore/unistore/lockstore/arena.go b/pkg/store/mockstore/unistore/lockstore/arena.go
index bf02e5020e..649316047e 100644
--- a/pkg/store/mockstore/unistore/lockstore/arena.go
+++ b/pkg/store/mockstore/unistore/lockstore/arena.go
@@ -76,6 +76,7 @@ func (a *arena) get(addr arenaAddr, size int) []byte {
if addr.blockIdx() >= len(a.blocks) {
log.S().Fatalf("arena.get out of range. len(blocks)=%v, addr.blockIdx()=%v, addr.blockOffset()=%v, size=%v", len(a.blocks), addr.blockIdx(), addr.blockOffset(), size)
}
+ log.S().Infof("arena.get: len(blocks)=%v, addr.blockIdx()=%v, addr.blockOffset()=%v, size=%v", len(a.blocks), addr.blockIdx(), addr.blockOffset(), size)
return a.blocks[addr.blockIdx()].get(addr.blockOffset(), size)
}
|
So looks like something tries to do a get on an addr that's null? |
There are no direct way of fixing this in Unistore in a small PR, so I would suggest to not allow bigger transactions than 8MB if the current engine is Unistore. The issue is that every row must fit into a single arena block. We could of course increase the block size, but what should a reasonable limit be in that case? Another test: func TestInsertLargeRow(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("create table t (id int primary key, b longtext)")
tk.MustExec("set tidb_txn_entry_size_limit = 1<<23")
// the unistore arena blocksize is 8MB (8388608 bytes), so Unistore cannot handle larger rows than that!
// since a row cannot span multiple arena blocks.
tk.MustExec("insert into t values (1, REPEAT('t',8388493))")
} |
@mjonss could we make it return an error instead of crash? |
Bug Report
1. Minimal reproduce step (Required)
Load sql file created with mysqldump with
mysql -e source some_file.sql
Config:
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
v8.5.1 with unistore
The text was updated successfully, but these errors were encountered: