Skip to content

Commit f9bc8f9

Browse files
committed
fixed a bug that the table metadata lock is not released when open_index is failed
1 parent 159ea6d commit f9bc8f9

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
open_index 1st r=1
2+
open_index 2nd r=0

regtest/test_01_lib/test20.pl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/perl
2+
3+
# vim:sw=2:ai
4+
5+
# test for a bug that table mdl is not released when open_index is failed
6+
7+
BEGIN {
8+
push @INC, "../common/";
9+
};
10+
11+
use strict;
12+
use warnings;
13+
use hstest;
14+
15+
my $dbh = hstest::init_testdb();
16+
my $dbname = $hstest::conf{dbname};
17+
my $table = 'hstesttbl';
18+
19+
$dbh->do("drop table if exists $table");
20+
21+
my $hs = hstest::get_hs_connection();
22+
my $r = $hs->open_index(1, $dbname, $table, '', 'k,v'); # fails
23+
print "open_index 1st r=$r\n";
24+
undef $hs;
25+
26+
$dbh->do(
27+
"create table $table (k varchar(30) primary key, v varchar(30) not null) " .
28+
"engine = innodb");
29+
30+
$hs = hstest::get_hs_connection();
31+
$r = $hs->open_index(1, $dbname, $table, '', 'k,v'); # success
32+
print "open_index 2nd r=$r\n";
33+

0 commit comments

Comments
 (0)