Skip to content

plan cache may cache the wrong plan if meta data lock is disabled and there're dirty writes #64351

@winoros

Description

@winoros

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Disable the metadata lock

set @@global.tidb_enable_metadata_lock=off;
create table t(a int);

prepare stmt from 'select * from t where a = ?';
begin;
set @a=1;
execute stmt using @a;
insert into t values (1);
execute stmt using @a;
select @@last_plan_from_cache;
select * from t where a = 1;

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

The second EXECUTE should not use the cached plan, and it should return a result.

3. What did you see instead (Required)

Used the cached plan, and no result was returned.

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions