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
24ee346a
Commit
24ee346a
authored
Jan 24, 2022
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-27590 Auto-increment on Spider tables with DESC PK does not work properly
use index_first for DESC keys
parent
d751f42a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
17 deletions
+108
-17
storage/spider/ha_spider.cc
storage/spider/ha_spider.cc
+6
-1
storage/spider/mysql-test/spider/bugfix/r/index.result
storage/spider/mysql-test/spider/bugfix/r/index.result
+66
-0
storage/spider/mysql-test/spider/bugfix/t/index.test
storage/spider/mysql-test/spider/bugfix/t/index.test
+20
-0
storage/spider/mysql-test/spider/include/init_spider.inc
storage/spider/mysql-test/spider/include/init_spider.inc
+16
-16
No files found.
storage/spider/ha_spider.cc
View file @
24ee346a
...
@@ -9288,6 +9288,9 @@ void ha_spider::get_auto_increment(
...
@@ -9288,6 +9288,9 @@ void ha_spider::get_auto_increment(
THD
*
thd
=
ha_thd
();
THD
*
thd
=
ha_thd
();
int
auto_increment_mode
=
spider_param_auto_increment_mode
(
thd
,
int
auto_increment_mode
=
spider_param_auto_increment_mode
(
thd
,
share
->
auto_increment_mode
);
share
->
auto_increment_mode
);
bool
rev
=
table
->
key_info
[
table
->
s
->
next_number_index
].
key_part
[
table
->
s
->
next_number_keypart
].
key_part_flag
&
HA_REVERSE_SORT
;
DBUG_ENTER
(
"ha_spider::get_auto_increment"
);
DBUG_ENTER
(
"ha_spider::get_auto_increment"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
*
nb_reserved_values
=
ULONGLONG_MAX
;
*
nb_reserved_values
=
ULONGLONG_MAX
;
...
@@ -9307,7 +9310,9 @@ void ha_spider::get_auto_increment(
...
@@ -9307,7 +9310,9 @@ void ha_spider::get_auto_increment(
table_share
->
next_number_key_offset
);
table_share
->
next_number_key_offset
);
error_num
=
index_read_last_map
(
table
->
record
[
1
],
key
,
error_num
=
index_read_last_map
(
table
->
record
[
1
],
key
,
make_prev_keypart_map
(
table_share
->
next_number_keypart
));
make_prev_keypart_map
(
table_share
->
next_number_keypart
));
}
else
}
else
if
(
rev
)
error_num
=
index_first
(
table
->
record
[
1
]);
else
error_num
=
index_last
(
table
->
record
[
1
]);
error_num
=
index_last
(
table
->
record
[
1
]);
if
(
error_num
)
if
(
error_num
)
...
...
storage/spider/mysql-test/spider/bugfix/r/index.result
0 → 100644
View file @
24ee346a
for master_1
connect master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK;
connection master_1;
CALL mtr.add_suppression("unknown variable");
SET SESSION sql_log_bin= 0;
INSTALL PLUGIN spider SONAME 'ha_spider';
CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
HOST 'localhost',
DATABASE 'auto_test_local',
USER 'root',
PASSWORD '',
SOCKET '$MASTER_1_MYSOCK'
);
SET spider_internal_sql_log_off= 0;
SET spider_direct_order_limit= 10000;
SET spider_init_sql_alloc_size= 1;
for child2
for child3
create database auto_test_local;
set spider_same_server_link= on;
#
# MDEV-27590 Auto-increment on Spider tables with DESC PK does not work properly
#
select @@spider_auto_increment_mode;
@@spider_auto_increment_mode
-1
create or replace table auto_test_local.t (id int primary key) engine=InnoDB;
create or replace table t_sp1 (id int auto_increment, primary key(id desc))
engine=Spider COMMENT='wrapper "mysql", srv "s_1", table "t"';
insert into t_sp1 () values (),(),();
insert into t_sp1 () values (),(),();
select * from t_sp1;
id
1
2
3
4
5
6
drop table t_sp1, auto_test_local.t;
drop database auto_test_local;
for master_1
connection master_1;
DROP FUNCTION spider_flush_table_mon_cache;
DROP FUNCTION spider_copy_tables;
DROP FUNCTION spider_ping_table;
DROP FUNCTION spider_bg_direct_sql;
DROP FUNCTION spider_direct_sql;
UNINSTALL PLUGIN spider_wrapper_protocols;
UNINSTALL PLUGIN spider_alloc_mem;
UNINSTALL PLUGIN spider;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
DROP TABLE IF EXISTS mysql.spider_xa;
DROP TABLE IF EXISTS mysql.spider_xa_member;
DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
DROP TABLE IF EXISTS mysql.spider_tables;
DROP TABLE IF EXISTS mysql.spider_link_mon_servers;
DROP TABLE IF EXISTS mysql.spider_link_failed_log;
DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
DROP TABLE IF EXISTS mysql.spider_table_sts;
DROP TABLE IF EXISTS mysql.spider_table_crd;
DROP SERVER s_1;
disconnect master_1;
for child2
for child3
storage/spider/mysql-test/spider/bugfix/t/index.test
0 → 100644
View file @
24ee346a
--
source
../
t
/
test_init
.
inc
create
database
auto_test_local
;
set
spider_same_server_link
=
on
;
--
echo
#
--
echo
# MDEV-27590 Auto-increment on Spider tables with DESC PK does not work properly
--
echo
#
select
@@
spider_auto_increment_mode
;
create
or
replace
table
auto_test_local
.
t
(
id
int
primary
key
)
engine
=
InnoDB
;
create
or
replace
table
t_sp1
(
id
int
auto_increment
,
primary
key
(
id
desc
))
engine
=
Spider
COMMENT
=
'wrapper "mysql", srv "s_1", table "t"'
;
insert
into
t_sp1
()
values
(),(),();
insert
into
t_sp1
()
values
(),(),();
select
*
from
t_sp1
;
drop
table
t_sp1
,
auto_test_local
.
t
;
drop
database
auto_test_local
;
--
source
../
t
/
test_deinit
.
inc
storage/spider/mysql-test/spider/include/init_spider.inc
View file @
24ee346a
...
@@ -2,10 +2,10 @@ let $VERSION_COMPILE_OS_WIN=
...
@@ -2,10 +2,10 @@ let $VERSION_COMPILE_OS_WIN=
`SELECT IF(@@version_compile_os like 'Win%', 1, 0)`
;
`SELECT IF(@@version_compile_os like 'Win%', 1, 0)`
;
if
(
$VERSION_COMPILE_OS_WIN
)
if
(
$VERSION_COMPILE_OS_WIN
)
{
{
INSTALL
PLUGIN
spider
SONAME
'ha_spider
.dll
'
;
INSTALL
PLUGIN
spider
SONAME
'ha_spider'
;
if
(
$MASTER_1_MYPORT
)
if
(
$MASTER_1_MYPORT
)
{
{
eval
CREATE
SERVER
s_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_local'
,
DATABASE
'auto_test_local'
,
USER
'root'
,
USER
'root'
,
...
@@ -15,7 +15,7 @@ if ($VERSION_COMPILE_OS_WIN)
...
@@ -15,7 +15,7 @@ if ($VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD2_1_MYPORT
)
if
(
$CHILD2_1_MYPORT
)
{
{
eval
CREATE
SERVER
s_2_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_2_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_remote'
,
DATABASE
'auto_test_remote'
,
USER
'root'
,
USER
'root'
,
...
@@ -25,7 +25,7 @@ if ($VERSION_COMPILE_OS_WIN)
...
@@ -25,7 +25,7 @@ if ($VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD2_2_MYPORT
)
if
(
$CHILD2_2_MYPORT
)
{
{
eval
CREATE
SERVER
s_2_2
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_2_2
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_remote2'
,
DATABASE
'auto_test_remote2'
,
USER
'root'
,
USER
'root'
,
...
@@ -35,7 +35,7 @@ if ($VERSION_COMPILE_OS_WIN)
...
@@ -35,7 +35,7 @@ if ($VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD2_3_MYPORT
)
if
(
$CHILD2_3_MYPORT
)
{
{
eval
CREATE
SERVER
s_2_3
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_2_3
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_remote3'
,
DATABASE
'auto_test_remote3'
,
USER
'root'
,
USER
'root'
,
...
@@ -45,7 +45,7 @@ if ($VERSION_COMPILE_OS_WIN)
...
@@ -45,7 +45,7 @@ if ($VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD3_1_MYPORT
)
if
(
$CHILD3_1_MYPORT
)
{
{
eval
CREATE
SERVER
s_3_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_3_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_local'
,
DATABASE
'auto_test_local'
,
USER
'root'
,
USER
'root'
,
...
@@ -55,7 +55,7 @@ if ($VERSION_COMPILE_OS_WIN)
...
@@ -55,7 +55,7 @@ if ($VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD3_2_MYPORT
)
if
(
$CHILD3_2_MYPORT
)
{
{
eval
CREATE
SERVER
s_3_2
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_3_2
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_local'
,
DATABASE
'auto_test_local'
,
USER
'root'
,
USER
'root'
,
...
@@ -65,7 +65,7 @@ if ($VERSION_COMPILE_OS_WIN)
...
@@ -65,7 +65,7 @@ if ($VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD2_3_MYPORT
)
if
(
$CHILD2_3_MYPORT
)
{
{
eval
CREATE
SERVER
s_3_3
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_3_3
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_local'
,
DATABASE
'auto_test_local'
,
USER
'root'
,
USER
'root'
,
...
@@ -76,10 +76,10 @@ if ($VERSION_COMPILE_OS_WIN)
...
@@ -76,10 +76,10 @@ if ($VERSION_COMPILE_OS_WIN)
}
}
if
(
!
$VERSION_COMPILE_OS_WIN
)
if
(
!
$VERSION_COMPILE_OS_WIN
)
{
{
INSTALL
PLUGIN
spider
SONAME
'ha_spider
.so
'
;
INSTALL
PLUGIN
spider
SONAME
'ha_spider'
;
if
(
$MASTER_1_MYSOCK
)
if
(
$MASTER_1_MYSOCK
)
{
{
eval
CREATE
SERVER
s_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_local'
,
DATABASE
'auto_test_local'
,
USER
'root'
,
USER
'root'
,
...
@@ -89,7 +89,7 @@ if (!$VERSION_COMPILE_OS_WIN)
...
@@ -89,7 +89,7 @@ if (!$VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD2_1_MYSOCK
)
if
(
$CHILD2_1_MYSOCK
)
{
{
eval
CREATE
SERVER
s_2_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_2_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_remote'
,
DATABASE
'auto_test_remote'
,
USER
'root'
,
USER
'root'
,
...
@@ -99,7 +99,7 @@ if (!$VERSION_COMPILE_OS_WIN)
...
@@ -99,7 +99,7 @@ if (!$VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD2_2_MYSOCK
)
if
(
$CHILD2_2_MYSOCK
)
{
{
eval
CREATE
SERVER
s_2_2
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_2_2
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_remote2'
,
DATABASE
'auto_test_remote2'
,
USER
'root'
,
USER
'root'
,
...
@@ -109,7 +109,7 @@ if (!$VERSION_COMPILE_OS_WIN)
...
@@ -109,7 +109,7 @@ if (!$VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD2_3_MYSOCK
)
if
(
$CHILD2_3_MYSOCK
)
{
{
eval
CREATE
SERVER
s_2_3
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_2_3
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_remote3'
,
DATABASE
'auto_test_remote3'
,
USER
'root'
,
USER
'root'
,
...
@@ -119,7 +119,7 @@ if (!$VERSION_COMPILE_OS_WIN)
...
@@ -119,7 +119,7 @@ if (!$VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD3_1_MYSOCK
)
if
(
$CHILD3_1_MYSOCK
)
{
{
eval
CREATE
SERVER
s_3_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_3_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_local'
,
DATABASE
'auto_test_local'
,
USER
'root'
,
USER
'root'
,
...
@@ -129,7 +129,7 @@ if (!$VERSION_COMPILE_OS_WIN)
...
@@ -129,7 +129,7 @@ if (!$VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD3_2_MYSOCK
)
if
(
$CHILD3_2_MYSOCK
)
{
{
eval
CREATE
SERVER
s_3_2
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_3_2
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_local'
,
DATABASE
'auto_test_local'
,
USER
'root'
,
USER
'root'
,
...
@@ -139,7 +139,7 @@ if (!$VERSION_COMPILE_OS_WIN)
...
@@ -139,7 +139,7 @@ if (!$VERSION_COMPILE_OS_WIN)
}
}
if
(
$CHILD3_3_MYSOCK
)
if
(
$CHILD3_3_MYSOCK
)
{
{
eval
CREATE
SERVER
s_3_3
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
eval
p
CREATE
SERVER
s_3_3
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
HOST
'localhost'
,
DATABASE
'auto_test_local'
,
DATABASE
'auto_test_local'
,
USER
'root'
,
USER
'root'
,
...
...
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