Skip to content

[Bug]: Aborted Epinions load leaves an empty lock and panics on DROP TABLE #27293

Closed

Description

@daviszhen

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

f2146c8

Other Environment Information

- Hardware parameters:
- OS type:linux mint
- Others:

Actual Behavior

The second schema-reset command fails in the lock service with this stack:

github.com/matrixorigin/matrixone/pkg/lockservice.Lock.tryHold
    pkg/lockservice/lock.go:153
github.com/matrixorigin/matrixone/pkg/lockservice.(*localLockTable).addRangeLockLocked
    pkg/lockservice/lock_table_local.go:947
github.com/matrixorigin/matrixone/pkg/sql/colexec/lockop.LockTable
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Scope).dropTableSingle

The first three cleanup drops complete. The fourth statement, DROP TABLE IF EXISTS useracct CASCADE, triggers the panic. The connection can still execute SELECT 1 afterward, but the DDL request is not completed.

The failing command returns the stack to the BenchBase client; MatrixOne itself remains reachable for a new connection.

Expected Behavior

An aborted transaction or failed loader must release all row/range lock state. A subsequent idempotent DROP TABLE IF EXISTS should either succeed or return a normal lock/transaction error. It must never call Lock.tryHold with an empty lock or panic the server.

Steps to Reproduce

1. Start MatrixOne from the commit above.
2. Run the Epinions load command and wait for the concurrent `loadTrust` batch to fail:


cd /home/pengzhen/Documents/benchbase/target/benchbase-mysql
java -jar benchbase.jar -b epinions -c config/mysql/sample_epinions_config.xml --create=true --load=true --execute=false


3. Without restarting MatrixOne, run the schema reset command:


java -jar benchbase.jar -b epinions -c config/mysql/sample_epinions_config.xml --create=true --load=false --execute=false


4. The equivalent minimal cleanup SQL is in `epinions_try_hold_empty_lock_min.sql`:


USE benchbase;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS review CASCADE;
DROP TABLE IF EXISTS review_rating CASCADE;
DROP TABLE IF EXISTS trust CASCADE;
DROP TABLE IF EXISTS useracct CASCADE;
DROP TABLE IF EXISTS item CASCADE;
SET FOREIGN_KEY_CHECKS = 1;


The panic is reported at line 6 of this SQL file. The first three drops are controls.

Additional information

USE benchbase;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS review CASCADE;
DROP TABLE IF EXISTS review_rating CASCADE;
DROP TABLE IF EXISTS trust CASCADE;
DROP TABLE IF EXISTS useracct CASCADE;
DROP TABLE IF EXISTS item CASCADE;
SET FOREIGN_KEY_CHECKS = 1;

Metadata

Metadata

Assignees

Labels

benchbasekind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions