Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
359e8e4f
Commit
359e8e4f
authored
Jul 15, 2024
by
Sergey Vojtovich
Committed by
Sergei Golubchik
Sep 14, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VECTOR indexes support for RENAME TABLE
Rename high-level indexes along with a table.
parent
1b826fd1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
0 deletions
+87
-0
mysql-test/main/vector.result
mysql-test/main/vector.result
+32
-0
mysql-test/main/vector.test
mysql-test/main/vector.test
+16
-0
mysql-test/suite/archive/discover.result
mysql-test/suite/archive/discover.result
+2
-0
sql/sql_table.cc
sql/sql_table.cc
+37
-0
No files found.
mysql-test/main/vector.result
View file @
359e8e4f
...
...
@@ -318,3 +318,35 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1;
db.opt
# Test RENAME TABLE with vector index
create table t1 (id int auto_increment primary key, v blob not null, vector index (v)) engine=MyISAM;
db.opt
t1#i#01.MYD
t1#i#01.MYI
t1.MYD
t1.MYI
t1.frm
rename table t1 to t2;
db.opt
t2#i#01.MYD
t2#i#01.MYI
t2.MYD
t2.MYI
t2.frm
create database test1;
rename table test.t2 to test1.t1;
db.opt
t1#i#01.MYD
t1#i#01.MYI
t1.MYD
t1.MYI
t1.frm
rename table test1.t2 to test1.t1;
ERROR 42S02: Table 'test1.t2' doesn't exist
db.opt
t1#i#01.MYI
t1.MYD
t1.MYI
t1.frm
drop database test1;
db.opt
mysql-test/main/vector.test
View file @
359e8e4f
...
...
@@ -119,3 +119,19 @@ replace_result InnoDB MyISAM;
show
create
table
t1
;
drop
table
t1
;
list_files
$datadir
/
test
;
--
echo
# Test RENAME TABLE with vector index
create
table
t1
(
id
int
auto_increment
primary
key
,
v
blob
not
null
,
vector
index
(
v
))
engine
=
MyISAM
;
list_files
$datadir
/
test
;
rename
table
t1
to
t2
;
list_files
$datadir
/
test
;
create
database
test1
;
rename
table
test
.
t2
to
test1
.
t1
;
list_files
$datadir
/
test1
;
remove_file
$datadir
/
test1
/
t1
#i#01.MYD;
--
error
ER_NO_SUCH_TABLE
rename
table
test1
.
t2
to
test1
.
t1
;
list_files
$datadir
/
test1
;
drop
database
test1
;
list_files
$datadir
/
test
;
mysql-test/suite/archive/discover.result
View file @
359e8e4f
...
...
@@ -65,6 +65,7 @@ flush tables;
rename table t2 to t0;
db.opt
t0.ARZ
t0.frm
t1.ARZ
t1.frm
#
...
...
@@ -83,6 +84,7 @@ flush tables;
drop table t1;
db.opt
t0.ARZ
t0.frm
#
# discover of table non-existence on drop
#
...
...
sql/sql_table.cc
View file @
359e8e4f
...
...
@@ -5363,6 +5363,43 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
}
else
log_query
=
true
;
/* Rename high-level indexes */
if
(
file
&&
!
error
)
{
char
idx_from
[
FN_REFLEN
+
1
],
idx_to
[
FN_REFLEN
+
1
];
char
*
idx_from_end
=
strmov
(
idx_from
,
from_base
);
char
*
idx_to_end
=
strmov
(
idx_to
,
to_base
);
TABLE_SHARE
share
;
init_tmp_table_share
(
thd
,
&
share
,
new_db
->
str
,
0
,
new_name
->
str
,
to
,
1
);
if
(
!
open_table_def
(
thd
,
&
share
,
GTS_TABLE
|
GTS_USE_DISCOVERY
))
{
for
(
uint
i
=
share
.
keys
;
i
<
share
.
total_keys
;
i
++
)
{
my_snprintf
(
idx_from_end
,
HLINDEX_BUF_LEN
,
HLINDEX_TEMPLATE
,
i
);
my_snprintf
(
idx_to_end
,
HLINDEX_BUF_LEN
,
HLINDEX_TEMPLATE
,
i
);
if
((
error
=
file
->
ha_rename_table
(
idx_from
,
idx_to
)))
{
for
(;
i
>=
share
.
keys
;
i
--
)
{
my_snprintf
(
idx_from_end
,
HLINDEX_BUF_LEN
,
HLINDEX_TEMPLATE
,
i
);
my_snprintf
(
idx_to_end
,
HLINDEX_BUF_LEN
,
HLINDEX_TEMPLATE
,
i
);
file
->
ha_rename_table
(
idx_to
,
idx_from
);
}
file
->
ha_rename_table
(
to_base
,
from_base
);
rename_file_ext
(
to
,
from
,
reg_ext
);
}
}
}
else
{
file
->
ha_rename_table
(
to_base
,
from_base
);
rename_file_ext
(
to
,
from
,
reg_ext
);
error
=
1
;
}
free_table_share
(
&
share
);
}
}
if
(
!
error
&&
log_query
&&
!
(
flags
&
(
FN_TO_IS_TMP
|
FN_FROM_IS_TMP
)))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment