Merge 10.3 into 10.4

We disable the MDEV-21189 test galera.galera_partition
because it times out.
This commit is contained in:
Marko Mäkelä 2019-12-13 17:30:37 +02:00
commit 8fa759a576
121 changed files with 4286 additions and 3753 deletions

View file

@ -515,9 +515,9 @@ static int DbugParse(CODE_STATE *cs, const char *control)
{
/* never share with the global parent - it can change under your feet */
stack->functions= ListCopy(init_settings.functions);
LockIfInitSettings(cs);
LockMutex(cs);
stack->keywords= ListCopy(init_settings.keywords);
UnlockIfInitSettings(cs);
UnlockMutex(cs);
stack->processes= ListCopy(init_settings.processes);
}
else
@ -1621,7 +1621,10 @@ static void FreeState(CODE_STATE *cs, int free_state)
struct settings *state= cs->stack;
LockIfInitSettings(cs);
if (!is_shared(state, keywords))
{
FreeList(state->keywords);
state->keywords= NULL;
}
UnlockIfInitSettings(cs);
if (!is_shared(state, functions))
FreeList(state->functions);

View file

@ -102,6 +102,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <srv0srv.h>
#include <crc_glue.h>
#include <log.h>
#include <derror.h>
int sys_var_init();
@ -2760,7 +2761,7 @@ static bool xtrabackup_copy_logfile(bool last = false)
log_mutex_exit();
if (!start_lsn) {
msg(recv_sys.found_corrupt_log
die(recv_sys.found_corrupt_log
? "xtrabackup_copy_logfile() failed: corrupt log."
: "xtrabackup_copy_logfile() failed.");
return true;
@ -4241,6 +4242,8 @@ fail_before_log_copying_thread_start:
if (xtrabackup_copy_logfile())
goto fail_before_log_copying_thread_start;
DBUG_MARIABACKUP_EVENT("before_innodb_log_copy_thread_started",0);
log_copying_stop = os_event_create(0);
os_thread_create(log_copying_thread, NULL, &log_copying_thread_id);
@ -5864,41 +5867,12 @@ extern void init_signals(void);
#include <sql_locale.h>
/* Messages . Avoid loading errmsg.sys file */
void setup_error_messages()
{
static const char *my_msgs[ERRORS_PER_RANGE];
static const char **all_msgs[] = { my_msgs, my_msgs, my_msgs, my_msgs };
my_default_lc_messages = &my_locale_en_US;
my_default_lc_messages->errmsgs->errmsgs = all_msgs;
/* Populate the necessary error messages */
struct {
int id;
const char *fmt;
}
xb_msgs[] =
{
{ ER_DATABASE_NAME,"Database" },
{ ER_TABLE_NAME,"Table"},
{ ER_PARTITION_NAME, "Partition" },
{ ER_SUBPARTITION_NAME, "Subpartition" },
{ ER_TEMPORARY_NAME, "Temporary"},
{ ER_RENAMED_NAME, "Renamed"},
{ ER_CANT_FIND_DL_ENTRY, "Can't find symbol '%-.128s' in library"},
{ ER_CANT_OPEN_LIBRARY, "Can't open shared library '%-.192s' (errno: %d, %-.128s)" },
{ ER_OUTOFMEMORY, "Out of memory; restart server and try again (needed %d bytes)" },
{ ER_CANT_OPEN_LIBRARY, "Can't open shared library '%-.192s' (errno: %d, %-.128s)" },
{ ER_UDF_NO_PATHS, "No paths allowed for shared library" },
{ ER_CANT_INITIALIZE_UDF,"Can't initialize function '%-.192s'; %-.80s"},
{ ER_PLUGIN_IS_NOT_LOADED,"Plugin '%-.192s' is not loaded" }
};
for (int i = 0; i < (int)array_elements(all_msgs); i++)
all_msgs[0][i] = "Unknown error";
for (int i = 0; i < (int)array_elements(xb_msgs); i++)
all_msgs[0][xb_msgs[i].id - ER_ERROR_FIRST] = xb_msgs[i].fmt;
if (init_errmessage())
die("could not initialize error messages");
}
void
@ -6170,6 +6144,8 @@ int main(int argc, char **argv)
(void) pthread_key_delete(THR_THD);
logger.cleanup_base();
cleanup_errmsgs();
free_error_messages();
mysql_mutex_destroy(&LOCK_error_log);
if (status == EXIT_SUCCESS) {

View file

@ -29,8 +29,8 @@
One can disable SSL later by using --skip-ssl or --ssl=0
*/
opt_use_ssl= 1;
#ifdef HAVE_WOLFSSL
/* CRL does not work with WolfSSL */
#if defined (HAVE_WOLFSSL) && (!defined (_WIN32) || defined (MYSQL_SERVER))
/* CRL does not work with WolfSSL */
opt_ssl_crl= NULL;
opt_ssl_crlpath= NULL;
#endif

@ -1 +1 @@
Subproject commit c8833751cf48d0085d9d7a4285aafdc967a63a4d
Subproject commit 63df45ce3df3fbc04d8fab9bceb77f9d1cccd4aa

View file

@ -1674,6 +1674,24 @@ t
1
use test;
#
# MDEV-18460: Server crashed in strmake / tdc_create_key /
# THD::create_tmp_table_def_key
#
connect con1,localhost,root,,;
CREATE TEMPORARY TABLE test.t (a INT);
WITH cte AS (SELECT 1) SELECT * FROM cte;
1
1
WITH t AS (SELECT 1) SELECT * FROM t;
1
1
WITH cte AS (SELECT 1) SELECT * FROM t;
ERROR 3D000: No database selected
DROP TABLE test.t;
connection default;
disconnect con1;
# End of 10.2 tests
#
# MDEV-20730: Syntax error on SELECT INTO @variable with CTE
#
with data as (select 1 as id)

View file

@ -1183,6 +1183,25 @@ with columns as (select 1 as t) select * from columns;
use test;
--echo #
--echo # MDEV-18460: Server crashed in strmake / tdc_create_key /
--echo # THD::create_tmp_table_def_key
--echo #
--connect con1,localhost,root,,
--change_user root,,
CREATE TEMPORARY TABLE test.t (a INT);
WITH cte AS (SELECT 1) SELECT * FROM cte;
WITH t AS (SELECT 1) SELECT * FROM t;
--error ER_NO_DB_ERROR
WITH cte AS (SELECT 1) SELECT * FROM t;
DROP TABLE test.t;
--connection default
--disconnect con1
--echo # End of 10.2 tests
--echo #
--echo # MDEV-20730: Syntax error on SELECT INTO @variable with CTE

View file

@ -1,4 +1,5 @@
create table t1(c1 integer not null,c2 integer not null, key (c1)) engine=InnoDb;
create table t1(c1 integer not null,c2 integer not null, key (c1))
ENGINE=InnoDB STATS_PERSISTENT=1;
create view v1 as select * from t1 where c1 in (0,1);
insert t1 select 0,seq from seq_1_to_500;
insert t1 select 1,seq from seq_1_to_100;
@ -48,7 +49,7 @@ rollback;
start transaction;
explain delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range c1 c1 4 NULL 502 Using where
1 PRIMARY t1 range c1 c1 4 NULL 600 Using where
2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 167 Using index
delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1;
affected rows: 1

View file

@ -2,7 +2,8 @@
--source include/have_innodb.inc
# This test is slow on buildbot.
--source include/big_test.inc
create table t1(c1 integer not null,c2 integer not null, key (c1)) engine=InnoDb;
create table t1(c1 integer not null,c2 integer not null, key (c1))
ENGINE=InnoDB STATS_PERSISTENT=1;
create view v1 as select * from t1 where c1 in (0,1);
insert t1 select 0,seq from seq_1_to_500;

View file

@ -82,3 +82,29 @@ add foreign key (a) references t3 (a)
on update set default on update set default);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'update set default)' at line 3
drop table t_34455;
#
# MDEV-18460 Don't allow multiple table CONSTRAINTs with the same name.
#
CREATE TABLE tpk (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,name VARCHAR(100) NOT NULL) ENGINE=Innodb;
CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1), CONSTRAINT sid CHECK (c2>15));
ERROR HY000: Duplicate CHECK constraint name 'sid'
CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1));
ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
ERROR HY000: Duplicate CHECK constraint name 'sid'
DROP TABLE tfk;
CREATE TABLE tfk (c1 INT, c2 INT,
CONSTRAINT sid FOREIGN KEY (c1) REFERENCES tpk (id)) ENGINE=Innodb;
show create table tfk;
Table Create Table
tfk CREATE TABLE `tfk` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL,
KEY `sid` (`c1`),
CONSTRAINT `sid` FOREIGN KEY (`c1`) REFERENCES `tpk` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
ERROR HY000: Duplicate CHECK constraint name 'sid'
ALTER TABLE tfk ADD CONSTRAINT sid UNIQUE(c2);
ERROR 42000: Duplicate key name 'sid'
DROP TABLE tfk;
DROP TABLE tpk;

View file

@ -117,4 +117,28 @@ alter table t_34455
drop table t_34455;
--echo #
--echo # MDEV-18460 Don't allow multiple table CONSTRAINTs with the same name.
--echo #
CREATE TABLE tpk (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,name VARCHAR(100) NOT NULL) ENGINE=Innodb;
--error ER_DUP_CONSTRAINT_NAME
CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1), CONSTRAINT sid CHECK (c2>15));
CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1));
--error ER_DUP_CONSTRAINT_NAME
ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
DROP TABLE tfk;
CREATE TABLE tfk (c1 INT, c2 INT,
CONSTRAINT sid FOREIGN KEY (c1) REFERENCES tpk (id)) ENGINE=Innodb;
show create table tfk;
--error ER_DUP_CONSTRAINT_NAME
ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
--error ER_DUP_KEYNAME
ALTER TABLE tfk ADD CONSTRAINT sid UNIQUE(c2);
DROP TABLE tfk;
DROP TABLE tpk;

View file

@ -629,11 +629,9 @@ SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL);
i
EXPLAIN EXTENDED SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join ((values (NULL),(NULL),(NULL),(NULL),(NULL)) `tvc_0`) where `test`.`t1`.`i` = `tvc_0`.`_col_1`
Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` in (NULL,NULL,NULL,NULL,NULL)
SET in_predicate_conversion_threshold= default;
DROP TABLE t1;
#
@ -687,3 +685,50 @@ f1 f2
1 1
DROP TABLE t1,t2,t3;
SET @@in_predicate_conversion_threshold= default;
#
# MDEV-20900: IN predicate to IN subquery conversion causes performance regression
#
create table t1(a int, b int);
insert into t1 select seq-1, seq-1 from seq_1_to_10;
set in_predicate_conversion_threshold=2;
explain select * from t1 where t1.a IN ("1","2","3","4");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where
select * from t1 where t1.a IN ("1","2","3","4");
a b
1 1
2 2
3 3
4 4
set in_predicate_conversion_threshold=0;
explain select * from t1 where t1.a IN ("1","2","3","4");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where
select * from t1 where t1.a IN ("1","2","3","4");
a b
1 1
2 2
3 3
4 4
set in_predicate_conversion_threshold=2;
explain select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where
select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
a b
1 1
2 2
3 3
4 4
set in_predicate_conversion_threshold=0;
explain select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where
select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
a b
1 1
2 2
3 3
4 4
drop table t1;
SET @@in_predicate_conversion_threshold= default;

View file

@ -3,6 +3,7 @@
#
source include/have_debug.inc;
source include/default_optimizer_switch.inc;
source include/have_sequence.inc;
create table t1 (a int, b int);
@ -397,3 +398,33 @@ SELECT * FROM t3 WHERE (f1,f2) IN ((2, 2), (1, 2), (3, 5), (1, 1));
DROP TABLE t1,t2,t3;
SET @@in_predicate_conversion_threshold= default;
--echo #
--echo # MDEV-20900: IN predicate to IN subquery conversion causes performance regression
--echo #
create table t1(a int, b int);
insert into t1 select seq-1, seq-1 from seq_1_to_10;
set in_predicate_conversion_threshold=2;
let $query= select * from t1 where t1.a IN ("1","2","3","4");
eval explain $query;
eval $query;
set in_predicate_conversion_threshold=0;
eval explain $query;
eval $query;
set in_predicate_conversion_threshold=2;
let $query= select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
eval explain $query;
eval $query;
set in_predicate_conversion_threshold=0;
eval explain $query;
eval $query;
drop table t1;
SET @@in_predicate_conversion_threshold= default;

View file

@ -21,15 +21,6 @@ create procedure have_ssl()
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
--echo mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
# this is the test where certificate verification fails.
# but client library may not support certificate verification, so
# we fake the test result for it. We assume client is openssl, when server is openssl
let client_supports_cert_verification =`select variable_value not in('Unknown','OFF') from information_schema.session_status where variable_name='Ssl_session_cache_mode'`;
if ($client_supports_cert_verification) {
--replace_result "self signed certificate in certificate chain" "Failed to verify the server certificate" "Error in the certificate." "Failed to verify the server certificate"
--exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
}
if (!$client_supports_cert_verification) {
--echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate
}
--replace_regex /SSL connection error.*certificate[^\n]*/SSL connection error: Failed to verify the server certificate/
--exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
drop procedure have_ssl;

View file

@ -1,6 +1,3 @@
# schannel does not support keys longer than 4k
-- source include/not_windows.inc
-- source include/have_ssl_communication.inc
#
# Bug#29784 YaSSL assertion failure when reading 8k key.

View file

@ -1,6 +1,12 @@
# This test should work in embedded server after we fix mysqltest
-- source include/not_embedded.inc
-- source include/have_openssl.inc
if (`SELECT COUNT(*) = 0 FROM information_schema.GLOBAL_VARIABLES
WHERE (VARIABLE_NAME ='version_compile_os' AND VARIABLE_VALUE LIKE 'Win%' OR
VARIABLE_NAME='have_openssl' AND VARIABLE_VALUE='YES')`)
{
skip Need openssl or Windows;
}
--echo # Test clients with and without CRL lists
@ -14,10 +20,12 @@ copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0;
--echo ############ Test mysql ##############
--echo # Test mysql connecting to a server with a certificate revoked by -crl
--replace_result "Server certificate validation failed. The certificate is revoked. Error 0x80092010(CRYPT_E_REVOKED)" "certificate revoked"
--error 1
--exec $MYSQL $ssl_crl test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1
--echo # Test mysql connecting to a server with a certificate revoked by -crlpath
--replace_result "Server certificate validation failed. The certificate is revoked. Error 0x80092010(CRYPT_E_REVOKED)" "certificate revoked"
--error 1
--exec $MYSQL $ssl_crlpath test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1
@ -26,11 +34,11 @@ copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0;
let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping;
--echo # Test mysqladmin connecting to a server with a certificate revoked by -crl
--replace_regex /.*mysqladmin.*:/mysqladmin:/
--replace_regex /.*mysqladmin.*:/mysqladmin:/ /SSL connection error: .*CRYPT_E_REVOKED./SSL connection error: certificate revoked/
--error 1
--exec $MYSQLADMIN $ssl_crl $admin_suffix 2>&1
--echo # Test mysqladmin connecting to a server with a certificate revoked by -crlpath
--replace_regex /.*mysqladmin.*:/mysqladmin:/
--replace_regex /.*mysqladmin.*:/mysqladmin:/ /SSL connection error: .*CRYPT_E_REVOKED./SSL connection error: certificate revoked/
--error 1
--exec $MYSQLADMIN $ssl_crlpath $admin_suffix 2>&1

View file

@ -3634,6 +3634,15 @@ rank() over (partition by 'abc' order by 'xyz')
1
drop table t1;
#
# MDEV-19380: ASAN heap-use-after-free in Protocol::net_store_data
#
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT (SELECT MIN('foo') OVER() FROM t1 LIMIT 1) as x;
x
foo
drop table t1;
#
# End of 10.2 tests
#
#

View file

@ -2341,6 +2341,16 @@ select rank() over (partition by 'abc' order by 'xyz') from t1;
select rank() over (partition by 'abc' order by 'xyz') from t1;
drop table t1;
--echo #
--echo # MDEV-19380: ASAN heap-use-after-free in Protocol::net_store_data
--echo #
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT (SELECT MIN('foo') OVER() FROM t1 LIMIT 1) as x;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #

View file

@ -0,0 +1,236 @@
SET sql_mode=ORACLE;
#
# MDEV-20667 Server crash on pop_cursor
#
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<< iac_err >>
RETURN;
END//
SHOW PROCEDURE CODE p1;
Pos Instruction
0 jump_if_not 5(5) 1 = 2
1 cpush cur1@0
2 jump 3
3 cpop 1
4 jump 7
5 jump_if_not 7(7) 1 = 1
6 jump 7
7 preturn
DROP PROCEDURE p1;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<< iac_err >>
RETURN ;
END//
SHOW PROCEDURE CODE p1;
Pos Instruction
0 jump_if_not 5(5) 1 = 2
1 cpush cur1@0
2 jump 3
3 cpop 1
4 jump 7
5 jump_if_not 7(7) 1 = 1
6 jump 7
7 preturn
DROP PROCEDURE p1;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
GOTO iac_err;
<< iac_err >>
RETURN ;
END//
SHOW PROCEDURE CODE p1;
Pos Instruction
0 jump_if_not 5(5) 1 = 2
1 cpush cur1@0
2 jump 3
3 cpop 1
4 jump 5
5 preturn
DROP PROCEDURE p1;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=1 THEN
DECLARE
CURSOR cur2 IS SELECT 'cur2' FROM DUAL;
BEGIN
SELECT 'cur2';
IF 1=1 THEN
DECLARE
CURSOR cur3 IS SELECT 'cur3' FROM DUAL;
BEGIN
SELECT 'cur3';
IF 1=1 THEN
DECLARE
CURSOR cur4 IS SELECT 'cur4' FROM DUAL;
BEGIN
SELECT 'cur4';
GOTO ret;
END;
END IF;
GOTO ret;
END;
END IF;
GOTO ret;
END;
END IF;
<<ret>>
RETURN;
END;
//
SHOW PROCEDURE CODE p1;
Pos Instruction
0 jump_if_not 15(15) 1 = 1
1 cpush cur2@0
2 stmt 0 "SELECT 'cur2'"
3 jump_if_not 13(13) 1 = 1
4 cpush cur3@1
5 stmt 0 "SELECT 'cur3'"
6 jump_if_not 11(11) 1 = 1
7 cpush cur4@2
8 stmt 0 "SELECT 'cur4'"
9 cpop 3
10 jump 15
11 cpop 2
12 jump 15
13 cpop 1
14 jump 15
15 preturn
DROP PROCEDURE p1;
CREATE PROCEDURE p1(lab VARCHAR(32)) IS
BEGIN
IF 1=1 THEN
DECLARE
CURSOR cur2 IS SELECT 'cur2' FROM DUAL;
BEGIN
IF 1=1 THEN
DECLARE
CURSOR cur3 IS SELECT 'cur3' FROM DUAL;
BEGIN
IF 1=1 THEN
DECLARE
CURSOR cur4 IS SELECT 'cur4' FROM DUAL;
BEGIN
IF lab = 'cur4' THEN
SELECT 'goto from cur4' AS comment;
GOTO ret;
END IF;
END;
END IF;
IF lab = 'cur3' THEN
SELECT 'goto from cur3' AS comment;
GOTO ret;
END IF;
END;
END IF;
IF lab = 'cur2' THEN
SELECT 'goto from cur2' AS comment;
GOTO ret;
END IF;
END;
END IF;
<<ret>>
RETURN;
END;
//
SHOW PROCEDURE CODE p1;
Pos Instruction
0 jump_if_not 21(21) 1 = 1
1 cpush cur2@0
2 jump_if_not 16(16) 1 = 1
3 cpush cur3@1
4 jump_if_not 11(11) 1 = 1
5 cpush cur4@2
6 jump_if_not 10(10) lab@0 = 'cur4'
7 stmt 0 "SELECT 'goto from cur4' AS comment"
8 cpop 3
9 jump 21
10 cpop 1
11 jump_if_not 15(15) lab@0 = 'cur3'
12 stmt 0 "SELECT 'goto from cur3' AS comment"
13 cpop 2
14 jump 21
15 cpop 1
16 jump_if_not 20(20) lab@0 = 'cur2'
17 stmt 0 "SELECT 'goto from cur2' AS comment"
18 cpop 1
19 jump 21
20 cpop 1
21 preturn
CALL p1('');
CALL p1('cur2');
comment
goto from cur2
CALL p1('cur3');
comment
goto from cur3
CALL p1('cur4');
comment
goto from cur4
DROP PROCEDURE p1;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<<iac_err >>
RETURN;
END//
SHOW PROCEDURE CODE p1;
Pos Instruction
0 jump_if_not 9(9) 1 = 2
1 hpush_jump 4 0 CONTINUE
2 stmt 31 "SET @x2 = 1"
3 hreturn 0
4 hpop 1
5 jump 11
6 jump 11
7 hpop 1
8 jump 9
9 jump_if_not 11(11) 1 = 1
10 jump 11
11 preturn
DROP PROCEDURE p1;

View file

@ -832,3 +832,82 @@ a
15
DROP TRIGGER trg1;
DROP TABLE t1;
#
# MDEV-20667 Server crash on pop_cursor
#
CREATE TABLE t1 (a VARCHAR(6));
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<< iac_err >>
RETURN;
END//
CALL p1();
DROP PROCEDURE p1;
DROP TABLE t1;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<< iac_err >>
RETURN ;
END//
CALL p1;
DROP PROCEDURE p1;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
GOTO iac_err;
<< iac_err >>
RETURN ;
END//
CALL p1;
DROP PROCEDURE p1;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<<iac_err >>
RETURN;
END//
CALL p1;
DROP PROCEDURE p1;

View file

@ -0,0 +1,178 @@
-- source include/have_debug.inc
SET sql_mode=ORACLE;
--echo #
--echo # MDEV-20667 Server crash on pop_cursor
--echo #
DELIMITER //;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<< iac_err >>
RETURN;
END//
DELIMITER ;//
SHOW PROCEDURE CODE p1;
DROP PROCEDURE p1;
DELIMITER //;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<< iac_err >>
RETURN ;
END//
DELIMITER ;//
SHOW PROCEDURE CODE p1;
DROP PROCEDURE p1;
DELIMITER //;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
GOTO iac_err;
<< iac_err >>
RETURN ;
END//
DELIMITER ;//
SHOW PROCEDURE CODE p1;
DROP PROCEDURE p1;
DELIMITER //;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=1 THEN
DECLARE
CURSOR cur2 IS SELECT 'cur2' FROM DUAL;
BEGIN
SELECT 'cur2';
IF 1=1 THEN
DECLARE
CURSOR cur3 IS SELECT 'cur3' FROM DUAL;
BEGIN
SELECT 'cur3';
IF 1=1 THEN
DECLARE
CURSOR cur4 IS SELECT 'cur4' FROM DUAL;
BEGIN
SELECT 'cur4';
GOTO ret;
END;
END IF;
GOTO ret;
END;
END IF;
GOTO ret;
END;
END IF;
<<ret>>
RETURN;
END;
//
DELIMITER ;//
SHOW PROCEDURE CODE p1;
DROP PROCEDURE p1;
DELIMITER //;
CREATE PROCEDURE p1(lab VARCHAR(32)) IS
BEGIN
IF 1=1 THEN
DECLARE
CURSOR cur2 IS SELECT 'cur2' FROM DUAL;
BEGIN
IF 1=1 THEN
DECLARE
CURSOR cur3 IS SELECT 'cur3' FROM DUAL;
BEGIN
IF 1=1 THEN
DECLARE
CURSOR cur4 IS SELECT 'cur4' FROM DUAL;
BEGIN
IF lab = 'cur4' THEN
SELECT 'goto from cur4' AS comment;
GOTO ret;
END IF;
END;
END IF;
IF lab = 'cur3' THEN
SELECT 'goto from cur3' AS comment;
GOTO ret;
END IF;
END;
END IF;
IF lab = 'cur2' THEN
SELECT 'goto from cur2' AS comment;
GOTO ret;
END IF;
END;
END IF;
<<ret>>
RETURN;
END;
//
DELIMITER ;//
SHOW PROCEDURE CODE p1;
CALL p1('');
CALL p1('cur2');
CALL p1('cur3');
CALL p1('cur4');
DROP PROCEDURE p1;
DELIMITER //;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<<iac_err >>
RETURN;
END//
DELIMITER ;//
SHOW PROCEDURE CODE p1;
DROP PROCEDURE p1;

View file

@ -869,4 +869,100 @@ insert into t1 values (1);
insert into t1 values (null);
SELECT * FROM t1;
DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE t1;
--echo #
--echo # MDEV-20667 Server crash on pop_cursor
--echo #
CREATE TABLE t1 (a VARCHAR(6));
DELIMITER //;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<< iac_err >>
RETURN;
END//
DELIMITER ;//
CALL p1();
DROP PROCEDURE p1;
DROP TABLE t1;
DELIMITER //;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<< iac_err >>
RETURN ;
END//
DELIMITER ;//
CALL p1;
DROP PROCEDURE p1;
DELIMITER //;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CURSOR cur1 IS SELECT a FROM t1 ;
BEGIN
GOTO iac_err;
END;
END;
END IF;
GOTO iac_err;
<< iac_err >>
RETURN ;
END//
DELIMITER ;//
CALL p1;
DROP PROCEDURE p1;
DELIMITER //;
CREATE PROCEDURE p1() IS
BEGIN
IF 1=2 THEN
BEGIN
DECLARE
CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
BEGIN
GOTO iac_err;
END;
END;
END IF;
IF 1=1 THEN
GOTO iac_err;
END IF;
<<iac_err >>
RETURN;
END//
DELIMITER ;//
CALL p1;
DROP PROCEDURE p1;

View file

@ -43,5 +43,6 @@ galera_var_reject_queries : assertion in inline_mysql_socket_send
galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit
galera_wan : MDEV-17259 Test failure on galera.galera_wan
mysql-wsrep#198 : MDEV-18935 Galera test mysql-wsrep#198 sporaric assertion transaction.cpp:362: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed.
galera_partition : MDEV-21189 test timeout
partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache

View file

@ -0,0 +1,424 @@
connection node_1;
call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*");
call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
CREATE TABLE t1(
id bigint unsigned NOT NULL AUTO_INCREMENT,
dt datetime NOT NULL,
PRIMARY KEY (id,dt),
KEY dt_idx (dt)
) ENGINE=InnoDB
PARTITION BY RANGE( TO_DAYS(dt) ) (
PARTITION rx2009xx VALUES LESS THAN( TO_DAYS('2010-01-01 00:00:00') ),
PARTITION rx201001 VALUES LESS THAN( TO_DAYS('2010-02-01 00:00:00') ),
PARTITION rx201002 VALUES LESS THAN( TO_DAYS('2010-03-01 00:00:00') ),
PARTITION rx201003 VALUES LESS THAN( TO_DAYS('2010-04-01 00:00:00') ),
PARTITION rx201004 VALUES LESS THAN( TO_DAYS('2010-05-01 00:00:00') ),
PARTITION rx201005 VALUES LESS THAN( TO_DAYS('2010-06-01 00:00:00') ),
PARTITION rx201006 VALUES LESS THAN( TO_DAYS('2010-07-01 00:00:00') ),
PARTITION rx201007 VALUES LESS THAN( TO_DAYS('2010-08-01 00:00:00') ),
PARTITION rx201008 VALUES LESS THAN( TO_DAYS('2010-09-01 00:00:00') ),
PARTITION rx201009 VALUES LESS THAN( TO_DAYS('2010-10-01 00:00:00') ),
PARTITION rx201010 VALUES LESS THAN( TO_DAYS('2010-11-01 00:00:00') ),
PARTITION rx201011 VALUES LESS THAN( TO_DAYS('2010-12-01 00:00:00') ),
PARTITION rx201012 VALUES LESS THAN( TO_DAYS('2011-01-01 00:00:00') ),
PARTITION rx2011 VALUES LESS THAN MAXVALUE);
CREATE PROCEDURE p1 (repeat_count int)
BEGIN
DECLARE current_num int;
SET current_num = 0;
WHILE current_num < repeat_count do
INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-02-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-03-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-04-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-06-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2012-02-21 00:00:00');
COMMIT;
SET current_num = current_num + 1;
END WHILE;
END|
insert into t1 (id, dt) values (1, '2010-01-02 00:00:00');
insert into t1 (id, dt) values (2, '2010-01-03 00:00:00');
insert into t1 (id, dt) values (3, '2010-01-04 00:00:00');
insert into t1 (id, dt) values (4, '2010-01-05 00:00:00');
insert into t1 (id, dt) values (5, '2010-01-06 00:00:00');
insert into t1 (id, dt) values (6, '2010-01-07 00:00:00');
insert into t1 (id, dt) values (7, '2010-01-08 00:00:00');
insert into t1 (id, dt) values (8, '2010-01-09 00:00:00');
insert into t1 (id, dt) values (9, '2010-01-10 00:00:00');
insert into t1 (id, dt) values (10, '2010-01-11 00:00:00');
insert into t1 (id, dt) values (11, '2010-01-12 00:00:00');
insert into t1 (id, dt) values (12, '2010-01-13 00:00:00');
insert into t1 (id, dt) values (13, '2010-01-14 00:00:00');
insert into t1 (id, dt) values (14, '2010-01-15 00:00:00');
insert into t1 (id, dt) values (15, '2010-01-16 00:00:00');
insert into t1 (id, dt) values (16, '2010-01-17 00:00:00');
insert into t1 (id, dt) values (17, '2010-01-18 00:00:00');
insert into t1 (id, dt) values (18, '2010-01-19 00:00:00');
insert into t1 (id, dt) values (19, '2010-01-20 00:00:00');
insert into t1 (id, dt) values (20, '2010-01-21 00:00:00');
insert into t1 (id, dt) values (21, '2010-01-22 00:00:00');
insert into t1 (id, dt) values (22, '2010-01-23 00:00:00');
insert into t1 (id, dt) values (23, '2010-01-24 00:00:00');
insert into t1 (id, dt) values (24, '2010-01-25 00:00:00');
insert into t1 (id, dt) values (25, '2010-01-26 00:00:00');
insert into t1 (id, dt) values (26, '2010-01-27 00:00:00');
insert into t1 (id, dt) values (27, '2010-01-28 00:00:00');
insert into t1 (id, dt) values (28, '2010-01-29 00:00:00');
insert into t1 (id, dt) values (29, '2010-01-30 00:00:00');
insert into t1 (id, dt) values (30, '2010-01-31 00:00:00');
insert into t1 (id, dt) values (31, '2010-02-01 00:00:00');
insert into t1 (id, dt) values (32, '2010-02-02 00:00:00');
insert into t1 (id, dt) values (33, '2010-02-03 00:00:00');
insert into t1 (id, dt) values (34, '2010-02-04 00:00:00');
insert into t1 (id, dt) values (35, '2010-02-05 00:00:00');
insert into t1 (id, dt) values (36, '2010-02-06 00:00:00');
insert into t1 (id, dt) values (37, '2010-02-07 00:00:00');
insert into t1 (id, dt) values (38, '2010-02-08 00:00:00');
insert into t1 (id, dt) values (39, '2010-02-09 00:00:00');
insert into t1 (id, dt) values (40, '2010-02-10 00:00:00');
insert into t1 (id, dt) values (41, '2010-02-11 00:00:00');
insert into t1 (id, dt) values (42, '2010-02-12 00:00:00');
insert into t1 (id, dt) values (43, '2010-02-13 00:00:00');
insert into t1 (id, dt) values (44, '2010-02-14 00:00:00');
insert into t1 (id, dt) values (45, '2010-02-15 00:00:00');
insert into t1 (id, dt) values (46, '2010-02-16 00:00:00');
insert into t1 (id, dt) values (47, '2010-02-17 00:00:00');
insert into t1 (id, dt) values (48, '2010-02-18 00:00:00');
insert into t1 (id, dt) values (49, '2010-02-19 00:00:00');
insert into t1 (id, dt) values (50, '2010-02-20 00:00:00');
insert into t1 (id, dt) values (51, '2010-02-21 00:00:00');
insert into t1 (id, dt) values (52, '2010-02-22 00:00:00');
insert into t1 (id, dt) values (53, '2010-02-23 00:00:00');
insert into t1 (id, dt) values (54, '2010-02-24 00:00:00');
insert into t1 (id, dt) values (55, '2010-02-25 00:00:00');
insert into t1 (id, dt) values (56, '2010-02-26 00:00:00');
insert into t1 (id, dt) values (57, '2010-02-27 00:00:00');
insert into t1 (id, dt) values (58, '2010-02-28 00:00:00');
insert into t1 (id, dt) values (59, '2010-03-01 00:00:00');
insert into t1 (id, dt) values (60, '2010-03-02 00:00:00');
insert into t1 (id, dt) values (61, '2010-03-03 00:00:00');
insert into t1 (id, dt) values (62, '2010-03-04 00:00:00');
insert into t1 (id, dt) values (63, '2010-03-05 00:00:00');
insert into t1 (id, dt) values (64, '2010-03-06 00:00:00');
insert into t1 (id, dt) values (65, '2010-03-07 00:00:00');
insert into t1 (id, dt) values (66, '2010-03-08 00:00:00');
insert into t1 (id, dt) values (67, '2010-03-09 00:00:00');
insert into t1 (id, dt) values (68, '2010-03-10 00:00:00');
insert into t1 (id, dt) values (69, '2010-03-11 00:00:00');
insert into t1 (id, dt) values (70, '2010-03-12 00:00:00');
insert into t1 (id, dt) values (71, '2010-03-13 00:00:00');
insert into t1 (id, dt) values (72, '2010-03-14 00:00:00');
insert into t1 (id, dt) values (73, '2010-03-15 00:00:00');
insert into t1 (id, dt) values (74, '2010-03-16 00:00:00');
insert into t1 (id, dt) values (75, '2010-03-17 00:00:00');
insert into t1 (id, dt) values (76, '2010-03-18 00:00:00');
insert into t1 (id, dt) values (77, '2010-03-19 00:00:00');
insert into t1 (id, dt) values (78, '2010-03-20 00:00:00');
insert into t1 (id, dt) values (79, '2010-03-21 00:00:00');
insert into t1 (id, dt) values (80, '2010-03-22 00:00:00');
insert into t1 (id, dt) values (81, '2010-03-23 00:00:00');
insert into t1 (id, dt) values (82, '2010-03-24 00:00:00');
insert into t1 (id, dt) values (83, '2010-03-25 00:00:00');
insert into t1 (id, dt) values (84, '2010-03-26 00:00:00');
insert into t1 (id, dt) values (85, '2010-03-27 00:00:00');
insert into t1 (id, dt) values (86, '2010-03-28 00:00:00');
insert into t1 (id, dt) values (87, '2010-03-29 00:00:00');
insert into t1 (id, dt) values (88, '2010-03-30 00:00:00');
insert into t1 (id, dt) values (89, '2010-03-31 00:00:00');
insert into t1 (id, dt) values (90, '2010-04-01 00:00:00');
insert into t1 (id, dt) values (91, '2010-04-02 00:00:00');
insert into t1 (id, dt) values (92, '2010-04-03 00:00:00');
insert into t1 (id, dt) values (93, '2010-04-04 00:00:00');
insert into t1 (id, dt) values (94, '2010-04-05 00:00:00');
insert into t1 (id, dt) values (95, '2010-04-06 00:00:00');
insert into t1 (id, dt) values (96, '2010-04-07 00:00:00');
insert into t1 (id, dt) values (97, '2010-04-08 00:00:00');
insert into t1 (id, dt) values (98, '2010-04-09 00:00:00');
insert into t1 (id, dt) values (99, '2010-04-10 00:00:00');
insert into t1 (id, dt) values (100, '2010-04-11 00:00:00');
insert into t1 (id, dt) values (101, '2010-04-12 00:00:00');
insert into t1 (id, dt) values (102, '2010-04-13 00:00:00');
insert into t1 (id, dt) values (103, '2010-04-14 00:00:00');
insert into t1 (id, dt) values (104, '2010-04-15 00:00:00');
insert into t1 (id, dt) values (105, '2010-04-16 00:00:00');
insert into t1 (id, dt) values (106, '2010-04-17 00:00:00');
insert into t1 (id, dt) values (107, '2010-04-18 00:00:00');
insert into t1 (id, dt) values (108, '2010-04-19 00:00:00');
insert into t1 (id, dt) values (109, '2010-04-20 00:00:00');
insert into t1 (id, dt) values (110, '2010-04-21 00:00:00');
insert into t1 (id, dt) values (111, '2010-04-22 00:00:00');
insert into t1 (id, dt) values (112, '2010-04-23 00:00:00');
insert into t1 (id, dt) values (113, '2010-04-24 00:00:00');
insert into t1 (id, dt) values (114, '2010-04-25 00:00:00');
insert into t1 (id, dt) values (115, '2010-04-26 00:00:00');
insert into t1 (id, dt) values (116, '2010-04-27 00:00:00');
insert into t1 (id, dt) values (117, '2010-04-28 00:00:00');
insert into t1 (id, dt) values (118, '2010-04-29 00:00:00');
insert into t1 (id, dt) values (119, '2010-04-30 00:00:00');
insert into t1 (id, dt) values (120, '2010-05-01 00:00:00');
insert into t1 (id, dt) values (121, '2010-05-02 00:00:00');
insert into t1 (id, dt) values (122, '2010-05-03 00:00:00');
insert into t1 (id, dt) values (123, '2010-05-04 00:00:00');
insert into t1 (id, dt) values (124, '2010-05-05 00:00:00');
insert into t1 (id, dt) values (125, '2010-05-06 00:00:00');
insert into t1 (id, dt) values (126, '2010-05-07 00:00:00');
insert into t1 (id, dt) values (127, '2010-05-08 00:00:00');
insert into t1 (id, dt) values (128, '2010-05-09 00:00:00');
insert into t1 (id, dt) values (129, '2010-05-10 00:00:00');
insert into t1 (id, dt) values (130, '2010-05-11 00:00:00');
insert into t1 (id, dt) values (131, '2010-05-12 00:00:00');
insert into t1 (id, dt) values (132, '2010-05-13 00:00:00');
insert into t1 (id, dt) values (133, '2010-05-14 00:00:00');
insert into t1 (id, dt) values (134, '2010-05-15 00:00:00');
insert into t1 (id, dt) values (135, '2010-05-16 00:00:00');
insert into t1 (id, dt) values (136, '2010-05-17 00:00:00');
insert into t1 (id, dt) values (137, '2010-05-18 00:00:00');
insert into t1 (id, dt) values (138, '2010-05-19 00:00:00');
insert into t1 (id, dt) values (139, '2010-05-20 00:00:00');
insert into t1 (id, dt) values (140, '2010-05-21 00:00:00');
insert into t1 (id, dt) values (141, '2010-05-22 00:00:00');
insert into t1 (id, dt) values (142, '2010-05-23 00:00:00');
insert into t1 (id, dt) values (143, '2010-05-24 00:00:00');
insert into t1 (id, dt) values (144, '2010-05-25 00:00:00');
insert into t1 (id, dt) values (145, '2010-05-26 00:00:00');
insert into t1 (id, dt) values (146, '2010-05-27 00:00:00');
insert into t1 (id, dt) values (147, '2010-05-28 00:00:00');
insert into t1 (id, dt) values (148, '2010-05-29 00:00:00');
insert into t1 (id, dt) values (149, '2010-05-30 00:00:00');
insert into t1 (id, dt) values (150, '2010-05-31 00:00:00');
insert into t1 (id, dt) values (151, '2010-06-01 00:00:00');
insert into t1 (id, dt) values (152, '2010-06-02 00:00:00');
insert into t1 (id, dt) values (153, '2010-06-03 00:00:00');
insert into t1 (id, dt) values (154, '2010-06-04 00:00:00');
insert into t1 (id, dt) values (155, '2010-06-05 00:00:00');
insert into t1 (id, dt) values (156, '2010-06-06 00:00:00');
insert into t1 (id, dt) values (157, '2010-06-07 00:00:00');
insert into t1 (id, dt) values (158, '2010-06-08 00:00:00');
insert into t1 (id, dt) values (159, '2010-06-09 00:00:00');
insert into t1 (id, dt) values (160, '2010-06-10 00:00:00');
insert into t1 (id, dt) values (161, '2010-06-11 00:00:00');
insert into t1 (id, dt) values (162, '2010-06-12 00:00:00');
insert into t1 (id, dt) values (163, '2010-06-13 00:00:00');
insert into t1 (id, dt) values (164, '2010-06-14 00:00:00');
insert into t1 (id, dt) values (165, '2010-06-15 00:00:00');
insert into t1 (id, dt) values (166, '2010-06-16 00:00:00');
insert into t1 (id, dt) values (167, '2010-06-17 00:00:00');
insert into t1 (id, dt) values (168, '2010-06-18 00:00:00');
insert into t1 (id, dt) values (169, '2010-06-19 00:00:00');
insert into t1 (id, dt) values (170, '2010-06-20 00:00:00');
insert into t1 (id, dt) values (171, '2010-06-21 00:00:00');
insert into t1 (id, dt) values (172, '2010-06-22 00:00:00');
insert into t1 (id, dt) values (173, '2010-06-23 00:00:00');
insert into t1 (id, dt) values (174, '2010-06-24 00:00:00');
insert into t1 (id, dt) values (175, '2010-06-25 00:00:00');
insert into t1 (id, dt) values (176, '2010-06-26 00:00:00');
insert into t1 (id, dt) values (177, '2010-06-27 00:00:00');
insert into t1 (id, dt) values (178, '2010-06-28 00:00:00');
insert into t1 (id, dt) values (179, '2010-06-29 00:00:00');
insert into t1 (id, dt) values (180, '2010-06-30 00:00:00');
insert into t1 (id, dt) values (181, '2010-07-01 00:00:00');
insert into t1 (id, dt) values (182, '2010-07-02 00:00:00');
insert into t1 (id, dt) values (183, '2010-07-03 00:00:00');
insert into t1 (id, dt) values (184, '2010-07-04 00:00:00');
insert into t1 (id, dt) values (185, '2010-07-05 00:00:00');
insert into t1 (id, dt) values (186, '2010-07-06 00:00:00');
insert into t1 (id, dt) values (187, '2010-07-07 00:00:00');
insert into t1 (id, dt) values (188, '2010-07-08 00:00:00');
insert into t1 (id, dt) values (189, '2010-07-09 00:00:00');
insert into t1 (id, dt) values (190, '2010-07-10 00:00:00');
insert into t1 (id, dt) values (191, '2010-07-11 00:00:00');
insert into t1 (id, dt) values (192, '2010-07-12 00:00:00');
insert into t1 (id, dt) values (193, '2010-07-13 00:00:00');
insert into t1 (id, dt) values (194, '2010-07-14 00:00:00');
insert into t1 (id, dt) values (195, '2010-07-15 00:00:00');
insert into t1 (id, dt) values (196, '2010-07-16 00:00:00');
insert into t1 (id, dt) values (197, '2010-07-17 00:00:00');
insert into t1 (id, dt) values (198, '2010-07-18 00:00:00');
insert into t1 (id, dt) values (199, '2010-07-19 00:00:00');
insert into t1 (id, dt) values (200, '2010-07-20 00:00:00');
insert into t1 (id, dt) values (201, '2010-07-21 00:00:00');
insert into t1 (id, dt) values (202, '2010-07-22 00:00:00');
insert into t1 (id, dt) values (203, '2010-07-23 00:00:00');
insert into t1 (id, dt) values (204, '2010-07-24 00:00:00');
insert into t1 (id, dt) values (205, '2010-07-25 00:00:00');
insert into t1 (id, dt) values (206, '2010-07-26 00:00:00');
insert into t1 (id, dt) values (207, '2010-07-27 00:00:00');
insert into t1 (id, dt) values (208, '2010-07-28 00:00:00');
insert into t1 (id, dt) values (209, '2010-07-29 00:00:00');
insert into t1 (id, dt) values (210, '2010-07-30 00:00:00');
insert into t1 (id, dt) values (211, '2010-07-31 00:00:00');
insert into t1 (id, dt) values (212, '2010-08-01 00:00:00');
insert into t1 (id, dt) values (213, '2010-08-02 00:00:00');
insert into t1 (id, dt) values (214, '2010-08-03 00:00:00');
insert into t1 (id, dt) values (215, '2010-08-04 00:00:00');
insert into t1 (id, dt) values (216, '2010-08-05 00:00:00');
insert into t1 (id, dt) values (217, '2010-08-06 00:00:00');
insert into t1 (id, dt) values (218, '2010-08-07 00:00:00');
insert into t1 (id, dt) values (219, '2010-08-08 00:00:00');
insert into t1 (id, dt) values (220, '2010-08-09 00:00:00');
insert into t1 (id, dt) values (221, '2010-08-10 00:00:00');
insert into t1 (id, dt) values (222, '2010-08-11 00:00:00');
insert into t1 (id, dt) values (223, '2010-08-12 00:00:00');
insert into t1 (id, dt) values (224, '2010-08-13 00:00:00');
insert into t1 (id, dt) values (225, '2010-08-14 00:00:00');
insert into t1 (id, dt) values (226, '2010-08-15 00:00:00');
insert into t1 (id, dt) values (227, '2010-08-16 00:00:00');
insert into t1 (id, dt) values (228, '2010-08-17 00:00:00');
insert into t1 (id, dt) values (229, '2010-08-18 00:00:00');
insert into t1 (id, dt) values (230, '2010-08-19 00:00:00');
insert into t1 (id, dt) values (231, '2010-08-20 00:00:00');
insert into t1 (id, dt) values (232, '2010-08-21 00:00:00');
insert into t1 (id, dt) values (233, '2010-08-22 00:00:00');
insert into t1 (id, dt) values (234, '2010-08-23 00:00:00');
insert into t1 (id, dt) values (235, '2010-08-24 00:00:00');
insert into t1 (id, dt) values (236, '2010-08-25 00:00:00');
insert into t1 (id, dt) values (237, '2010-08-26 00:00:00');
insert into t1 (id, dt) values (238, '2010-08-27 00:00:00');
insert into t1 (id, dt) values (239, '2010-08-28 00:00:00');
insert into t1 (id, dt) values (240, '2010-08-29 00:00:00');
insert into t1 (id, dt) values (241, '2010-08-30 00:00:00');
insert into t1 (id, dt) values (242, '2010-08-31 00:00:00');
insert into t1 (id, dt) values (243, '2010-09-01 00:00:00');
insert into t1 (id, dt) values (244, '2010-09-02 00:00:00');
insert into t1 (id, dt) values (245, '2010-09-03 00:00:00');
insert into t1 (id, dt) values (246, '2010-09-04 00:00:00');
insert into t1 (id, dt) values (247, '2010-09-05 00:00:00');
insert into t1 (id, dt) values (248, '2010-09-06 00:00:00');
insert into t1 (id, dt) values (249, '2010-09-07 00:00:00');
insert into t1 (id, dt) values (250, '2010-09-08 00:00:00');
insert into t1 (id, dt) values (251, '2010-09-09 00:00:00');
insert into t1 (id, dt) values (252, '2010-09-10 00:00:00');
insert into t1 (id, dt) values (253, '2010-09-11 00:00:00');
insert into t1 (id, dt) values (254, '2010-09-12 00:00:00');
insert into t1 (id, dt) values (255, '2010-09-13 00:00:00');
insert into t1 (id, dt) values (256, '2010-09-14 00:00:00');
insert into t1 (id, dt) values (257, '2010-09-15 00:00:00');
insert into t1 (id, dt) values (258, '2010-09-16 00:00:00');
insert into t1 (id, dt) values (259, '2010-09-17 00:00:00');
insert into t1 (id, dt) values (260, '2010-09-18 00:00:00');
insert into t1 (id, dt) values (261, '2010-09-19 00:00:00');
insert into t1 (id, dt) values (262, '2010-09-20 00:00:00');
insert into t1 (id, dt) values (263, '2010-09-21 00:00:00');
insert into t1 (id, dt) values (264, '2010-09-22 00:00:00');
insert into t1 (id, dt) values (265, '2010-09-23 00:00:00');
insert into t1 (id, dt) values (266, '2010-09-24 00:00:00');
insert into t1 (id, dt) values (267, '2010-09-25 00:00:00');
insert into t1 (id, dt) values (268, '2010-09-26 00:00:00');
insert into t1 (id, dt) values (269, '2010-09-27 00:00:00');
insert into t1 (id, dt) values (270, '2010-09-28 00:00:00');
insert into t1 (id, dt) values (271, '2010-09-29 00:00:00');
insert into t1 (id, dt) values (272, '2010-09-30 00:00:00');
insert into t1 (id, dt) values (273, '2010-10-01 00:00:00');
insert into t1 (id, dt) values (274, '2010-10-02 00:00:00');
insert into t1 (id, dt) values (275, '2010-10-03 00:00:00');
insert into t1 (id, dt) values (276, '2010-10-04 00:00:00');
insert into t1 (id, dt) values (277, '2010-10-05 00:00:00');
insert into t1 (id, dt) values (278, '2010-10-06 00:00:00');
insert into t1 (id, dt) values (279, '2010-10-07 00:00:00');
insert into t1 (id, dt) values (280, '2010-10-08 00:00:00');
insert into t1 (id, dt) values (281, '2010-10-09 00:00:00');
insert into t1 (id, dt) values (282, '2010-10-10 00:00:00');
insert into t1 (id, dt) values (283, '2010-10-11 00:00:00');
insert into t1 (id, dt) values (284, '2010-10-12 00:00:00');
insert into t1 (id, dt) values (285, '2010-10-13 00:00:00');
insert into t1 (id, dt) values (286, '2010-10-14 00:00:00');
insert into t1 (id, dt) values (287, '2010-10-15 00:00:00');
insert into t1 (id, dt) values (288, '2010-10-16 00:00:00');
insert into t1 (id, dt) values (289, '2010-10-17 00:00:00');
insert into t1 (id, dt) values (290, '2010-10-18 00:00:00');
insert into t1 (id, dt) values (291, '2010-10-19 00:00:00');
insert into t1 (id, dt) values (292, '2010-10-20 00:00:00');
insert into t1 (id, dt) values (293, '2010-10-21 00:00:00');
insert into t1 (id, dt) values (294, '2010-10-22 00:00:00');
insert into t1 (id, dt) values (295, '2010-10-23 00:00:00');
insert into t1 (id, dt) values (296, '2010-10-24 00:00:00');
insert into t1 (id, dt) values (297, '2010-10-25 00:00:00');
insert into t1 (id, dt) values (298, '2010-10-26 00:00:00');
insert into t1 (id, dt) values (299, '2010-10-27 00:00:00');
insert into t1 (id, dt) values (300, '2010-10-28 00:00:00');
insert into t1 (id, dt) values (301, '2010-10-29 00:00:00');
insert into t1 (id, dt) values (302, '2010-10-30 00:00:00');
insert into t1 (id, dt) values (303, '2010-10-31 00:00:00');
insert into t1 (id, dt) values (304, '2010-11-01 00:00:00');
insert into t1 (id, dt) values (305, '2010-11-02 00:00:00');
insert into t1 (id, dt) values (306, '2010-11-03 00:00:00');
insert into t1 (id, dt) values (307, '2010-11-04 00:00:00');
insert into t1 (id, dt) values (308, '2010-11-05 00:00:00');
insert into t1 (id, dt) values (309, '2010-11-06 00:00:00');
insert into t1 (id, dt) values (310, '2010-11-07 00:00:00');
insert into t1 (id, dt) values (311, '2010-11-08 00:00:00');
insert into t1 (id, dt) values (312, '2010-11-09 00:00:00');
insert into t1 (id, dt) values (313, '2010-11-10 00:00:00');
insert into t1 (id, dt) values (314, '2010-11-11 00:00:00');
insert into t1 (id, dt) values (315, '2010-11-12 00:00:00');
insert into t1 (id, dt) values (316, '2010-11-13 00:00:00');
insert into t1 (id, dt) values (317, '2010-11-14 00:00:00');
insert into t1 (id, dt) values (318, '2010-11-15 00:00:00');
insert into t1 (id, dt) values (319, '2010-11-16 00:00:00');
insert into t1 (id, dt) values (320, '2010-11-17 00:00:00');
insert into t1 (id, dt) values (321, '2010-11-18 00:00:00');
insert into t1 (id, dt) values (322, '2010-11-19 00:00:00');
insert into t1 (id, dt) values (323, '2010-11-20 00:00:00');
insert into t1 (id, dt) values (324, '2010-11-21 00:00:00');
insert into t1 (id, dt) values (325, '2010-11-22 00:00:00');
insert into t1 (id, dt) values (326, '2010-11-23 00:00:00');
insert into t1 (id, dt) values (327, '2010-11-24 00:00:00');
insert into t1 (id, dt) values (328, '2010-11-25 00:00:00');
insert into t1 (id, dt) values (329, '2010-11-26 00:00:00');
insert into t1 (id, dt) values (330, '2010-11-27 00:00:00');
insert into t1 (id, dt) values (331, '2010-11-28 00:00:00');
insert into t1 (id, dt) values (332, '2010-11-29 00:00:00');
insert into t1 (id, dt) values (333, '2010-11-30 00:00:00');
insert into t1 (id, dt) values (334, '2010-12-01 00:00:00');
insert into t1 (id, dt) values (335, '2010-12-02 00:00:00');
insert into t1 (id, dt) values (336, '2010-12-03 00:00:00');
insert into t1 (id, dt) values (337, '2010-12-04 00:00:00');
insert into t1 (id, dt) values (338, '2010-12-05 00:00:00');
insert into t1 (id, dt) values (339, '2010-12-06 00:00:00');
insert into t1 (id, dt) values (340, '2010-12-07 00:00:00');
insert into t1 (id, dt) values (341, '2010-12-08 00:00:00');
insert into t1 (id, dt) values (342, '2010-12-09 00:00:00');
insert into t1 (id, dt) values (343, '2010-12-10 00:00:00');
insert into t1 (id, dt) values (344, '2010-12-11 00:00:00');
insert into t1 (id, dt) values (345, '2010-12-12 00:00:00');
insert into t1 (id, dt) values (346, '2010-12-13 00:00:00');
insert into t1 (id, dt) values (347, '2010-12-14 00:00:00');
insert into t1 (id, dt) values (348, '2010-12-15 00:00:00');
insert into t1 (id, dt) values (349, '2010-12-16 00:00:00');
insert into t1 (id, dt) values (350, '2010-12-17 00:00:00');
SELECT COUNT(*) FROM t1;
COUNT(*)
350
connection node_2;
call p1(100);;
connection node_1a;
call p1(100);;
connection node_3;
call p1(100);;
connection node_4;
call p1(100);;
connection node_1;
SET SESSION wsrep_OSU_method='RSU';
SELECT @@wsrep_OSU_method;
@@wsrep_OSU_method
RSU
SET SESSION sql_log_bin = 0;
ALTER TABLE t1 DROP PARTITION rx2009xx;
ALTER TABLE t1 DROP PARTITION rx201004;
ALTER TABLE t1 DROP PARTITION rx201008;
SET SESSION wsrep_OSU_METHOD='TOI';
SELECT @@wsrep_OSU_method;
@@wsrep_OSU_method
TOI
connection node_2;
connection node_3;
connection node_4;
connection node_1a;
DROP TABLE t1;
DROP PROCEDURE p1;

View file

@ -0,0 +1,18 @@
!include ../galera_4nodes.cnf
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;gmcast.segment=1'
wsrep_slave_threads=10
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;gmcast.segment=1'
wsrep_slave_threads=10
[mysqld.3]
wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;gmcast.segment=2'
wsrep_slave_threads=10
[mysqld.4]
wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M;gmcast.segment=3'
wsrep_slave_threads=10

View file

@ -0,0 +1,453 @@
--source include/galera_cluster.inc
--source include/have_partition.inc
--connection node_1
call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*");
call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1
CREATE TABLE t1(
id bigint unsigned NOT NULL AUTO_INCREMENT,
dt datetime NOT NULL,
PRIMARY KEY (id,dt),
KEY dt_idx (dt)
) ENGINE=InnoDB
PARTITION BY RANGE( TO_DAYS(dt) ) (
PARTITION rx2009xx VALUES LESS THAN( TO_DAYS('2010-01-01 00:00:00') ),
PARTITION rx201001 VALUES LESS THAN( TO_DAYS('2010-02-01 00:00:00') ),
PARTITION rx201002 VALUES LESS THAN( TO_DAYS('2010-03-01 00:00:00') ),
PARTITION rx201003 VALUES LESS THAN( TO_DAYS('2010-04-01 00:00:00') ),
PARTITION rx201004 VALUES LESS THAN( TO_DAYS('2010-05-01 00:00:00') ),
PARTITION rx201005 VALUES LESS THAN( TO_DAYS('2010-06-01 00:00:00') ),
PARTITION rx201006 VALUES LESS THAN( TO_DAYS('2010-07-01 00:00:00') ),
PARTITION rx201007 VALUES LESS THAN( TO_DAYS('2010-08-01 00:00:00') ),
PARTITION rx201008 VALUES LESS THAN( TO_DAYS('2010-09-01 00:00:00') ),
PARTITION rx201009 VALUES LESS THAN( TO_DAYS('2010-10-01 00:00:00') ),
PARTITION rx201010 VALUES LESS THAN( TO_DAYS('2010-11-01 00:00:00') ),
PARTITION rx201011 VALUES LESS THAN( TO_DAYS('2010-12-01 00:00:00') ),
PARTITION rx201012 VALUES LESS THAN( TO_DAYS('2011-01-01 00:00:00') ),
PARTITION rx2011 VALUES LESS THAN MAXVALUE);
DELIMITER |;
CREATE PROCEDURE p1 (repeat_count int)
BEGIN
DECLARE current_num int;
SET current_num = 0;
WHILE current_num < repeat_count do
INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-02-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-03-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-04-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-06-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
INSERT INTO t1 VALUES (NULL, '2012-02-21 00:00:00');
COMMIT;
SET current_num = current_num + 1;
END WHILE;
END|
DELIMITER ;|
insert into t1 (id, dt) values (1, '2010-01-02 00:00:00');
insert into t1 (id, dt) values (2, '2010-01-03 00:00:00');
insert into t1 (id, dt) values (3, '2010-01-04 00:00:00');
insert into t1 (id, dt) values (4, '2010-01-05 00:00:00');
insert into t1 (id, dt) values (5, '2010-01-06 00:00:00');
insert into t1 (id, dt) values (6, '2010-01-07 00:00:00');
insert into t1 (id, dt) values (7, '2010-01-08 00:00:00');
insert into t1 (id, dt) values (8, '2010-01-09 00:00:00');
insert into t1 (id, dt) values (9, '2010-01-10 00:00:00');
insert into t1 (id, dt) values (10, '2010-01-11 00:00:00');
insert into t1 (id, dt) values (11, '2010-01-12 00:00:00');
insert into t1 (id, dt) values (12, '2010-01-13 00:00:00');
insert into t1 (id, dt) values (13, '2010-01-14 00:00:00');
insert into t1 (id, dt) values (14, '2010-01-15 00:00:00');
insert into t1 (id, dt) values (15, '2010-01-16 00:00:00');
insert into t1 (id, dt) values (16, '2010-01-17 00:00:00');
insert into t1 (id, dt) values (17, '2010-01-18 00:00:00');
insert into t1 (id, dt) values (18, '2010-01-19 00:00:00');
insert into t1 (id, dt) values (19, '2010-01-20 00:00:00');
insert into t1 (id, dt) values (20, '2010-01-21 00:00:00');
insert into t1 (id, dt) values (21, '2010-01-22 00:00:00');
insert into t1 (id, dt) values (22, '2010-01-23 00:00:00');
insert into t1 (id, dt) values (23, '2010-01-24 00:00:00');
insert into t1 (id, dt) values (24, '2010-01-25 00:00:00');
insert into t1 (id, dt) values (25, '2010-01-26 00:00:00');
insert into t1 (id, dt) values (26, '2010-01-27 00:00:00');
insert into t1 (id, dt) values (27, '2010-01-28 00:00:00');
insert into t1 (id, dt) values (28, '2010-01-29 00:00:00');
insert into t1 (id, dt) values (29, '2010-01-30 00:00:00');
insert into t1 (id, dt) values (30, '2010-01-31 00:00:00');
insert into t1 (id, dt) values (31, '2010-02-01 00:00:00');
insert into t1 (id, dt) values (32, '2010-02-02 00:00:00');
insert into t1 (id, dt) values (33, '2010-02-03 00:00:00');
insert into t1 (id, dt) values (34, '2010-02-04 00:00:00');
insert into t1 (id, dt) values (35, '2010-02-05 00:00:00');
insert into t1 (id, dt) values (36, '2010-02-06 00:00:00');
insert into t1 (id, dt) values (37, '2010-02-07 00:00:00');
insert into t1 (id, dt) values (38, '2010-02-08 00:00:00');
insert into t1 (id, dt) values (39, '2010-02-09 00:00:00');
insert into t1 (id, dt) values (40, '2010-02-10 00:00:00');
insert into t1 (id, dt) values (41, '2010-02-11 00:00:00');
insert into t1 (id, dt) values (42, '2010-02-12 00:00:00');
insert into t1 (id, dt) values (43, '2010-02-13 00:00:00');
insert into t1 (id, dt) values (44, '2010-02-14 00:00:00');
insert into t1 (id, dt) values (45, '2010-02-15 00:00:00');
insert into t1 (id, dt) values (46, '2010-02-16 00:00:00');
insert into t1 (id, dt) values (47, '2010-02-17 00:00:00');
insert into t1 (id, dt) values (48, '2010-02-18 00:00:00');
insert into t1 (id, dt) values (49, '2010-02-19 00:00:00');
insert into t1 (id, dt) values (50, '2010-02-20 00:00:00');
insert into t1 (id, dt) values (51, '2010-02-21 00:00:00');
insert into t1 (id, dt) values (52, '2010-02-22 00:00:00');
insert into t1 (id, dt) values (53, '2010-02-23 00:00:00');
insert into t1 (id, dt) values (54, '2010-02-24 00:00:00');
insert into t1 (id, dt) values (55, '2010-02-25 00:00:00');
insert into t1 (id, dt) values (56, '2010-02-26 00:00:00');
insert into t1 (id, dt) values (57, '2010-02-27 00:00:00');
insert into t1 (id, dt) values (58, '2010-02-28 00:00:00');
insert into t1 (id, dt) values (59, '2010-03-01 00:00:00');
insert into t1 (id, dt) values (60, '2010-03-02 00:00:00');
insert into t1 (id, dt) values (61, '2010-03-03 00:00:00');
insert into t1 (id, dt) values (62, '2010-03-04 00:00:00');
insert into t1 (id, dt) values (63, '2010-03-05 00:00:00');
insert into t1 (id, dt) values (64, '2010-03-06 00:00:00');
insert into t1 (id, dt) values (65, '2010-03-07 00:00:00');
insert into t1 (id, dt) values (66, '2010-03-08 00:00:00');
insert into t1 (id, dt) values (67, '2010-03-09 00:00:00');
insert into t1 (id, dt) values (68, '2010-03-10 00:00:00');
insert into t1 (id, dt) values (69, '2010-03-11 00:00:00');
insert into t1 (id, dt) values (70, '2010-03-12 00:00:00');
insert into t1 (id, dt) values (71, '2010-03-13 00:00:00');
insert into t1 (id, dt) values (72, '2010-03-14 00:00:00');
insert into t1 (id, dt) values (73, '2010-03-15 00:00:00');
insert into t1 (id, dt) values (74, '2010-03-16 00:00:00');
insert into t1 (id, dt) values (75, '2010-03-17 00:00:00');
insert into t1 (id, dt) values (76, '2010-03-18 00:00:00');
insert into t1 (id, dt) values (77, '2010-03-19 00:00:00');
insert into t1 (id, dt) values (78, '2010-03-20 00:00:00');
insert into t1 (id, dt) values (79, '2010-03-21 00:00:00');
insert into t1 (id, dt) values (80, '2010-03-22 00:00:00');
insert into t1 (id, dt) values (81, '2010-03-23 00:00:00');
insert into t1 (id, dt) values (82, '2010-03-24 00:00:00');
insert into t1 (id, dt) values (83, '2010-03-25 00:00:00');
insert into t1 (id, dt) values (84, '2010-03-26 00:00:00');
insert into t1 (id, dt) values (85, '2010-03-27 00:00:00');
insert into t1 (id, dt) values (86, '2010-03-28 00:00:00');
insert into t1 (id, dt) values (87, '2010-03-29 00:00:00');
insert into t1 (id, dt) values (88, '2010-03-30 00:00:00');
insert into t1 (id, dt) values (89, '2010-03-31 00:00:00');
insert into t1 (id, dt) values (90, '2010-04-01 00:00:00');
insert into t1 (id, dt) values (91, '2010-04-02 00:00:00');
insert into t1 (id, dt) values (92, '2010-04-03 00:00:00');
insert into t1 (id, dt) values (93, '2010-04-04 00:00:00');
insert into t1 (id, dt) values (94, '2010-04-05 00:00:00');
insert into t1 (id, dt) values (95, '2010-04-06 00:00:00');
insert into t1 (id, dt) values (96, '2010-04-07 00:00:00');
insert into t1 (id, dt) values (97, '2010-04-08 00:00:00');
insert into t1 (id, dt) values (98, '2010-04-09 00:00:00');
insert into t1 (id, dt) values (99, '2010-04-10 00:00:00');
insert into t1 (id, dt) values (100, '2010-04-11 00:00:00');
insert into t1 (id, dt) values (101, '2010-04-12 00:00:00');
insert into t1 (id, dt) values (102, '2010-04-13 00:00:00');
insert into t1 (id, dt) values (103, '2010-04-14 00:00:00');
insert into t1 (id, dt) values (104, '2010-04-15 00:00:00');
insert into t1 (id, dt) values (105, '2010-04-16 00:00:00');
insert into t1 (id, dt) values (106, '2010-04-17 00:00:00');
insert into t1 (id, dt) values (107, '2010-04-18 00:00:00');
insert into t1 (id, dt) values (108, '2010-04-19 00:00:00');
insert into t1 (id, dt) values (109, '2010-04-20 00:00:00');
insert into t1 (id, dt) values (110, '2010-04-21 00:00:00');
insert into t1 (id, dt) values (111, '2010-04-22 00:00:00');
insert into t1 (id, dt) values (112, '2010-04-23 00:00:00');
insert into t1 (id, dt) values (113, '2010-04-24 00:00:00');
insert into t1 (id, dt) values (114, '2010-04-25 00:00:00');
insert into t1 (id, dt) values (115, '2010-04-26 00:00:00');
insert into t1 (id, dt) values (116, '2010-04-27 00:00:00');
insert into t1 (id, dt) values (117, '2010-04-28 00:00:00');
insert into t1 (id, dt) values (118, '2010-04-29 00:00:00');
insert into t1 (id, dt) values (119, '2010-04-30 00:00:00');
insert into t1 (id, dt) values (120, '2010-05-01 00:00:00');
insert into t1 (id, dt) values (121, '2010-05-02 00:00:00');
insert into t1 (id, dt) values (122, '2010-05-03 00:00:00');
insert into t1 (id, dt) values (123, '2010-05-04 00:00:00');
insert into t1 (id, dt) values (124, '2010-05-05 00:00:00');
insert into t1 (id, dt) values (125, '2010-05-06 00:00:00');
insert into t1 (id, dt) values (126, '2010-05-07 00:00:00');
insert into t1 (id, dt) values (127, '2010-05-08 00:00:00');
insert into t1 (id, dt) values (128, '2010-05-09 00:00:00');
insert into t1 (id, dt) values (129, '2010-05-10 00:00:00');
insert into t1 (id, dt) values (130, '2010-05-11 00:00:00');
insert into t1 (id, dt) values (131, '2010-05-12 00:00:00');
insert into t1 (id, dt) values (132, '2010-05-13 00:00:00');
insert into t1 (id, dt) values (133, '2010-05-14 00:00:00');
insert into t1 (id, dt) values (134, '2010-05-15 00:00:00');
insert into t1 (id, dt) values (135, '2010-05-16 00:00:00');
insert into t1 (id, dt) values (136, '2010-05-17 00:00:00');
insert into t1 (id, dt) values (137, '2010-05-18 00:00:00');
insert into t1 (id, dt) values (138, '2010-05-19 00:00:00');
insert into t1 (id, dt) values (139, '2010-05-20 00:00:00');
insert into t1 (id, dt) values (140, '2010-05-21 00:00:00');
insert into t1 (id, dt) values (141, '2010-05-22 00:00:00');
insert into t1 (id, dt) values (142, '2010-05-23 00:00:00');
insert into t1 (id, dt) values (143, '2010-05-24 00:00:00');
insert into t1 (id, dt) values (144, '2010-05-25 00:00:00');
insert into t1 (id, dt) values (145, '2010-05-26 00:00:00');
insert into t1 (id, dt) values (146, '2010-05-27 00:00:00');
insert into t1 (id, dt) values (147, '2010-05-28 00:00:00');
insert into t1 (id, dt) values (148, '2010-05-29 00:00:00');
insert into t1 (id, dt) values (149, '2010-05-30 00:00:00');
insert into t1 (id, dt) values (150, '2010-05-31 00:00:00');
insert into t1 (id, dt) values (151, '2010-06-01 00:00:00');
insert into t1 (id, dt) values (152, '2010-06-02 00:00:00');
insert into t1 (id, dt) values (153, '2010-06-03 00:00:00');
insert into t1 (id, dt) values (154, '2010-06-04 00:00:00');
insert into t1 (id, dt) values (155, '2010-06-05 00:00:00');
insert into t1 (id, dt) values (156, '2010-06-06 00:00:00');
insert into t1 (id, dt) values (157, '2010-06-07 00:00:00');
insert into t1 (id, dt) values (158, '2010-06-08 00:00:00');
insert into t1 (id, dt) values (159, '2010-06-09 00:00:00');
insert into t1 (id, dt) values (160, '2010-06-10 00:00:00');
insert into t1 (id, dt) values (161, '2010-06-11 00:00:00');
insert into t1 (id, dt) values (162, '2010-06-12 00:00:00');
insert into t1 (id, dt) values (163, '2010-06-13 00:00:00');
insert into t1 (id, dt) values (164, '2010-06-14 00:00:00');
insert into t1 (id, dt) values (165, '2010-06-15 00:00:00');
insert into t1 (id, dt) values (166, '2010-06-16 00:00:00');
insert into t1 (id, dt) values (167, '2010-06-17 00:00:00');
insert into t1 (id, dt) values (168, '2010-06-18 00:00:00');
insert into t1 (id, dt) values (169, '2010-06-19 00:00:00');
insert into t1 (id, dt) values (170, '2010-06-20 00:00:00');
insert into t1 (id, dt) values (171, '2010-06-21 00:00:00');
insert into t1 (id, dt) values (172, '2010-06-22 00:00:00');
insert into t1 (id, dt) values (173, '2010-06-23 00:00:00');
insert into t1 (id, dt) values (174, '2010-06-24 00:00:00');
insert into t1 (id, dt) values (175, '2010-06-25 00:00:00');
insert into t1 (id, dt) values (176, '2010-06-26 00:00:00');
insert into t1 (id, dt) values (177, '2010-06-27 00:00:00');
insert into t1 (id, dt) values (178, '2010-06-28 00:00:00');
insert into t1 (id, dt) values (179, '2010-06-29 00:00:00');
insert into t1 (id, dt) values (180, '2010-06-30 00:00:00');
insert into t1 (id, dt) values (181, '2010-07-01 00:00:00');
insert into t1 (id, dt) values (182, '2010-07-02 00:00:00');
insert into t1 (id, dt) values (183, '2010-07-03 00:00:00');
insert into t1 (id, dt) values (184, '2010-07-04 00:00:00');
insert into t1 (id, dt) values (185, '2010-07-05 00:00:00');
insert into t1 (id, dt) values (186, '2010-07-06 00:00:00');
insert into t1 (id, dt) values (187, '2010-07-07 00:00:00');
insert into t1 (id, dt) values (188, '2010-07-08 00:00:00');
insert into t1 (id, dt) values (189, '2010-07-09 00:00:00');
insert into t1 (id, dt) values (190, '2010-07-10 00:00:00');
insert into t1 (id, dt) values (191, '2010-07-11 00:00:00');
insert into t1 (id, dt) values (192, '2010-07-12 00:00:00');
insert into t1 (id, dt) values (193, '2010-07-13 00:00:00');
insert into t1 (id, dt) values (194, '2010-07-14 00:00:00');
insert into t1 (id, dt) values (195, '2010-07-15 00:00:00');
insert into t1 (id, dt) values (196, '2010-07-16 00:00:00');
insert into t1 (id, dt) values (197, '2010-07-17 00:00:00');
insert into t1 (id, dt) values (198, '2010-07-18 00:00:00');
insert into t1 (id, dt) values (199, '2010-07-19 00:00:00');
insert into t1 (id, dt) values (200, '2010-07-20 00:00:00');
insert into t1 (id, dt) values (201, '2010-07-21 00:00:00');
insert into t1 (id, dt) values (202, '2010-07-22 00:00:00');
insert into t1 (id, dt) values (203, '2010-07-23 00:00:00');
insert into t1 (id, dt) values (204, '2010-07-24 00:00:00');
insert into t1 (id, dt) values (205, '2010-07-25 00:00:00');
insert into t1 (id, dt) values (206, '2010-07-26 00:00:00');
insert into t1 (id, dt) values (207, '2010-07-27 00:00:00');
insert into t1 (id, dt) values (208, '2010-07-28 00:00:00');
insert into t1 (id, dt) values (209, '2010-07-29 00:00:00');
insert into t1 (id, dt) values (210, '2010-07-30 00:00:00');
insert into t1 (id, dt) values (211, '2010-07-31 00:00:00');
insert into t1 (id, dt) values (212, '2010-08-01 00:00:00');
insert into t1 (id, dt) values (213, '2010-08-02 00:00:00');
insert into t1 (id, dt) values (214, '2010-08-03 00:00:00');
insert into t1 (id, dt) values (215, '2010-08-04 00:00:00');
insert into t1 (id, dt) values (216, '2010-08-05 00:00:00');
insert into t1 (id, dt) values (217, '2010-08-06 00:00:00');
insert into t1 (id, dt) values (218, '2010-08-07 00:00:00');
insert into t1 (id, dt) values (219, '2010-08-08 00:00:00');
insert into t1 (id, dt) values (220, '2010-08-09 00:00:00');
insert into t1 (id, dt) values (221, '2010-08-10 00:00:00');
insert into t1 (id, dt) values (222, '2010-08-11 00:00:00');
insert into t1 (id, dt) values (223, '2010-08-12 00:00:00');
insert into t1 (id, dt) values (224, '2010-08-13 00:00:00');
insert into t1 (id, dt) values (225, '2010-08-14 00:00:00');
insert into t1 (id, dt) values (226, '2010-08-15 00:00:00');
insert into t1 (id, dt) values (227, '2010-08-16 00:00:00');
insert into t1 (id, dt) values (228, '2010-08-17 00:00:00');
insert into t1 (id, dt) values (229, '2010-08-18 00:00:00');
insert into t1 (id, dt) values (230, '2010-08-19 00:00:00');
insert into t1 (id, dt) values (231, '2010-08-20 00:00:00');
insert into t1 (id, dt) values (232, '2010-08-21 00:00:00');
insert into t1 (id, dt) values (233, '2010-08-22 00:00:00');
insert into t1 (id, dt) values (234, '2010-08-23 00:00:00');
insert into t1 (id, dt) values (235, '2010-08-24 00:00:00');
insert into t1 (id, dt) values (236, '2010-08-25 00:00:00');
insert into t1 (id, dt) values (237, '2010-08-26 00:00:00');
insert into t1 (id, dt) values (238, '2010-08-27 00:00:00');
insert into t1 (id, dt) values (239, '2010-08-28 00:00:00');
insert into t1 (id, dt) values (240, '2010-08-29 00:00:00');
insert into t1 (id, dt) values (241, '2010-08-30 00:00:00');
insert into t1 (id, dt) values (242, '2010-08-31 00:00:00');
insert into t1 (id, dt) values (243, '2010-09-01 00:00:00');
insert into t1 (id, dt) values (244, '2010-09-02 00:00:00');
insert into t1 (id, dt) values (245, '2010-09-03 00:00:00');
insert into t1 (id, dt) values (246, '2010-09-04 00:00:00');
insert into t1 (id, dt) values (247, '2010-09-05 00:00:00');
insert into t1 (id, dt) values (248, '2010-09-06 00:00:00');
insert into t1 (id, dt) values (249, '2010-09-07 00:00:00');
insert into t1 (id, dt) values (250, '2010-09-08 00:00:00');
insert into t1 (id, dt) values (251, '2010-09-09 00:00:00');
insert into t1 (id, dt) values (252, '2010-09-10 00:00:00');
insert into t1 (id, dt) values (253, '2010-09-11 00:00:00');
insert into t1 (id, dt) values (254, '2010-09-12 00:00:00');
insert into t1 (id, dt) values (255, '2010-09-13 00:00:00');
insert into t1 (id, dt) values (256, '2010-09-14 00:00:00');
insert into t1 (id, dt) values (257, '2010-09-15 00:00:00');
insert into t1 (id, dt) values (258, '2010-09-16 00:00:00');
insert into t1 (id, dt) values (259, '2010-09-17 00:00:00');
insert into t1 (id, dt) values (260, '2010-09-18 00:00:00');
insert into t1 (id, dt) values (261, '2010-09-19 00:00:00');
insert into t1 (id, dt) values (262, '2010-09-20 00:00:00');
insert into t1 (id, dt) values (263, '2010-09-21 00:00:00');
insert into t1 (id, dt) values (264, '2010-09-22 00:00:00');
insert into t1 (id, dt) values (265, '2010-09-23 00:00:00');
insert into t1 (id, dt) values (266, '2010-09-24 00:00:00');
insert into t1 (id, dt) values (267, '2010-09-25 00:00:00');
insert into t1 (id, dt) values (268, '2010-09-26 00:00:00');
insert into t1 (id, dt) values (269, '2010-09-27 00:00:00');
insert into t1 (id, dt) values (270, '2010-09-28 00:00:00');
insert into t1 (id, dt) values (271, '2010-09-29 00:00:00');
insert into t1 (id, dt) values (272, '2010-09-30 00:00:00');
insert into t1 (id, dt) values (273, '2010-10-01 00:00:00');
insert into t1 (id, dt) values (274, '2010-10-02 00:00:00');
insert into t1 (id, dt) values (275, '2010-10-03 00:00:00');
insert into t1 (id, dt) values (276, '2010-10-04 00:00:00');
insert into t1 (id, dt) values (277, '2010-10-05 00:00:00');
insert into t1 (id, dt) values (278, '2010-10-06 00:00:00');
insert into t1 (id, dt) values (279, '2010-10-07 00:00:00');
insert into t1 (id, dt) values (280, '2010-10-08 00:00:00');
insert into t1 (id, dt) values (281, '2010-10-09 00:00:00');
insert into t1 (id, dt) values (282, '2010-10-10 00:00:00');
insert into t1 (id, dt) values (283, '2010-10-11 00:00:00');
insert into t1 (id, dt) values (284, '2010-10-12 00:00:00');
insert into t1 (id, dt) values (285, '2010-10-13 00:00:00');
insert into t1 (id, dt) values (286, '2010-10-14 00:00:00');
insert into t1 (id, dt) values (287, '2010-10-15 00:00:00');
insert into t1 (id, dt) values (288, '2010-10-16 00:00:00');
insert into t1 (id, dt) values (289, '2010-10-17 00:00:00');
insert into t1 (id, dt) values (290, '2010-10-18 00:00:00');
insert into t1 (id, dt) values (291, '2010-10-19 00:00:00');
insert into t1 (id, dt) values (292, '2010-10-20 00:00:00');
insert into t1 (id, dt) values (293, '2010-10-21 00:00:00');
insert into t1 (id, dt) values (294, '2010-10-22 00:00:00');
insert into t1 (id, dt) values (295, '2010-10-23 00:00:00');
insert into t1 (id, dt) values (296, '2010-10-24 00:00:00');
insert into t1 (id, dt) values (297, '2010-10-25 00:00:00');
insert into t1 (id, dt) values (298, '2010-10-26 00:00:00');
insert into t1 (id, dt) values (299, '2010-10-27 00:00:00');
insert into t1 (id, dt) values (300, '2010-10-28 00:00:00');
insert into t1 (id, dt) values (301, '2010-10-29 00:00:00');
insert into t1 (id, dt) values (302, '2010-10-30 00:00:00');
insert into t1 (id, dt) values (303, '2010-10-31 00:00:00');
insert into t1 (id, dt) values (304, '2010-11-01 00:00:00');
insert into t1 (id, dt) values (305, '2010-11-02 00:00:00');
insert into t1 (id, dt) values (306, '2010-11-03 00:00:00');
insert into t1 (id, dt) values (307, '2010-11-04 00:00:00');
insert into t1 (id, dt) values (308, '2010-11-05 00:00:00');
insert into t1 (id, dt) values (309, '2010-11-06 00:00:00');
insert into t1 (id, dt) values (310, '2010-11-07 00:00:00');
insert into t1 (id, dt) values (311, '2010-11-08 00:00:00');
insert into t1 (id, dt) values (312, '2010-11-09 00:00:00');
insert into t1 (id, dt) values (313, '2010-11-10 00:00:00');
insert into t1 (id, dt) values (314, '2010-11-11 00:00:00');
insert into t1 (id, dt) values (315, '2010-11-12 00:00:00');
insert into t1 (id, dt) values (316, '2010-11-13 00:00:00');
insert into t1 (id, dt) values (317, '2010-11-14 00:00:00');
insert into t1 (id, dt) values (318, '2010-11-15 00:00:00');
insert into t1 (id, dt) values (319, '2010-11-16 00:00:00');
insert into t1 (id, dt) values (320, '2010-11-17 00:00:00');
insert into t1 (id, dt) values (321, '2010-11-18 00:00:00');
insert into t1 (id, dt) values (322, '2010-11-19 00:00:00');
insert into t1 (id, dt) values (323, '2010-11-20 00:00:00');
insert into t1 (id, dt) values (324, '2010-11-21 00:00:00');
insert into t1 (id, dt) values (325, '2010-11-22 00:00:00');
insert into t1 (id, dt) values (326, '2010-11-23 00:00:00');
insert into t1 (id, dt) values (327, '2010-11-24 00:00:00');
insert into t1 (id, dt) values (328, '2010-11-25 00:00:00');
insert into t1 (id, dt) values (329, '2010-11-26 00:00:00');
insert into t1 (id, dt) values (330, '2010-11-27 00:00:00');
insert into t1 (id, dt) values (331, '2010-11-28 00:00:00');
insert into t1 (id, dt) values (332, '2010-11-29 00:00:00');
insert into t1 (id, dt) values (333, '2010-11-30 00:00:00');
insert into t1 (id, dt) values (334, '2010-12-01 00:00:00');
insert into t1 (id, dt) values (335, '2010-12-02 00:00:00');
insert into t1 (id, dt) values (336, '2010-12-03 00:00:00');
insert into t1 (id, dt) values (337, '2010-12-04 00:00:00');
insert into t1 (id, dt) values (338, '2010-12-05 00:00:00');
insert into t1 (id, dt) values (339, '2010-12-06 00:00:00');
insert into t1 (id, dt) values (340, '2010-12-07 00:00:00');
insert into t1 (id, dt) values (341, '2010-12-08 00:00:00');
insert into t1 (id, dt) values (342, '2010-12-09 00:00:00');
insert into t1 (id, dt) values (343, '2010-12-10 00:00:00');
insert into t1 (id, dt) values (344, '2010-12-11 00:00:00');
insert into t1 (id, dt) values (345, '2010-12-12 00:00:00');
insert into t1 (id, dt) values (346, '2010-12-13 00:00:00');
insert into t1 (id, dt) values (347, '2010-12-14 00:00:00');
insert into t1 (id, dt) values (348, '2010-12-15 00:00:00');
insert into t1 (id, dt) values (349, '2010-12-16 00:00:00');
insert into t1 (id, dt) values (350, '2010-12-17 00:00:00');
SELECT COUNT(*) FROM t1;
--connection node_2
--send call p1(100);
--connection node_1a
--send call p1(100);
--connection node_3
--send call p1(100);
--connection node_4
--send call p1(100);
--connection node_1
SET SESSION wsrep_OSU_method='RSU';
SELECT @@wsrep_OSU_method;
SET SESSION sql_log_bin = 0;
--error 0,ER_LOCK_DEADLOCK
ALTER TABLE t1 DROP PARTITION rx2009xx;
--error 0,ER_LOCK_DEADLOCK
ALTER TABLE t1 DROP PARTITION rx201004;
--error 0,ER_LOCK_DEADLOCK
ALTER TABLE t1 DROP PARTITION rx201008;
SET SESSION wsrep_OSU_METHOD='TOI';
SELECT @@wsrep_OSU_method;
--connection node_2
--error 0,ER_LOCK_DEADLOCK
reap;
--connection node_3
--error 0,ER_LOCK_DEADLOCK
reap;
--connection node_4
--error 0,ER_LOCK_DEADLOCK
reap;
--connection node_1a
--error 0,ER_LOCK_DEADLOCK
reap;
DROP TABLE t1;
DROP PROCEDURE p1;

View file

@ -1,5 +1,4 @@
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
SET GLOBAL innodb_fast_shutdown=0;
SET @save_enabled= @@GLOBAL.innodb_cmp_per_index_enabled;
SET GLOBAL innodb_cmp_per_index_enabled=ON;
SELECT * FROM information_schema.innodb_cmp_per_index;
CREATE TABLE t (
@ -72,34 +71,5 @@ index_name PRIMARY
compress_ops 65
compress_ops_ok 65
uncompress_ops 0
# restart
SHOW CREATE TABLE t;
Table t
Create Table CREATE TABLE `t` (
`a` int(11) NOT NULL,
`b` varchar(512) DEFAULT NULL,
`c` varchar(16) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2
SET GLOBAL innodb_cmp_per_index_enabled=ON;
SELECT COUNT(*) FROM t IGNORE INDEX(b);
COUNT(*) 128
SELECT
database_name,
table_name,
index_name,
compress_ops,
compress_ops_ok,
CASE WHEN uncompress_ops=6 and @@innodb_compression_level IN (4,8,9) THEN 9
ELSE uncompress_ops END as uncompress_ops
FROM information_schema.innodb_cmp_per_index
ORDER BY 1, 2, 3;
database_name test
table_name t
index_name PRIMARY
compress_ops 0
compress_ops_ok 0
uncompress_ops 4
DROP TABLE t;
SET GLOBAL innodb_cmp_per_index_enabled=default;
SET GLOBAL innodb_cmp_per_index_enabled=@save_enabled;

View file

@ -19,12 +19,9 @@ if (`SELECT @@innodb_log_compressed_pages = 0`)
# include/restart_mysqld.inc does not work in embedded mode
-- source include/not_embedded.inc
# ensure that all history gets purged on shutdown
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
SET GLOBAL innodb_fast_shutdown=0;
-- vertical_results
SET @save_enabled= @@GLOBAL.innodb_cmp_per_index_enabled;
SET GLOBAL innodb_cmp_per_index_enabled=ON;
# reset any leftover stats from previous tests
@ -96,29 +93,6 @@ ELSE compress_ops_ok END as compress_ops_ok,
uncompress_ops
FROM information_schema.innodb_cmp_per_index
ORDER BY 1, 2, 3;
# restart mysqld and see that uncompress ops also gets increased when
# selecting from the table again
-- source include/restart_mysqld.inc
SHOW CREATE TABLE t;
SET GLOBAL innodb_cmp_per_index_enabled=ON;
SELECT COUNT(*) FROM t IGNORE INDEX(b);
SELECT
database_name,
table_name,
index_name,
compress_ops,
compress_ops_ok,
CASE WHEN uncompress_ops=6 and @@innodb_compression_level IN (4,8,9) THEN 9
ELSE uncompress_ops END as uncompress_ops
FROM information_schema.innodb_cmp_per_index
ORDER BY 1, 2, 3;
DROP TABLE t;
SET GLOBAL innodb_cmp_per_index_enabled=default;
SET GLOBAL innodb_cmp_per_index_enabled=@save_enabled;

View file

@ -0,0 +1 @@
--loose-innodb-log-file-size=1048576 --loose-innodb-log-files-in-group=2

View file

@ -0,0 +1,2 @@
CREATE TABLE t(i INT) ENGINE=INNODB;
DROP TABLE t;

View file

@ -0,0 +1,20 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_sequence.inc
CREATE TABLE t(i INT) ENGINE=INNODB;
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
# Generate enough redo log records to make at least one loop in log group
--let before_innodb_log_copy_thread_started=INSERT INTO test.t SELECT * from test.seq_1_to_102400
--disable_result_log
# mariabackup must exit with error instead of hanging
--error 1
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
--enable_result_log
DROP TABLE t;
--rmdir $targetdir

View file

@ -50,5 +50,4 @@ COUNT(@@GLOBAL.innodb_buffer_pool_size)
1 Expected
SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size;
ERROR 42S22: Unknown column 'innodb_buffer_pool_size' in 'field list'
Expected error 'Readonly variable'
SET @@GLOBAL.innodb_buffer_pool_size = @start_buffer_pool_size;
# restart

View file

@ -27,7 +27,6 @@
--disable_query_log
if (`select (version() like '%debug%') > 0`)
{
set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug;
set global innodb_disable_resize_buffer_pool_debug = OFF;
}
--enable_query_log
@ -116,15 +115,7 @@ SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size);
--Error ER_BAD_FIELD_ERROR
SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size;
--echo Expected error 'Readonly variable'
SET @@GLOBAL.innodb_buffer_pool_size = @start_buffer_pool_size;
--source include/wait_condition.inc
--disable_query_log
if (`select (version() like '%debug%') > 0`)
{
set global innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize;
}
--enable_query_log
# Restore the original buffer pool size.
--source include/restart_mysqld.inc

View file

@ -69,6 +69,9 @@ bool init_errmessage(void)
{
const char **errmsgs;
bool error= FALSE;
const char *lang= my_default_lc_messages->errmsgs->language;
my_bool use_english;
DBUG_ENTER("init_errmessage");
free_error_messages();
@ -77,37 +80,65 @@ bool init_errmessage(void)
error_message_charset_info= system_charset_info;
/* Read messages from file. */
if (read_texts(ERRMSG_FILE, my_default_lc_messages->errmsgs->language,
&original_error_messages))
use_english= !strcmp(lang, "english");
if (!use_english)
{
/*
No error messages. Create a temporary empty error message so
that we don't get a crash if some code wrongly tries to access
a non existing error message.
*/
if (!(original_error_messages= (const char***)
my_malloc(MAX_ERROR_RANGES * sizeof(char**) +
(ERRORS_PER_RANGE * sizeof(char*)),
MYF(0))))
DBUG_RETURN(TRUE);
errmsgs= (const char**) (original_error_messages + MAX_ERROR_RANGES);
for (uint i=0 ; i < MAX_ERROR_RANGES ; i++)
{
original_error_messages[i]= errmsgs;
errors_per_range[i]= ERRORS_PER_RANGE;
}
errors_per_range[2]= 0; // MYSYS error messages
for (const char **ptr= errmsgs;
ptr < errmsgs + ERRORS_PER_RANGE ;
ptr++)
*ptr= "";
/* Read messages from file. */
use_english= !read_texts(ERRMSG_FILE,lang, &original_error_messages);
error= TRUE;
}
if (use_english)
{
static const struct
{
const char* name;
uint id;
const char* fmt;
}
english_msgs[]=
{
#include <mysqld_ername.h>
};
memset(errors_per_range, 0, sizeof(errors_per_range));
/* Calculate nr of messages per range. */
for (size_t i= 0; i < array_elements(english_msgs); i++)
{
uint id= english_msgs[i].id;
// We rely on the fact the array is sorted by id.
DBUG_ASSERT(i == 0 || english_msgs[i-1].id < id);
errors_per_range[id/ERRORS_PER_RANGE-1]= id%ERRORS_PER_RANGE + 1;
}
size_t all_errors= 0;
for (size_t i= 0; i < MAX_ERROR_RANGES; i++)
all_errors+= errors_per_range[i];
if (!(original_error_messages= (const char***)
my_malloc((all_errors + MAX_ERROR_RANGES)* sizeof(void*),
MYF(MY_ZEROFILL))))
DBUG_RETURN(TRUE);
errmsgs= (const char**)(original_error_messages + MAX_ERROR_RANGES);
original_error_messages[0]= errmsgs;
for (uint i= 1; i < MAX_ERROR_RANGES; i++)
{
original_error_messages[i]=
original_error_messages[i-1] + errors_per_range[i-1];
}
for (uint i= 0; i < array_elements(english_msgs); i++)
{
uint id= english_msgs[i].id;
original_error_messages[id/ERRORS_PER_RANGE-1][id%ERRORS_PER_RANGE]=
english_msgs[i].fmt;
}
}
/* Register messages for use with my_error(). */
for (uint i=0 ; i < MAX_ERROR_RANGES ; i++)
{

View file

@ -10108,6 +10108,8 @@ bool Item_cache_str::cache_value()
value_buff.copy(*value);
value= &value_buff;
}
else
value_buff.copy();
return TRUE;
}

View file

@ -2468,6 +2468,7 @@ public:
bool to_be_transformed_into_in_subq(THD *thd);
bool create_value_list_for_tvc(THD *thd, List< List<Item> > *values);
Item *in_predicate_to_in_subs_transformer(THD *thd, uchar *arg);
uint32 max_length_of_left_expr();
};
class cmp_item_row :public cmp_item

View file

@ -861,7 +861,12 @@ bool subquery_types_allow_materialization(THD* thd, Item_in_subselect *in_subs)
OPT_TRACE_TRANSFORM(thd, trace_wrapper, trace_transform,
in_subs->get_select_lex()->select_number,
"IN (SELECT)", "materialization");
/*
The checks here must be kept in sync with the one in
Item_func_in::in_predicate_to_in_subs_transformer().
*/
bool all_are_fields= TRUE;
uint32 total_key_length = 0;
for (uint i= 0; i < elements; i++)

View file

@ -2627,7 +2627,7 @@ sp_head::backpatch_goto(THD *thd, sp_label *lab,sp_label *lab_begin_block)
}
if (bp->instr_type == CPOP)
{
uint n= lab->ctx->diff_cursors(lab_begin_block->ctx, true);
uint n= bp->instr->m_ctx->diff_cursors(lab_begin_block->ctx, true);
if (n == 0)
{
// Remove cpop instr
@ -2644,7 +2644,7 @@ sp_head::backpatch_goto(THD *thd, sp_label *lab,sp_label *lab_begin_block)
}
if (bp->instr_type == HPOP)
{
uint n= lab->ctx->diff_handlers(lab_begin_block->ctx, true);
uint n= bp->instr->m_ctx->diff_handlers(lab_begin_block->ctx, true);
if (n == 0)
{
// Remove hpop instr
@ -3149,6 +3149,8 @@ void sp_head::optimize()
sp_instr *i;
uint src, dst;
DBUG_EXECUTE_IF("sp_head_optimize_disable", return; );
opt_mark();
bp.empty();

View file

@ -4305,10 +4305,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
continue;
{
/* Check that there's no repeating constraint names. */
/* Check that there's no repeating table CHECK constraint names. */
List_iterator_fast<Virtual_column_info>
dup_it(alter_info->check_constraint_list);
Virtual_column_info *dup_check;
const Virtual_column_info *dup_check;
while ((dup_check= dup_it++) && dup_check != check)
{
if (!lex_string_cmp(system_charset_info,
@ -4320,6 +4320,27 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
}
/* Check that there's no repeating key constraint names. */
List_iterator_fast<Key> key_it(alter_info->key_list);
while (const Key *key= key_it++)
{
/*
Not all keys considered to be the CONSTRAINT
Noly Primary Key UNIQUE and Foreign keys.
*/
if (key->type != Key::PRIMARY && key->type != Key::UNIQUE &&
key->type != Key::FOREIGN_KEY)
continue;
if (check->name.length == key->name.length &&
my_strcasecmp(system_charset_info,
check->name.str, key->name.str) == 0)
{
my_error(ER_DUP_CONSTRAINT_NAME, MYF(0), "CHECK", check->name.str);
DBUG_RETURN(TRUE);
}
}
if (check_string_char_length(&check->name, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
@ -8657,6 +8678,35 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
}
}
if (!alter_info->check_constraint_list.is_empty())
{
/* Check the table FOREIGN KEYs for name duplications. */
List <FOREIGN_KEY_INFO> fk_child_key_list;
FOREIGN_KEY_INFO *f_key;
table->file->get_foreign_key_list(thd, &fk_child_key_list);
List_iterator<FOREIGN_KEY_INFO> fk_key_it(fk_child_key_list);
while ((f_key= fk_key_it++))
{
List_iterator_fast<Virtual_column_info>
c_it(alter_info->check_constraint_list);
Virtual_column_info *check;
while ((check= c_it++))
{
if (!check->name.length || check->automatic_name)
continue;
if (check->name.length == f_key->foreign_id->length &&
my_strcasecmp(system_charset_info, f_key->foreign_id->str,
check->name.str) == 0)
{
my_error(ER_DUP_CONSTRAINT_NAME, MYF(0), "CHECK", check->name.str);
goto err;
}
}
}
}
/* Add new constraints */
new_constraint_list.append(&alter_info->check_constraint_list);

View file

@ -795,6 +795,38 @@ bool Item_subselect::wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl)
}
/*
@brief
Check whether the items are of comparable type or not
@details
This check are done because materialization is not performed
if the left expr and right expr are of the same types.
@see subquery_types_allow_materialization()
@retval
0 comparable
1 not comparable
*/
static bool cmp_row_types(Item* item1, Item* item2)
{
uint n= item1->cols();
if (item2->check_cols(n))
return true;
for (uint i=0; i < n; i++)
{
Item *inner= item1->element_index(i);
Item *outer= item2->element_index(i);
if (!inner->type_handler()->subquery_type_allows_materialization(inner,
outer))
return true;
}
return false;
}
/**
@brief
Transform IN predicate into IN subquery
@ -839,10 +871,22 @@ Item *Item_func_in::in_predicate_to_in_subs_transformer(THD *thd,
/* SELECT_LEX object where the transformation is performed */
SELECT_LEX *parent_select= lex->current_select;
uint8 save_derived_tables= lex->derived_tables;
/*
Make sure that create_tmp_table will not fail due to too long keys.
Here the strategy would mainly use materialization, so we need to make
sure that the materialized table can be created.
The checks here are the same as in subquery_type_allows_materialization()
*/
uint32 length= max_length_of_left_expr();
if (!length || length > tmp_table_max_key_length() ||
args[0]->cols() > tmp_table_max_key_parts())
return this;
for (uint i=1; i < arg_count; i++)
{
if (!args[i]->const_item())
if (!args[i]->const_item() || cmp_row_types(args[0], args[i]))
return this;
}
@ -947,6 +991,16 @@ err:
}
uint32 Item_func_in::max_length_of_left_expr()
{
uint n= args[0]->cols();
uint32 length= 0;
for (uint i=0; i < n; i++)
length+= args[0]->element_index(i)->max_length;
return length;
}
/**
@brief
Check if this IN-predicate can be transformed in IN-subquery

View file

@ -346,6 +346,13 @@ bool THD::open_temporary_table(TABLE_LIST *tl)
DBUG_RETURN(false);
}
if (!tl->db.str)
{
DBUG_PRINT("info",
("Table reference to a temporary table must have database set"));
DBUG_RETURN(false);
}
/*
Temporary tables are not safe for parallel replication. They were
designed to be visible to one thread only, so have no table locking.

View file

@ -782,7 +782,7 @@ btr_node_ptr_set_child_page_no(
rec_t* rec, /*!< in: node pointer record */
page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed
part will be updated, or NULL */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint page_no,/*!< in: child node address */
mtr_t* mtr) /*!< in: mtr */
{
@ -817,7 +817,7 @@ btr_node_ptr_get_child(
/*===================*/
const rec_t* node_ptr,/*!< in: node pointer */
dict_index_t* index, /*!< in: index */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
mtr_t* mtr) /*!< in: mtr */
{
ut_ad(rec_offs_validate(node_ptr, index, offsets));
@ -836,10 +836,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds
an sx-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
ulint*
offset_t*
btr_page_get_father_node_ptr_func(
/*==============================*/
ulint* offsets,/*!< in: work area for the return value */
offset_t* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* cursor, /*!< in: cursor pointing to user record,
out: cursor on node pointer record,
@ -943,10 +943,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds
an x-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
ulint*
offset_t*
btr_page_get_father_block(
/*======================*/
ulint* offsets,/*!< in: work area for the return value */
offset_t* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
@ -1881,7 +1881,7 @@ btr_root_raise_and_insert(
on the root page; when the function returns,
the cursor is positioned on the predecessor
of the inserted record */
ulint** offsets,/*!< out: offsets on inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -2225,7 +2225,7 @@ btr_page_get_split_rec(
rec_t* next_rec;
ulint n;
mem_heap_t* heap;
ulint* offsets;
offset_t* offsets;
page = btr_cur_get_page(cursor);
@ -2331,7 +2331,7 @@ btr_page_insert_fits(
const rec_t* split_rec,/*!< in: suggestion for first record
on upper half-page, or NULL if
tuple to be inserted should be first */
ulint** offsets,/*!< in: rec_get_offsets(
offset_t** offsets,/*!< in: rec_get_offsets(
split_rec, cursor->index); out: garbage */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -2431,8 +2431,8 @@ btr_insert_on_non_leaf_level_func(
dberr_t err;
rec_t* rec;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
rtr_info_t rtr_info;
@ -2540,7 +2540,7 @@ btr_attach_half_pages(
if (direction == FSP_DOWN) {
btr_cur_t cursor;
ulint* offsets;
offset_t* offsets;
lower_page = buf_block_get_frame(new_block);
lower_page_no = new_block->page.id.page_no();
@ -2662,7 +2662,7 @@ btr_page_tuple_smaller(
/*===================*/
btr_cur_t* cursor, /*!< in: b-tree cursor */
const dtuple_t* tuple, /*!< in: tuple to consider */
ulint** offsets,/*!< in/out: temporary storage */
offset_t** offsets,/*!< in/out: temporary storage */
ulint n_uniq, /*!< in: number of unique fields
in the index page records */
mem_heap_t** heap) /*!< in/out: heap for offsets */
@ -2702,7 +2702,7 @@ rec_t*
btr_insert_into_right_sibling(
ulint flags,
btr_cur_t* cursor,
ulint** offsets,
offset_t** offsets,
mem_heap_t* heap,
const dtuple_t* tuple,
ulint n_ext,
@ -2838,7 +2838,7 @@ btr_page_split_and_insert(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
ulint** offsets,/*!< out: offsets on inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -3390,7 +3390,7 @@ btr_lift_page_up(
{
btr_cur_t cursor;
ulint* offsets = NULL;
offset_t* offsets = NULL;
mem_heap_t* heap = mem_heap_create(
sizeof(*offsets)
* (REC_OFFS_HEADER_SIZE + 1 + 1
@ -3582,7 +3582,7 @@ btr_compress(
page_t* page;
btr_cur_t father_cursor;
mem_heap_t* heap;
ulint* offsets;
offset_t* offsets;
ulint nth_rec = 0; /* remove bogus warning */
bool mbr_changed = false;
#ifdef UNIV_DEBUG
@ -3725,7 +3725,7 @@ retry:
if (is_left) {
btr_cur_t cursor2;
rtr_mbr_t new_mbr;
ulint* offsets2 = NULL;
offset_t* offsets2 = NULL;
/* For rtree, we need to update father's mbr. */
if (dict_index_is_spatial(index)) {
@ -3921,7 +3921,7 @@ retry:
/* For rtree, we need to update father's mbr. */
if (dict_index_is_spatial(index)) {
ulint* offsets2;
offset_t* offsets2;
ulint rec_info;
offsets2 = rec_get_offsets(
@ -4150,7 +4150,7 @@ btr_discard_only_page_on_level(
mem_heap_t* heap = NULL;
const rec_t* rec = NULL;
ulint* offsets = NULL;
offset_t* offsets = NULL;
if (index->table->instant) {
const rec_t* r = page_rec_get_next(page_get_infimum_rec(
block->frame));
@ -4395,7 +4395,7 @@ btr_print_recursive(
ulint width, /*!< in: print this many entries from start
and end */
mem_heap_t** heap, /*!< in/out: heap for rec_get_offsets() */
ulint** offsets,/*!< in/out: buffer for rec_get_offsets() */
offset_t** offsets,/*!< in/out: buffer for rec_get_offsets() */
mtr_t* mtr) /*!< in: mtr */
{
const page_t* page = buf_block_get_frame(block);
@ -4459,8 +4459,8 @@ btr_print_index(
mtr_t mtr;
buf_block_t* root;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
fputs("--------------------------\n"
@ -4494,7 +4494,7 @@ btr_check_node_ptr(
{
mem_heap_t* heap;
dtuple_t* tuple;
ulint* offsets;
offset_t* offsets;
btr_cur_t cursor;
page_t* page = buf_block_get_frame(block);
@ -4574,8 +4574,8 @@ btr_index_rec_validate(
ulint len;
const page_t* page;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
page = page_align(rec);
@ -4840,8 +4840,8 @@ btr_validate_level(
bool ret = true;
mtr_t mtr;
mem_heap_t* heap = mem_heap_create(256);
ulint* offsets = NULL;
ulint* offsets2= NULL;
offset_t* offsets = NULL;
offset_t* offsets2= NULL;
#ifdef UNIV_ZIP_DEBUG
page_zip_des_t* page_zip;
#endif /* UNIV_ZIP_DEBUG */

View file

@ -175,7 +175,7 @@ PageBulk::init()
void
PageBulk::insert(
const rec_t* rec,
ulint* offsets)
offset_t* offsets)
{
ulint rec_size;
@ -188,7 +188,7 @@ PageBulk::insert(
/* Check whether records are in order. */
if (!page_rec_is_infimum(m_cur_rec)) {
rec_t* old_rec = m_cur_rec;
ulint* old_offsets = rec_get_offsets(
offset_t* old_offsets = rec_get_offsets(
old_rec, m_index, NULL, is_leaf,
ULINT_UNDEFINED, &m_heap);
@ -401,7 +401,7 @@ rec_t*
PageBulk::getSplitRec()
{
rec_t* rec;
ulint* offsets;
offset_t* offsets;
ulint total_used_size;
ulint total_recs_size;
ulint n_recs;
@ -447,7 +447,7 @@ PageBulk::copyIn(
{
rec_t* rec = split_rec;
ulint* offsets = NULL;
offset_t* offsets = NULL;
ut_ad(m_rec_no == 0);
ut_ad(page_rec_is_user_rec(rec));
@ -493,7 +493,7 @@ PageBulk::copyOut(
ut_ad(n > 0);
/* Set last record's next in page */
ulint* offsets = NULL;
offset_t* offsets = NULL;
rec = page_rec_get_prev(split_rec);
offsets = rec_get_offsets(rec, m_index, offsets,
page_rec_is_leaf(split_rec),
@ -603,7 +603,7 @@ the blob data is logged first, then the record is logged in bulk mode.
dberr_t
PageBulk::storeExt(
const big_rec_t* big_rec,
ulint* offsets)
offset_t* offsets)
{
/* Note: not all fileds are initialized in btr_pcur. */
btr_pcur_t btr_pcur;
@ -863,7 +863,7 @@ BtrBulk::insert(
ulint rec_size = rec_get_converted_size(m_index, tuple, n_ext);
big_rec_t* big_rec = NULL;
rec_t* rec = NULL;
ulint* offsets = NULL;
offset_t* offsets = NULL;
if (page_bulk->needExt(tuple, rec_size)) {
/* The record is so big that we have to store some fields

View file

@ -158,7 +158,7 @@ btr_cur_unmark_extern_fields(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
mtr_t* mtr); /*!< in: mtr, or NULL if not logged */
/*******************************************************************//**
Adds path information to the cursor for the current page, for which
@ -183,7 +183,7 @@ btr_rec_free_updated_extern_fields(
rec_t* rec, /*!< in: record */
page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
part will be updated, or NULL */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const upd_t* update, /*!< in: update vector */
bool rollback,/*!< in: performing rollback? */
mtr_t* mtr); /*!< in: mini-transaction handle which contains
@ -197,7 +197,7 @@ btr_rec_free_externally_stored_fields(
dict_index_t* index, /*!< in: index of the data, the index
tree MUST be X-latched */
rec_t* rec, /*!< in: record */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
part will be updated, or NULL */
bool rollback,/*!< in: performing rollback? */
@ -592,8 +592,8 @@ incompatible:
}
mem_heap_t* heap = NULL;
ulint* offsets = rec_get_offsets(rec, index, NULL, true,
ULINT_UNDEFINED, &heap);
offset_t* offsets = rec_get_offsets(rec, index, NULL, true,
ULINT_UNDEFINED, &heap);
if (rec_offs_any_default(offsets)) {
inconsistent:
mem_heap_free(heap);
@ -1277,10 +1277,10 @@ btr_cur_search_to_nth_level_func(
btr_search_t* info;
#endif /* BTR_CUR_ADAPT */
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
ulint offsets2_[REC_OFFS_NORMAL_SIZE];
ulint* offsets2 = offsets2_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
offset_t offsets2_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets2_;
rec_offs_init(offsets_);
rec_offs_init(offsets2_);
/* Currently, PAGE_CUR_LE is the only search mode used for searches
@ -2542,8 +2542,8 @@ btr_cur_open_at_index_side_func(
ulint n_blocks = 0;
ulint n_releases = 0;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
dberr_t err = DB_SUCCESS;
rec_offs_init(offsets_);
@ -2911,8 +2911,8 @@ btr_cur_open_at_rnd_pos_func(
ulint n_blocks = 0;
ulint n_releases = 0;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(!index->is_spatial());
@ -3201,7 +3201,7 @@ btr_cur_insert_if_possible(
cursor stays valid */
const dtuple_t* tuple, /*!< in: tuple to insert; the size info need not
have been stored to tuple */
ulint** offsets,/*!< out: offsets on *rec */
offset_t** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in/out: mini-transaction */
@ -3367,7 +3367,7 @@ btr_cur_optimistic_insert(
specified */
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
offset_t** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
@ -3672,7 +3672,7 @@ btr_cur_pessimistic_insert(
insertion will certainly succeed */
btr_cur_t* cursor, /*!< in: cursor after which to insert;
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
offset_t** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
@ -3845,7 +3845,7 @@ btr_cur_upd_lock_and_undo(
/*======================*/
ulint flags, /*!< in: undo logging and locking flags */
btr_cur_t* cursor, /*!< in: cursor on record to update */
const ulint* offsets,/*!< in: rec_get_offsets() on cursor */
const offset_t* offsets,/*!< in: rec_get_offsets() on cursor */
const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index
updates */
@ -4019,7 +4019,7 @@ btr_cur_parse_update_in_place(
roll_ptr_t roll_ptr;
ulint rec_offset;
mem_heap_t* heap;
ulint* offsets;
offset_t* offsets;
if (end_ptr < ptr + 1) {
@ -4104,7 +4104,7 @@ btr_cur_update_alloc_zip_func(
page_cur_t* cursor, /*!< in/out: B-tree page cursor */
dict_index_t* index, /*!< in: the index corresponding to cursor */
#ifdef UNIV_DEBUG
ulint* offsets,/*!< in/out: offsets of the cursor record */
offset_t* offsets,/*!< in/out: offsets of the cursor record */
#endif /* UNIV_DEBUG */
ulint length, /*!< in: size needed */
bool create, /*!< in: true=delete-and-insert,
@ -4186,7 +4186,7 @@ btr_cur_update_in_place(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
ulint* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
offset_t* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index
updates */
@ -4479,7 +4479,7 @@ btr_cur_optimistic_update(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** heap, /*!< in/out: pointer to NULL or memory heap */
const upd_t* update, /*!< in: update vector; this must also
contain trx id and roll ptr fields */
@ -4817,7 +4817,7 @@ btr_cur_pessimistic_update(
btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
cursor may become invalid if *big_rec == NULL
|| !(flags & BTR_KEEP_POS_FLAG) */
ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
that can be emptied */
@ -5380,7 +5380,7 @@ btr_cur_parse_del_mark_set_clust_rec(
clustered index fields. */
ut_ad(pos <= MAX_REF_PARTS);
ulint offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
offset_t offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
rec_offs_init(offsets);
mem_heap_t* heap = NULL;
@ -5423,7 +5423,7 @@ btr_cur_del_mark_set_clust_rec(
buf_block_t* block, /*!< in/out: buffer block of the record */
rec_t* rec, /*!< in/out: record */
dict_index_t* index, /*!< in: clustered index of the record */
const ulint* offsets,/*!< in: rec_get_offsets(rec) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec) */
que_thr_t* thr, /*!< in: query thread */
const dtuple_t* entry, /*!< in: dtuple for the deleting record, also
contains the virtual cols if there are any */
@ -5709,8 +5709,8 @@ btr_cur_optimistic_delete_func(
buf_block_t* block;
rec_t* rec;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
ibool no_compress_needed;
rec_offs_init(offsets_);
@ -5892,7 +5892,7 @@ btr_cur_pessimistic_delete(
bool success;
ibool ret = FALSE;
mem_heap_t* heap;
ulint* offsets;
offset_t* offsets;
#ifdef UNIV_DEBUG
bool parent_latched = false;
#endif /* UNIV_DEBUG */
@ -6044,7 +6044,7 @@ discard_page:
rtr_mbr_t father_mbr;
rec_t* father_rec;
btr_cur_t father_cursor;
ulint* offsets;
offset_t* offsets;
bool upd_ret;
ulint len;
@ -6790,7 +6790,7 @@ btr_record_not_null_field_in_rec(
ulint n_unique, /*!< in: dict_index_get_n_unique(index),
number of columns uniquely determine
an index entry */
const ulint* offsets, /*!< in: rec_get_offsets(rec, index),
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index),
its size could be for all fields or
that of "n_unique" */
ib_uint64_t* n_not_null) /*!< in/out: array to record number of
@ -6844,8 +6844,8 @@ btr_estimate_number_of_different_key_vals(
uintmax_t add_on;
mtr_t mtr;
mem_heap_t* heap = NULL;
ulint* offsets_rec = NULL;
ulint* offsets_next_rec = NULL;
offset_t* offsets_rec = NULL;
offset_t* offsets_next_rec = NULL;
/* For spatial index, there is no such stats can be
fetched. */
@ -7033,7 +7033,7 @@ btr_estimate_number_of_different_key_vals(
and assign the old offsets_rec buffer to
offsets_next_rec. */
{
ulint* offsets_tmp = offsets_rec;
offset_t* offsets_tmp = offsets_rec;
offsets_rec = offsets_next_rec;
offsets_next_rec = offsets_tmp;
}
@ -7118,7 +7118,7 @@ static
ulint
btr_rec_get_field_ref_offs(
/*=======================*/
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: index of the external field */
{
ulint field_ref_offs;
@ -7147,7 +7147,7 @@ btr_rec_get_field_ref_offs(
ulint
btr_rec_get_externally_stored_len(
const rec_t* rec,
const ulint* offsets)
const offset_t* offsets)
{
ulint n_fields;
ulint total_extern_len = 0;
@ -7186,7 +7186,7 @@ btr_cur_set_ownership_of_extern_field(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: clustered index record */
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint i, /*!< in: field number */
ibool val, /*!< in: value to set */
mtr_t* mtr) /*!< in: mtr, or NULL if not logged */
@ -7236,7 +7236,7 @@ btr_cur_disown_inherited_fields(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
@ -7267,7 +7267,7 @@ btr_cur_unmark_extern_fields(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
mtr_t* mtr) /*!< in: mtr, or NULL if not logged */
{
ulint n;
@ -7444,7 +7444,7 @@ struct btr_blob_log_check_t {
/** Mini transaction holding the latches for m_pcur */
mtr_t* m_mtr;
/** rec_get_offsets(rec, index); offset of clust_rec */
const ulint* m_offsets;
const offset_t* m_offsets;
/** The block containing clustered record */
buf_block_t** m_block;
/** The clustered record pointer */
@ -7464,7 +7464,7 @@ struct btr_blob_log_check_t {
btr_blob_log_check_t(
btr_pcur_t* pcur,
mtr_t* mtr,
const ulint* offsets,
const offset_t* offsets,
buf_block_t** block,
rec_t** rec,
enum blob_op op)
@ -7535,7 +7535,7 @@ struct btr_blob_log_check_t {
*m_rec = btr_pcur_get_rec(m_pcur);
rec_offs_make_valid(*m_rec, index, true,
const_cast<ulint*>(m_offsets));
const_cast<offset_t*>(m_offsets));
ut_ad(m_mtr->memo_contains_page_flagged(
*m_rec,
@ -7566,7 +7566,7 @@ btr_store_big_rec_extern_fields(
btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if
btr_mtr is restarted, then this can
be repositioned. */
ulint* offsets, /*!< in/out: rec_get_offsets() on
offset_t* offsets, /*!< in/out: rec_get_offsets() on
pcur. the "external storage" flags
in offsets will correctly correspond
to rec when this function returns */
@ -8076,7 +8076,7 @@ btr_free_externally_stored_field(
byte* field_ref, /*!< in/out: field reference */
const rec_t* rec, /*!< in: record containing field_ref, for
page_zip_write_blob_ptr(), or NULL */
const ulint* offsets, /*!< in: rec_get_offsets(rec, index),
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index),
or NULL */
page_zip_des_t* page_zip, /*!< in: compressed page corresponding
to rec, or NULL if rec == NULL */
@ -8249,7 +8249,7 @@ btr_rec_free_externally_stored_fields(
dict_index_t* index, /*!< in: index of the data, the index
tree MUST be X-latched */
rec_t* rec, /*!< in/out: record */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
part will be updated, or NULL */
bool rollback,/*!< in: performing rollback? */
@ -8290,7 +8290,7 @@ btr_rec_free_updated_extern_fields(
rec_t* rec, /*!< in/out: record */
page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
part will be updated, or NULL */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const upd_t* update, /*!< in: update vector */
bool rollback,/*!< in: performing rollback? */
mtr_t* mtr) /*!< in: mini-transaction handle which contains
@ -8687,7 +8687,7 @@ protected by a lock or a page latch
byte*
btr_rec_copy_externally_stored_field(
const rec_t* rec,
const ulint* offsets,
const offset_t* offsets,
ulint zip_size,
ulint no,
ulint* len,

View file

@ -338,8 +338,8 @@ btr_defragment_calc_n_recs_for_size(
{
page_t* page = buf_block_get_frame(block);
ulint n_recs = 0;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
mem_heap_t* heap = NULL;
ulint size = 0;

View file

@ -326,16 +326,21 @@ btr_pcur_restore_position_func(
if (cursor->rel_pos == BTR_PCUR_ON) {
#ifdef UNIV_DEBUG
const rec_t* rec;
const ulint* offsets1;
const ulint* offsets2;
offset_t offsets1_[REC_OFFS_NORMAL_SIZE];
offset_t offsets2_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets1 = offsets1_;
offset_t* offsets2 = offsets2_;
rec = btr_pcur_get_rec(cursor);
rec_offs_init(offsets1_);
rec_offs_init(offsets2_);
heap = mem_heap_create(256);
offsets1 = rec_get_offsets(
cursor->old_rec, index, NULL, true,
cursor->old_rec, index, offsets1, true,
cursor->old_n_fields, &heap);
offsets2 = rec_get_offsets(
rec, index, NULL, true,
rec, index, offsets2, true,
cursor->old_n_fields, &heap);
ut_ad(!cmp_rec_rec(cursor->old_rec,
@ -394,11 +399,13 @@ btr_pcur_restore_position_func(
ut_ad(cursor->rel_pos == BTR_PCUR_ON
|| cursor->rel_pos == BTR_PCUR_BEFORE
|| cursor->rel_pos == BTR_PCUR_AFTER);
offset_t offsets[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets);
if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor)
&& !cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets(btr_pcur_get_rec(cursor),
index, NULL, true,
index, offsets, true,
ULINT_UNDEFINED, &heap))) {
/* We have to store the NEW value for the modify clock,

View file

@ -478,7 +478,7 @@ btr_pessimistic_scrub(
/* arguments to btr_page_split_and_insert */
mem_heap_t* heap = NULL;
dtuple_t* entry = NULL;
ulint* offsets = NULL;
offset_t* offsets = NULL;
ulint n_ext = 0;
ulint flags = BTR_MODIFY_TREE;

View file

@ -97,7 +97,7 @@ static inline
ulint
rec_fold(
const rec_t* rec,
const ulint* offsets,
const offset_t* offsets,
ulint n_fields,
ulint n_bytes,
index_id_t tree_id)
@ -669,7 +669,7 @@ btr_search_update_hash_ref(
&& (block->curr_n_bytes == info->n_bytes)
&& (block->curr_left_side == info->left_side)) {
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_);
rec = btr_cur_get_rec(cursor);
@ -722,8 +722,8 @@ btr_search_check_guess(
ulint match;
int cmp;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
ibool success = FALSE;
rec_offs_init(offsets_);
@ -1082,7 +1082,7 @@ void btr_search_drop_page_hash_index(buf_block_t* block)
ulint i;
mem_heap_t* heap;
const dict_index_t* index;
ulint* offsets;
offset_t* offsets;
rw_lock_t* latch;
btr_search_t* info;
@ -1337,8 +1337,8 @@ btr_search_build_page_hash_index(
const rec_t** recs;
ulint i;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
#ifdef MYSQL_INDEX_DISABLE_AHI
if (index->disable_ahi) return;
@ -1642,7 +1642,7 @@ void btr_search_update_hash_on_delete(btr_cur_t* cursor)
const rec_t* rec;
ulint fold;
dict_index_t* index;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
mem_heap_t* heap = NULL;
rec_offs_init(offsets_);
@ -1797,8 +1797,8 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch)
ibool left_side;
bool locked = false;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(ahi_latch == btr_get_search_latch(cursor->index));
@ -1955,8 +1955,8 @@ btr_search_hash_table_validate(ulint hash_table_id)
ulint i;
ulint cell_count;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
if (!btr_search_enabled) {
return(TRUE);

View file

@ -1280,7 +1280,7 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len)
bool
dict_index_t::vers_history_row(
const rec_t* rec,
const ulint* offsets)
const offset_t* offsets)
{
ut_ad(is_primary());
@ -1311,8 +1311,8 @@ dict_index_t::vers_history_row(
bool error = false;
mem_heap_t* heap = NULL;
dict_index_t* clust_index = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
mtr_t mtr;

View file

@ -1010,8 +1010,8 @@ dict_stats_analyze_index_level(
bool prev_rec_is_copied;
byte* prev_rec_buf = NULL;
ulint prev_rec_buf_size = 0;
ulint* rec_offsets;
ulint* prev_rec_offsets;
offset_t* rec_offsets;
offset_t* prev_rec_offsets;
ulint i;
DEBUG_PRINTF(" %s(table=%s, index=%s, level=" ULINTPF ")\n",
@ -1032,9 +1032,9 @@ dict_stats_analyze_index_level(
i = (REC_OFFS_HEADER_SIZE + 1 + 1) + n_uniq;
heap = mem_heap_create((2 * sizeof *rec_offsets) * i);
rec_offsets = static_cast<ulint*>(
rec_offsets = static_cast<offset_t*>(
mem_heap_alloc(heap, i * sizeof *rec_offsets));
prev_rec_offsets = static_cast<ulint*>(
prev_rec_offsets = static_cast<offset_t*>(
mem_heap_alloc(heap, i * sizeof *prev_rec_offsets));
rec_offs_set_n_alloc(rec_offsets, i);
rec_offs_set_n_alloc(prev_rec_offsets, i);
@ -1327,11 +1327,11 @@ to the number of externally stored pages which were encountered
@return offsets1 or offsets2 (the offsets of *out_rec),
or NULL if the page is empty and does not contain user records. */
UNIV_INLINE
ulint*
offset_t*
dict_stats_scan_page(
const rec_t** out_rec,
ulint* offsets1,
ulint* offsets2,
offset_t* offsets1,
offset_t* offsets2,
const dict_index_t* index,
const page_t* page,
ulint n_prefix,
@ -1339,8 +1339,8 @@ dict_stats_scan_page(
ib_uint64_t* n_diff,
ib_uint64_t* n_external_pages)
{
ulint* offsets_rec = offsets1;
ulint* offsets_next_rec = offsets2;
offset_t* offsets_rec = offsets1;
offset_t* offsets_next_rec = offsets2;
const rec_t* rec;
const rec_t* next_rec;
/* A dummy heap, to be passed to rec_get_offsets().
@ -1406,23 +1406,16 @@ dict_stats_scan_page(
}
rec = next_rec;
{
/* Assign offsets_rec = offsets_next_rec
so that offsets_rec matches with rec which
was just assigned rec = next_rec above.
Also need to point offsets_next_rec to the
place where offsets_rec was pointing before
because we have just 2 placeholders where
data is actually stored:
offsets1 and offsets2 and we
are using them in circular fashion
(offsets[_next]_rec are just pointers to
those placeholders). */
ulint* offsets_tmp;
offsets_tmp = offsets_rec;
offsets_rec = offsets_next_rec;
offsets_next_rec = offsets_tmp;
}
/* Assign offsets_rec = offsets_next_rec so that
offsets_rec matches with rec which was just assigned
rec = next_rec above. Also need to point
offsets_next_rec to the place where offsets_rec was
pointing before because we have just 2 placeholders
where data is actually stored: offsets1 and offsets2
and we are using them in circular fashion
(offsets[_next]_rec are just pointers to those
placeholders). */
std::swap(offsets_rec, offsets_next_rec);
if (should_count_external_pages) {
*n_external_pages += btr_rec_get_externally_stored_len(
@ -1461,9 +1454,9 @@ dict_stats_analyze_index_below_cur(
const page_t* page;
mem_heap_t* heap;
const rec_t* rec;
ulint* offsets1;
ulint* offsets2;
ulint* offsets_rec;
offset_t* offsets1;
offset_t* offsets2;
offset_t* offsets_rec;
ulint size;
mtr_t mtr;
@ -1481,10 +1474,10 @@ dict_stats_analyze_index_below_cur(
heap = mem_heap_create(size * (sizeof *offsets1 + sizeof *offsets2));
offsets1 = static_cast<ulint*>(mem_heap_alloc(
offsets1 = static_cast<offset_t*>(mem_heap_alloc(
heap, size * sizeof *offsets1));
offsets2 = static_cast<ulint*>(mem_heap_alloc(
offsets2 = static_cast<offset_t*>(mem_heap_alloc(
heap, size * sizeof *offsets2));
rec_offs_set_n_alloc(offsets1, size);
@ -1742,8 +1735,8 @@ dict_stats_analyze_index_for_n_prefix(
ut_a(left <= right);
ut_a(right <= last_idx_on_level);
const ulint rnd = right == left ? 0 :
ut_rnd_gen_ulint() % (right - left);
const ulint rnd = ut_rnd_interval(
static_cast<ulint>(right - left));
const ib_uint64_t dive_below_idx
= boundaries->at(static_cast<unsigned>(left + rnd));

View file

@ -30,9 +30,6 @@ Created 12/29/1997 Heikki Tuuri
#include "row0sel.h"
#include "rem0cmp.h"
/** The RND function seed */
static ulint eval_rnd = 128367121;
/** Dummy adress used when we should allocate a buffer of size 0 in
eval_node_alloc_val_buf */
@ -310,119 +307,17 @@ eval_aggregate(
/*===========*/
func_node_t* node) /*!< in: aggregate operation node */
{
que_node_t* arg;
lint val;
lint arg_val;
int func;
ut_ad(que_node_get_type(node) == QUE_NODE_FUNC);
val = eval_node_get_int_val(node);
func = node->func;
if (func == PARS_COUNT_TOKEN) {
val = val + 1;
} else {
ut_ad(func == PARS_SUM_TOKEN);
arg = node->args;
arg_val = eval_node_get_int_val(arg);
val = val + arg_val;
}
ut_a(node->func == PARS_COUNT_TOKEN);
val = val + 1;
eval_node_set_int_val(node, val);
}
/*****************************************************************//**
Evaluates a predefined function node where the function is not relevant
in benchmarks. */
static
void
eval_predefined_2(
/*==============*/
func_node_t* func_node) /*!< in: predefined function node */
{
que_node_t* arg;
que_node_t* arg1;
que_node_t* arg2 = 0; /* remove warning (??? bug ???) */
lint int_val;
byte* data;
ulint len1;
ulint len2;
int func;
ulint i;
ut_ad(que_node_get_type(func_node) == QUE_NODE_FUNC);
arg1 = func_node->args;
if (arg1) {
arg2 = que_node_get_next(arg1);
}
func = func_node->func;
if (func == PARS_PRINTF_TOKEN) {
arg = arg1;
while (arg) {
dfield_print(que_node_get_val(arg));
arg = que_node_get_next(arg);
}
putc('\n', stderr);
} else if (func == PARS_ASSERT_TOKEN) {
if (!eval_node_get_ibool_val(arg1)) {
fputs("SQL assertion fails in a stored procedure!\n",
stderr);
}
ut_a(eval_node_get_ibool_val(arg1));
/* This function, or more precisely, a debug procedure,
returns no value */
} else if (func == PARS_RND_TOKEN) {
len1 = (ulint) eval_node_get_int_val(arg1);
len2 = (ulint) eval_node_get_int_val(arg2);
ut_ad(len2 >= len1);
if (len2 > len1) {
int_val = (lint) (len1
+ (eval_rnd % (len2 - len1 + 1)));
} else {
int_val = (lint) len1;
}
eval_rnd = ut_rnd_gen_next_ulint(eval_rnd);
eval_node_set_int_val(func_node, int_val);
} else if (func == PARS_RND_STR_TOKEN) {
len1 = (ulint) eval_node_get_int_val(arg1);
data = eval_node_ensure_val_buf(func_node, len1);
for (i = 0; i < len1; i++) {
data[i] = (byte)(97 + (eval_rnd % 3));
eval_rnd = ut_rnd_gen_next_ulint(eval_rnd);
}
} else {
ut_error;
}
}
/*****************************************************************//**
Evaluates a notfound-function node. */
UNIV_INLINE
@ -493,46 +388,6 @@ eval_substr(
dfield_set_data(dfield, str1 + len1, len2);
}
/*****************************************************************//**
Evaluates a replstr-procedure node. */
static
void
eval_replstr(
/*=========*/
func_node_t* func_node) /*!< in: function node */
{
que_node_t* arg1;
que_node_t* arg2;
que_node_t* arg3;
que_node_t* arg4;
byte* str1;
byte* str2;
ulint len1;
ulint len2;
arg1 = func_node->args;
arg2 = que_node_get_next(arg1);
ut_ad(que_node_get_type(arg1) == QUE_NODE_SYMBOL);
arg3 = que_node_get_next(arg2);
arg4 = que_node_get_next(arg3);
str1 = static_cast<byte*>(dfield_get_data(que_node_get_val(arg1)));
str2 = static_cast<byte*>(dfield_get_data(que_node_get_val(arg2)));
len1 = (ulint) eval_node_get_int_val(arg3);
len2 = (ulint) eval_node_get_int_val(arg4);
if ((dfield_get_len(que_node_get_val(arg1)) < len1 + len2)
|| (dfield_get_len(que_node_get_val(arg2)) < len2)) {
ut_error;
}
ut_memcpy(str1 + len1, str2, len2);
}
/*****************************************************************//**
Evaluates an instr-function node. */
static
@ -605,44 +460,6 @@ match_found:
eval_node_set_int_val(func_node, int_val);
}
/*****************************************************************//**
Evaluates a predefined function node. */
UNIV_INLINE
void
eval_binary_to_number(
/*==================*/
func_node_t* func_node) /*!< in: function node */
{
que_node_t* arg1;
dfield_t* dfield;
byte* str1;
byte* str2;
ulint len1;
ulint int_val;
arg1 = func_node->args;
dfield = que_node_get_val(arg1);
str1 = static_cast<byte*>(dfield_get_data(dfield));
len1 = dfield_get_len(dfield);
if (len1 > 4) {
ut_error;
}
if (len1 == 4) {
str2 = str1;
} else {
int_val = 0;
str2 = (byte*) &int_val;
ut_memcpy(str2 + (4 - len1), str1, len1);
}
eval_node_copy_and_alloc_val(func_node, str2, 4);
}
/*****************************************************************//**
Evaluates a predefined function node. */
static
@ -734,95 +551,12 @@ eval_to_binary(
}
/*****************************************************************//**
Evaluates a predefined function node. */
UNIV_INLINE
void
eval_predefined(
/*============*/
func_node_t* func_node) /*!< in: function node */
Evaluate LENGTH(). */
inline void eval_length(func_node_t* func_node)
{
que_node_t* arg1;
lint int_val;
byte* data;
int func;
func = func_node->func;
arg1 = func_node->args;
if (func == PARS_LENGTH_TOKEN) {
int_val = (lint) dfield_get_len(que_node_get_val(arg1));
} else if (func == PARS_TO_CHAR_TOKEN) {
/* Convert number to character string as a
signed decimal integer. */
ulint uint_val;
int int_len;
int_val = eval_node_get_int_val(arg1);
/* Determine the length of the string. */
if (int_val == 0) {
int_len = 1; /* the number 0 occupies 1 byte */
} else {
int_len = 0;
if (int_val < 0) {
uint_val = ((ulint) -int_val - 1) + 1;
int_len++; /* reserve space for minus sign */
} else {
uint_val = (ulint) int_val;
}
for (; uint_val > 0; int_len++) {
uint_val /= 10;
}
}
/* allocate the string */
data = eval_node_ensure_val_buf(func_node, ulint(int_len) + 1);
/* add terminating NUL character */
data[int_len] = 0;
/* convert the number */
if (int_val == 0) {
data[0] = '0';
} else {
int tmp;
if (int_val < 0) {
data[0] = '-'; /* preceding minus sign */
uint_val = ((ulint) -int_val - 1) + 1;
} else {
uint_val = (ulint) int_val;
}
for (tmp = int_len; uint_val > 0; uint_val /= 10) {
data[--tmp] = (byte)
('0' + (byte)(uint_val % 10));
}
}
dfield_set_len(que_node_get_val(func_node), ulint(int_len));
return;
} else if (func == PARS_TO_NUMBER_TOKEN) {
int_val = atoi((char*)
dfield_get_data(que_node_get_val(arg1)));
} else if (func == PARS_SYSDATE_TOKEN) {
int_val = (lint) time(NULL);
} else {
eval_predefined_2(func_node);
return;
}
eval_node_set_int_val(func_node, int_val);
eval_node_set_int_val(func_node,
dfield_get_len(que_node_get_val
(func_node->args)));
}
/*****************************************************************//**
@ -851,8 +585,7 @@ eval_func(
if (dfield_is_null(que_node_get_val(arg))
&& (fclass != PARS_FUNC_CMP)
&& (func != PARS_NOTFOUND_TOKEN)
&& (func != PARS_PRINTF_TOKEN)) {
&& (func != PARS_NOTFOUND_TOKEN)) {
ut_error;
}
@ -877,24 +610,20 @@ eval_func(
case PARS_SUBSTR_TOKEN:
eval_substr(func_node);
return;
case PARS_REPLSTR_TOKEN:
eval_replstr(func_node);
return;
case PARS_INSTR_TOKEN:
eval_instr(func_node);
return;
case PARS_BINARY_TO_NUMBER_TOKEN:
eval_binary_to_number(func_node);
return;
case PARS_CONCAT_TOKEN:
eval_concat(func_node);
return;
case PARS_TO_BINARY_TOKEN:
eval_to_binary(func_node);
return;
default:
eval_predefined(func_node);
case PARS_LENGTH_TOKEN:
eval_length(func_node);
return;
default:
ut_error;
}
case PARS_FUNC_LOGICAL:
eval_logical(func_node);

View file

@ -3202,7 +3202,7 @@ fts_fetch_doc_from_rec(
dict_index_t* clust_index, /*!< in: cluster index */
btr_pcur_t* pcur, /*!< in: cursor whose position
has been stored */
ulint* offsets, /*!< in: offsets */
offset_t* offsets, /*!< in: offsets */
fts_doc_t* doc) /*!< out: fts doc to hold parsed
documents */
{
@ -3476,7 +3476,7 @@ fts_add_doc_by_id(
btr_pcur_t* doc_pcur;
const rec_t* clust_rec;
btr_pcur_t clust_pcur;
ulint* offsets = NULL;
offset_t* offsets = NULL;
ulint num_idx = ib_vector_size(cache->get_docs);
rec = btr_pcur_get_rec(&pcur);
@ -5153,7 +5153,7 @@ doc_id_t
fts_get_doc_id_from_rec(
const rec_t* rec,
const dict_index_t* index,
const ulint* offsets)
const offset_t* offsets)
{
ulint f = dict_col_get_index_pos(
&index->table->cols[index->table->fts->doc_col], index);

View file

@ -434,26 +434,6 @@ pick_seeds(
}
}
/*********************************************************//**
Generates a random iboolean value.
@return the random value */
static
ibool
ut_rnd_gen_ibool(void)
/*=================*/
{
ulint x;
x = ut_rnd_gen_ulint();
if (((x >> 20) + (x >> 15)) & 1) {
return(TRUE);
}
return(FALSE);
}
/*************************************************************//**
Select next node and group where to add. */
static
@ -490,8 +470,7 @@ pick_next(
/* Introduce some randomness if the record
is identical */
if (diff == 0) {
diff = static_cast<double>(
ut_rnd_gen_ibool());
diff = static_cast<double>(ut_rnd_gen() & 1);
}
*n_group = 1 + (diff > 0);

View file

@ -51,7 +51,7 @@ rtr_page_split_initialize_nodes(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
ulint** offsets,/*!< in: offsets on inserted record */
offset_t** offsets,/*!< in: offsets on inserted record */
const dtuple_t* tuple, /*!< in: tuple to insert */
double** buf_pos)/*!< in/out: current buffer position */
{
@ -192,7 +192,7 @@ rtr_update_mbr_field_in_place(
/*==========================*/
dict_index_t* index, /*!< in: spatial index. */
rec_t* rec, /*!< in/out: rec to be modified.*/
ulint* offsets, /*!< in/out: offsets on rec. */
offset_t* offsets, /*!< in/out: offsets on rec. */
rtr_mbr_t* mbr, /*!< in: the new mbr. */
mtr_t* mtr) /*!< in: mtr */
{
@ -266,7 +266,7 @@ bool
rtr_update_mbr_field(
/*=================*/
btr_cur_t* cursor, /*!< in/out: cursor pointed to rec.*/
ulint* offsets, /*!< in/out: offsets on rec. */
offset_t* offsets, /*!< in/out: offsets on rec. */
btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec
that should be deleted.
this cursor is for btr_compress to
@ -295,7 +295,7 @@ rtr_update_mbr_field(
bool ins_suc = true;
ulint cur2_pos = 0;
ulint del_page_no = 0;
ulint* offsets2;
offset_t* offsets2;
rec = btr_cur_get_rec(cursor);
page = page_align(rec);
@ -382,7 +382,7 @@ rtr_update_mbr_field(
}
if (cursor2) {
ulint* offsets2;
offset_t* offsets2;
if (page_zip) {
cursor2->page_cur.rec
@ -404,7 +404,7 @@ rtr_update_mbr_field(
page_cur_t page_cur;
rec_t* insert_rec;
ulint* insert_offsets = NULL;
offset_t* insert_offsets = NULL;
ulint old_pos;
rec_t* old_rec;
@ -436,7 +436,7 @@ update_mbr:
/* When there're not only 1 rec in the page, we do delete/insert
to avoid page split. */
rec_t* insert_rec;
ulint* insert_offsets = NULL;
offset_t* insert_offsets = NULL;
rec_t* next_rec;
/* Delete the rec which cursor point to. */
@ -636,7 +636,7 @@ rtr_adjust_upper_level(
page_zip_des_t* new_page_zip;
dict_index_t* index = sea_cur->index;
btr_cur_t cursor;
ulint* offsets;
offset_t* offsets;
mem_heap_t* heap;
ulint level;
dtuple_t* node_ptr_upper;
@ -801,8 +801,8 @@ rtr_split_page_move_rec_list(
page_cur_t new_page_cursor;
page_t* page;
page_t* new_page;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
page_zip_des_t* new_page_zip
= buf_block_get_page_zip(new_block);
rec_t* rec;
@ -962,7 +962,7 @@ rtr_page_split_and_insert(
btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
ulint** offsets,/*!< out: offsets on inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -1311,7 +1311,7 @@ rtr_ins_enlarge_mbr(
mem_heap_t* heap;
dict_index_t* index = btr_cur->index;
page_cur_t* page_cursor;
ulint* offsets;
offset_t* offsets;
node_visit_t* node_visit;
btr_cur_t cursor;
page_t* page;
@ -1395,10 +1395,10 @@ rtr_page_copy_rec_list_end_no_locks(
page_cur_t page_cur;
page_cur_t cur1;
rec_t* cur_rec;
ulint offsets_1[REC_OFFS_NORMAL_SIZE];
ulint* offsets1 = offsets_1;
ulint offsets_2[REC_OFFS_NORMAL_SIZE];
ulint* offsets2 = offsets_2;
offset_t offsets_1[REC_OFFS_NORMAL_SIZE];
offset_t* offsets1 = offsets_1;
offset_t offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets_2;
ulint moved = 0;
bool is_leaf = page_is_leaf(new_page);
@ -1522,10 +1522,10 @@ rtr_page_copy_rec_list_start_no_locks(
{
page_cur_t cur1;
rec_t* cur_rec;
ulint offsets_1[REC_OFFS_NORMAL_SIZE];
ulint* offsets1 = offsets_1;
ulint offsets_2[REC_OFFS_NORMAL_SIZE];
ulint* offsets2 = offsets_2;
offset_t offsets_1[REC_OFFS_NORMAL_SIZE];
offset_t* offsets1 = offsets_1;
offset_t offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets_2;
page_cur_t page_cur;
ulint moved = 0;
bool is_leaf = page_is_leaf(buf_block_get_frame(block));
@ -1634,8 +1634,8 @@ rtr_merge_mbr_changed(
/*==================*/
btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
ulint* offsets, /*!< in: rec offsets */
ulint* offsets2, /*!< in: rec offsets */
offset_t* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */
rtr_mbr_t* new_mbr) /*!< out: MBR to update */
{
double* mbr;
@ -1678,8 +1678,8 @@ rtr_merge_and_update_mbr(
/*=====================*/
btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
ulint* offsets, /*!< in: rec offsets */
ulint* offsets2, /*!< in: rec offsets */
offset_t* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */
page_t* child_page, /*!< in: the page. */
mtr_t* mtr) /*!< in: mtr */
{
@ -1742,7 +1742,7 @@ rtr_check_same_block(
{
ulint page_no = childb->page.id.page_no();
ulint* offsets;
offset_t* offsets;
rec_t* rec = page_rec_get_next(page_get_infimum_rec(
buf_block_get_frame(parentb)));
@ -1773,7 +1773,7 @@ rtr_rec_cal_increase(
dtuple in some of the common fields, or which
has an equal number or more fields than
dtuple */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
double* area) /*!< out: increased area */
{
const dfield_t* dtuple_field;

View file

@ -526,7 +526,7 @@ rtr_compare_cursor_rec(
mem_heap_t** heap) /*!< in: memory heap */
{
const rec_t* rec;
ulint* offsets;
offset_t* offsets;
rec = btr_cur_get_rec(cursor);
@ -668,7 +668,7 @@ rtr_page_get_father(
{
mem_heap_t* heap = mem_heap_create(100);
#ifdef UNIV_DEBUG
ulint* offsets;
offset_t* offsets;
offsets = rtr_page_get_father_block(
NULL, heap, index, block, mtr, sea_cur, cursor);
@ -689,9 +689,9 @@ rtr_page_get_father(
that mtr holds an SX-latch or X-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
ulint*
offset_t*
rtr_page_get_father_node_ptr(
ulint* offsets,/*!< in: work area for the return value */
offset_t* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* sea_cur,/*!< in: search cursor */
btr_cur_t* cursor, /*!< in: cursor pointing to user record,
@ -784,10 +784,10 @@ rtr_page_get_father_node_ptr(
Returns the father block to a page. It is assumed that mtr holds
an X or SX latch on the tree.
@return rec_get_offsets() of the node pointer record */
ulint*
offset_t*
rtr_page_get_father_block(
/*======================*/
ulint* offsets,/*!< in: work area for the return value */
offset_t* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
@ -1288,8 +1288,8 @@ rtr_cur_restore_position(
#ifdef UNIV_DEBUG
do {
const rec_t* rec;
const ulint* offsets1;
const ulint* offsets2;
const offset_t* offsets1;
const offset_t* offsets2;
ulint comp;
rec = btr_pcur_get_rec(r_cursor);
@ -1360,8 +1360,8 @@ search_again:
if (low_match == r_cursor->old_n_fields) {
const rec_t* rec;
const ulint* offsets1;
const ulint* offsets2;
const offset_t* offsets1;
const offset_t* offsets2;
ulint comp;
rec = btr_pcur_get_rec(r_cursor);
@ -1407,7 +1407,7 @@ rtr_leaf_push_match_rec(
/*====================*/
const rec_t* rec, /*!< in: record to copy */
rtr_info_t* rtr_info, /*!< in/out: search stack */
ulint* offsets, /*!< in: offsets */
offset_t* offsets, /*!< in: offsets */
bool is_comp) /*!< in: is compact format */
{
byte* buf;
@ -1592,7 +1592,7 @@ void
rtr_get_mbr_from_rec(
/*=================*/
const rec_t* rec, /*!< in: data tuple */
const ulint* offsets,/*!< in: offsets array */
const offset_t* offsets,/*!< in: offsets array */
rtr_mbr_t* mbr) /*!< out MBR */
{
ulint rec_f_len;
@ -1639,8 +1639,8 @@ rtr_cur_search_with_match(
const page_t* page;
const rec_t* rec;
const rec_t* last_rec;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
mem_heap_t* heap = NULL;
int cmp = 1;
double least_inc = DBL_MAX;
@ -1923,8 +1923,8 @@ rtr_cur_search_with_match(
test_rec = match_rec->matched_recs->back();
#ifdef UNIV_DEBUG
ulint offsets_2[REC_OFFS_NORMAL_SIZE];
ulint* offsets2 = offsets_2;
offset_t offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets_2;
rec_offs_init(offsets_2);
ut_ad(found);

View file

@ -3181,7 +3181,7 @@ innobase_rec_to_mysql(
struct TABLE* table, /*!< in/out: MySQL table */
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: index */
const ulint* offsets)/*!< in: rec_get_offsets(
const offset_t* offsets)/*!< in: rec_get_offsets(
rec, index, ...) */
{
uint n_fields = table->s->fields;
@ -5845,7 +5845,7 @@ add_all_virtual:
ut_ad(j == n + f);
ulint* offsets = NULL;
offset_t* offsets = NULL;
mem_heap_t* offsets_heap = NULL;
big_rec_t* big_rec;
err = btr_cur_pessimistic_update(

View file

@ -3280,7 +3280,7 @@ ibuf_insert_low(
dtuple_t* ibuf_entry;
mem_heap_t* offsets_heap = NULL;
mem_heap_t* heap;
ulint* offsets = NULL;
offset_t* offsets = NULL;
ulint buffered;
lint min_n_recs;
rec_t* ins_rec;
@ -3734,7 +3734,7 @@ ibuf_insert_to_index_page_low(
buf_block_t* block, /*!< in/out: index page where the buffered
entry should be placed */
dict_index_t* index, /*!< in: record descriptor */
ulint** offsets,/*!< out: offsets on *rec */
offset_t** offsets,/*!< out: offsets on *rec */
mem_heap_t* heap, /*!< in/out: memory heap */
mtr_t* mtr, /*!< in/out: mtr */
page_cur_t* page_cur)/*!< in/out: cursor positioned on the record
@ -3814,7 +3814,7 @@ ibuf_insert_to_index_page(
ulint low_match;
page_t* page = buf_block_get_frame(block);
rec_t* rec;
ulint* offsets;
offset_t* offsets;
mem_heap_t* heap;
DBUG_ENTER("ibuf_insert_to_index_page");
@ -4071,8 +4071,8 @@ ibuf_delete(
/* TODO: the below should probably be a separate function,
it's a bastardized version of btr_cur_optimistic_delete. */
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
mem_heap_t* heap = NULL;
ulint max_ins_size = 0;

View file

@ -30,6 +30,7 @@ Created 6/2/1994 Heikki Tuuri
#include "dict0dict.h"
#include "data0data.h"
#include "rem0types.h"
#include "page0cur.h"
#include "btr0types.h"
#include "gis0type.h"
@ -315,7 +316,7 @@ ulint
btr_node_ptr_get_child_page_no(
/*===========================*/
const rec_t* rec, /*!< in: node pointer record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/** Create the root node for a new index tree.
@ -399,7 +400,7 @@ btr_root_raise_and_insert(
on the root page; when the function returns,
the cursor is positioned on the predecessor
of the inserted record */
ulint** offsets,/*!< out: offsets on inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
@ -482,7 +483,7 @@ btr_page_split_and_insert(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
ulint** offsets,/*!< out: offsets on inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */

View file

@ -193,7 +193,7 @@ ulint
btr_node_ptr_get_child_page_no(
/*===========================*/
const rec_t* rec, /*!< in: node pointer record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
{
const byte* field;
ulint len;

View file

@ -28,6 +28,7 @@ Created 03/11/2014 Shaohua Wang
#define btr0bulk_h
#include "dict0dict.h"
#include "rem0types.h"
#include "page0cur.h"
#include <vector>
@ -103,7 +104,7 @@ public:
/** Insert a record in the page.
@param[in] rec record
@param[in] offsets record offsets */
void insert(const rec_t* rec, ulint* offsets);
void insert(const rec_t* rec, offset_t* offsets);
/** Mark end of insertion to the page. Scan all records to set page
dirs, and set page header members. */
@ -127,7 +128,7 @@ public:
@param[in] big_rec external recrod
@param[in] offsets record offsets
@return error code */
dberr_t storeExt(const big_rec_t* big_rec, ulint* offsets);
dberr_t storeExt(const big_rec_t* big_rec, offset_t* offsets);
/** Get node pointer
@return node pointer */

View file

@ -30,6 +30,7 @@ Created 10/16/1994 Heikki Tuuri
#include "dict0dict.h"
#include "page0cur.h"
#include "btr0types.h"
#include "rem0types.h"
#include "gis0type.h"
#include "my_base.h"
@ -271,7 +272,7 @@ btr_cur_optimistic_insert(
specified */
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
offset_t** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
@ -307,7 +308,7 @@ btr_cur_pessimistic_insert(
insertion will certainly succeed */
btr_cur_t* cursor, /*!< in: cursor after which to insert;
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
offset_t** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
@ -341,7 +342,7 @@ btr_cur_update_alloc_zip_func(
page_cur_t* cursor, /*!< in/out: B-tree page cursor */
dict_index_t* index, /*!< in: the index corresponding to cursor */
#ifdef UNIV_DEBUG
ulint* offsets,/*!< in/out: offsets of the cursor record */
offset_t* offsets,/*!< in/out: offsets of the cursor record */
#endif /* UNIV_DEBUG */
ulint length, /*!< in: size needed */
bool create, /*!< in: true=delete-and-insert,
@ -368,7 +369,7 @@ btr_cur_update_in_place(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
ulint* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
offset_t* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index
updates */
@ -410,7 +411,7 @@ btr_cur_optimistic_update(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** heap, /*!< in/out: pointer to NULL or memory heap */
const upd_t* update, /*!< in: update vector; this must also
contain trx id and roll ptr fields */
@ -437,7 +438,7 @@ btr_cur_pessimistic_update(
btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
cursor may become invalid if *big_rec == NULL
|| !(flags & BTR_KEEP_POS_FLAG) */
ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
that can be emptied */
@ -469,7 +470,7 @@ btr_cur_del_mark_set_clust_rec(
buf_block_t* block, /*!< in/out: buffer block of the record */
rec_t* rec, /*!< in/out: record */
dict_index_t* index, /*!< in: clustered index of the record */
const ulint* offsets,/*!< in: rec_get_offsets(rec) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec) */
que_thr_t* thr, /*!< in: query thread */
const dtuple_t* entry, /*!< in: dtuple for the deleting record */
mtr_t* mtr) /*!< in/out: mini-transaction */
@ -636,7 +637,7 @@ btr_estimate_number_of_different_key_vals(
ulint
btr_rec_get_externally_stored_len(
const rec_t* rec,
const ulint* offsets);
const offset_t* offsets);
/*******************************************************************//**
Marks non-updated off-page fields as disowned by this record. The ownership
@ -650,7 +651,7 @@ btr_cur_disown_inherited_fields(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull(2,3,4,5,6)));
@ -689,7 +690,7 @@ btr_store_big_rec_extern_fields(
btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if
btr_mtr is restarted, then this can
be repositioned. */
ulint* offsets, /*!< in/out: rec_get_offsets() on
offset_t* offsets, /*!< in/out: rec_get_offsets() on
pcur. the "external storage" flags
in offsets will correctly correspond
to rec when this function returns */
@ -720,7 +721,7 @@ btr_free_externally_stored_field(
byte* field_ref, /*!< in/out: field reference */
const rec_t* rec, /*!< in: record containing field_ref, for
page_zip_write_blob_ptr(), or NULL */
const ulint* offsets, /*!< in: rec_get_offsets(rec, index),
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index),
or NULL */
page_zip_des_t* page_zip, /*!< in: compressed page corresponding
to rec, or NULL if rec == NULL */
@ -778,7 +779,7 @@ protected by a lock or a page latch
byte*
btr_rec_copy_externally_stored_field(
const rec_t* rec,
const ulint* offsets,
const offset_t* offsets,
ulint zip_size,
ulint no,
ulint* len,

View file

@ -946,10 +946,6 @@ a certain index.*/
system clustered index when there is no primary key. */
const char innobase_index_reserve_name[] = "GEN_CLUST_INDEX";
/* Estimated number of offsets in records (based on columns)
to start with. */
#define OFFS_IN_REC_NORMAL_SIZE 100
/** Data structure for an index. Most fields will be
initialized to 0, NULL or FALSE in dict_mem_index_create(). */
struct dict_index_t {
@ -1250,7 +1246,7 @@ struct dict_index_t {
@param[in] offsets offsets
@return true if row is historical */
bool
vers_history_row(const rec_t* rec, const ulint* offsets);
vers_history_row(const rec_t* rec, const offset_t* offsets);
/** Check if record in secondary index is historical row.
@param[in] rec record in a secondary index

View file

@ -592,7 +592,7 @@ doc_id_t
fts_get_doc_id_from_rec(
const rec_t* rec,
const dict_index_t* index,
const ulint* offsets);
const offset_t* offsets);
/** Add new fts doc id to the update vector.
@param[in] table the table that contains the FTS index.

View file

@ -28,6 +28,7 @@ Created 2013/03/27 Jimmy Yang and Allen Lai
#define gis0rtree_h
#include "btr0cur.h"
#include "rem0types.h"
/* Whether MBR 'a' contains 'b' */
#define MBR_CONTAIN_CMP(a, b) \
@ -88,7 +89,7 @@ rtr_page_split_and_insert(
btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
ulint** offsets,/*!< out: offsets on inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -150,7 +151,7 @@ rtr_rec_cal_increase(
dtuple in some of the common fields, or which
has an equal number or more fields than
dtuple */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
double* area); /*!< out: increased area */
/****************************************************************//**
@ -273,7 +274,7 @@ void
rtr_get_mbr_from_rec(
/*=================*/
const rec_t* rec, /*!< in: data tuple */
const ulint* offsets,/*!< in: offsets array */
const offset_t* offsets,/*!< in: offsets array */
rtr_mbr_t* mbr); /*!< out MBR */
/****************************************************************//**
@ -305,10 +306,10 @@ rtr_page_get_father(
Returns the father block to a page. It is assumed that mtr holds
an X or SX latch on the tree.
@return rec_get_offsets() of the node pointer record */
ulint*
offset_t*
rtr_page_get_father_block(
/*======================*/
ulint* offsets,/*!< in: work area for the return value */
offset_t* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
@ -415,8 +416,8 @@ rtr_merge_and_update_mbr(
/*=====================*/
btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
ulint* offsets, /*!< in: rec offsets */
ulint* offsets2, /*!< in: rec offsets */
offset_t* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */
page_t* child_page, /*!< in: the child page. */
mtr_t* mtr); /*!< in: mtr */
@ -436,8 +437,8 @@ rtr_merge_mbr_changed(
/*==================*/
btr_cur_t* cursor, /*!< in: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
ulint* offsets, /*!< in: rec offsets */
ulint* offsets2, /*!< in: rec offsets */
offset_t* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */
rtr_mbr_t* new_mbr); /*!< out: MBR to update */
@ -448,7 +449,7 @@ bool
rtr_update_mbr_field(
/*=================*/
btr_cur_t* cursor, /*!< in: cursor pointed to rec.*/
ulint* offsets, /*!< in: offsets on rec. */
offset_t* offsets, /*!< in: offsets on rec. */
btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec
that should be deleted.
this cursor is for btr_compress to

View file

@ -40,7 +40,7 @@ rtr_page_cal_mbr(
rec_t* rec;
const byte* field;
ulint len;
ulint* offsets = NULL;
offset_t* offsets = NULL;
double bmin, bmax;
double* amin;
double* amax;

View file

@ -22,6 +22,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
Smart ALTER TABLE
*******************************************************/
#include "rem0types.h"
/*************************************************************//**
Copies an InnoDB record to table->record[0]. */
void
@ -30,7 +32,7 @@ innobase_rec_to_mysql(
struct TABLE* table, /*!< in/out: MySQL table */
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: index */
const ulint* offsets)/*!< in: rec_get_offsets(
const offset_t* offsets)/*!< in: rec_get_offsets(
rec, index, ...) */
MY_ATTRIBUTE((nonnull));

View file

@ -300,7 +300,7 @@ lock_clust_rec_modify_check_and_lock(
const rec_t* rec, /*!< in: record which should be
modified */
dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**
@ -338,7 +338,7 @@ lock_sec_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: secondary index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@ -366,7 +366,7 @@ lock_clust_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@ -415,7 +415,7 @@ lock_clust_rec_cons_read_sees(
const rec_t* rec, /*!< in: user record which should be read or
passed over by a read cursor */
dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ReadView* view); /*!< in: consistent read view */
/*********************************************************************//**
Checks that a non-clustered index record is seen in a consistent read.
@ -547,7 +547,7 @@ lock_report_trx_id_insanity(
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index) */
trx_id_t max_trx_id); /*!< in: trx_sys.get_max_trx_id() */
/*********************************************************************//**
Prints info of locks for all transactions.
@ -772,7 +772,7 @@ lock_check_trx_id_sanity(
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
const ulint* offsets); /*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets); /*!< in: rec_get_offsets(rec, index) */
#ifdef UNIV_DEBUG
/*******************************************************************//**
Check if the transaction holds any locks on the sys tables

View file

@ -35,6 +35,7 @@ those functions in lock/ */
#endif
#include "hash0hash.h"
#include "rem0types.h"
#include "trx0trx.h"
#ifndef UINT32_MAX
@ -468,7 +469,7 @@ lock_clust_rec_some_has_impl(
/*=========================*/
const rec_t* rec, /*!< in: user record */
const dict_index_t* index, /*!< in: clustered index */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**

View file

@ -59,7 +59,7 @@ lock_clust_rec_some_has_impl(
/*=========================*/
const rec_t* rec, /*!< in: user record */
const dict_index_t* index, /*!< in: clustered index */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ut_ad(dict_index_is_clust(index));
ut_ad(page_rec_is_user_rec(rec));

View file

@ -29,6 +29,7 @@ Created 10/4/1994 Heikki Tuuri
#include "buf0types.h"
#include "page0page.h"
#include "rem0types.h"
#include "rem0rec.h"
#include "data0data.h"
#include "mtr0mtr.h"
@ -151,7 +152,7 @@ page_cur_tuple_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const dtuple_t* tuple, /*!< in: pointer to a data tuple */
dict_index_t* index, /*!< in: record descriptor */
ulint** offsets,/*!< out: offsets on *rec */
offset_t** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
@ -175,7 +176,7 @@ page_cur_rec_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const rec_t* rec, /*!< in: record to insert */
dict_index_t* index, /*!< in: record descriptor */
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr); /*!< in: mini-transaction handle, or NULL */
/***********************************************************//**
Inserts a record next to page cursor on an uncompressed page.
@ -189,7 +190,7 @@ page_cur_insert_rec_low(
which the new record is inserted */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result));
@ -211,7 +212,7 @@ page_cur_insert_rec_zip(
page_cur_t* cursor, /*!< in/out: page cursor */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result));
/*************************************************************//**
@ -237,7 +238,7 @@ page_cur_delete_rec(
/*================*/
page_cur_t* cursor, /*!< in/out: a page cursor */
const dict_index_t* index, /*!< in: record descriptor */
const ulint* offsets,/*!< in: rec_get_offsets(
const offset_t* offsets,/*!< in: rec_get_offsets(
cursor->rec, index) */
mtr_t* mtr); /*!< in: mini-transaction handle */
@ -385,14 +386,14 @@ page_delete_rec(
page_cur_t* pcur, /*!< in/out: page cursor on record
to delete */
page_zip_des_t* page_zip,/*!< in: compressed page descriptor */
const ulint* offsets);/*!< in: offsets for record */
const offset_t* offsets);/*!< in: offsets for record */
/** Index page cursor */
struct page_cur_t{
const dict_index_t* index;
rec_t* rec; /*!< pointer to a record on page */
ulint* offsets;
offset_t* offsets;
buf_block_t* block; /*!< pointer to the block containing rec */
};

View file

@ -254,7 +254,7 @@ page_cur_tuple_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const dtuple_t* tuple, /*!< in: pointer to a data tuple */
dict_index_t* index, /*!< in: record descriptor */
ulint** offsets,/*!< out: offsets on *rec */
offset_t** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
@ -308,7 +308,7 @@ page_cur_rec_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const rec_t* rec, /*!< in: record to insert */
dict_index_t* index, /*!< in: record descriptor */
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
{
if (buf_block_get_page_zip(cursor->block)) {

View file

@ -958,7 +958,7 @@ page_mem_free(
rec_t* rec, /*!< in: pointer to the (origin of)
record */
const dict_index_t* index, /*!< in: index of rec */
const ulint* offsets);/*!< in: array returned by
const offset_t* offsets);/*!< in: array returned by
rec_get_offsets() */
/** Read the PAGE_DIRECTION field from a byte.
@ -1205,7 +1205,7 @@ void
page_rec_print(
/*===========*/
const rec_t* rec, /*!< in: physical record */
const ulint* offsets);/*!< in: record descriptor */
const offset_t* offsets);/*!< in: record descriptor */
# ifdef UNIV_BTR_PRINT
/***************************************************************//**
This is used to print the contents of the directory for
@ -1252,7 +1252,7 @@ ibool
page_rec_validate(
/*==============*/
const rec_t* rec, /*!< in: physical record */
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets);/*!< in: array returned by rec_get_offsets() */
#ifdef UNIV_DEBUG
/***************************************************************//**
Checks that the first directory slot points to the infimum record and

View file

@ -996,7 +996,7 @@ page_mem_free(
rec_t* rec, /*!< in: pointer to the
(origin of) record */
const dict_index_t* index, /*!< in: index of rec */
const ulint* offsets) /*!< in: array returned by
const offset_t* offsets) /*!< in: array returned by
rec_get_offsets() */
{
rec_t* free;

View file

@ -28,6 +28,7 @@ Created 2/2/1994 Heikki Tuuri
#include "dict0types.h"
#include "mtr0types.h"
#include "rem0types.h"
#include <map>
@ -172,7 +173,7 @@ page_zip_dir_delete(
page_zip_des_t* page_zip,/*!< in/out: compressed page */
byte* rec, /*!< in: deleted record */
dict_index_t* index, /*!< in: index of rec */
const ulint* offsets,/*!< in: rec_get_offsets(rec) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec) */
const byte* free) /*!< in: previous start of the free list */
MY_ATTRIBUTE((nonnull(1,2,3,4)));

View file

@ -262,7 +262,7 @@ page_zip_write_rec(
page_zip_des_t* page_zip,/*!< in/out: compressed page */
const byte* rec, /*!< in: record being written */
dict_index_t* index, /*!< in: the index the record belongs to */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint create) /*!< in: nonzero=insert, zero=update */
MY_ATTRIBUTE((nonnull));
@ -287,7 +287,7 @@ page_zip_write_blob_ptr(
const byte* rec, /*!< in/out: record whose data is being
written */
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint n, /*!< in: column index */
mtr_t* mtr); /*!< in: mini-transaction handle,
or NULL if no logging is needed */
@ -326,7 +326,7 @@ void
page_zip_write_trx_id_and_roll_ptr(
page_zip_des_t* page_zip,
byte* rec,
const ulint* offsets,
const offset_t* offsets,
ulint trx_id_col,
trx_id_t trx_id,
roll_ptr_t roll_ptr,
@ -390,7 +390,7 @@ page_zip_dir_delete(
page_zip_des_t* page_zip, /*!< in/out: compressed page */
byte* rec, /*!< in: deleted record */
const dict_index_t* index, /*!< in: index of rec */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
const offset_t* offsets, /*!< in: rec_get_offsets(rec) */
const byte* free) /*!< in: previous start of
the free list */
MY_ATTRIBUTE((nonnull(1,2,3,4)));

View file

@ -1,8 +1,9 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* A Bison parser, made by GNU Bison 3.4.2. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -30,6 +31,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
#ifndef YY_YY_PARS0GRM_TAB_H_INCLUDED
# define YY_YY_PARS0GRM_TAB_H_INCLUDED
/* Debug traces. */
@ -58,91 +62,71 @@ extern int yydebug;
PARS_NE_TOKEN = 268,
PARS_PROCEDURE_TOKEN = 269,
PARS_IN_TOKEN = 270,
PARS_OUT_TOKEN = 271,
PARS_BINARY_TOKEN = 272,
PARS_BLOB_TOKEN = 273,
PARS_INT_TOKEN = 274,
PARS_FLOAT_TOKEN = 275,
PARS_CHAR_TOKEN = 276,
PARS_IS_TOKEN = 277,
PARS_BEGIN_TOKEN = 278,
PARS_END_TOKEN = 279,
PARS_IF_TOKEN = 280,
PARS_THEN_TOKEN = 281,
PARS_ELSE_TOKEN = 282,
PARS_ELSIF_TOKEN = 283,
PARS_LOOP_TOKEN = 284,
PARS_WHILE_TOKEN = 285,
PARS_RETURN_TOKEN = 286,
PARS_SELECT_TOKEN = 287,
PARS_SUM_TOKEN = 288,
PARS_COUNT_TOKEN = 289,
PARS_DISTINCT_TOKEN = 290,
PARS_FROM_TOKEN = 291,
PARS_WHERE_TOKEN = 292,
PARS_FOR_TOKEN = 293,
PARS_DDOT_TOKEN = 294,
PARS_READ_TOKEN = 295,
PARS_ORDER_TOKEN = 296,
PARS_BY_TOKEN = 297,
PARS_ASC_TOKEN = 298,
PARS_DESC_TOKEN = 299,
PARS_INSERT_TOKEN = 300,
PARS_INTO_TOKEN = 301,
PARS_VALUES_TOKEN = 302,
PARS_UPDATE_TOKEN = 303,
PARS_SET_TOKEN = 304,
PARS_DELETE_TOKEN = 305,
PARS_CURRENT_TOKEN = 306,
PARS_OF_TOKEN = 307,
PARS_CREATE_TOKEN = 308,
PARS_TABLE_TOKEN = 309,
PARS_INDEX_TOKEN = 310,
PARS_UNIQUE_TOKEN = 311,
PARS_CLUSTERED_TOKEN = 312,
PARS_ON_TOKEN = 313,
PARS_ASSIGN_TOKEN = 314,
PARS_DECLARE_TOKEN = 315,
PARS_CURSOR_TOKEN = 316,
PARS_SQL_TOKEN = 317,
PARS_OPEN_TOKEN = 318,
PARS_FETCH_TOKEN = 319,
PARS_CLOSE_TOKEN = 320,
PARS_NOTFOUND_TOKEN = 321,
PARS_TO_CHAR_TOKEN = 322,
PARS_TO_NUMBER_TOKEN = 323,
PARS_TO_BINARY_TOKEN = 324,
PARS_BINARY_TO_NUMBER_TOKEN = 325,
PARS_SUBSTR_TOKEN = 326,
PARS_REPLSTR_TOKEN = 327,
PARS_CONCAT_TOKEN = 328,
PARS_INSTR_TOKEN = 329,
PARS_LENGTH_TOKEN = 330,
PARS_SYSDATE_TOKEN = 331,
PARS_PRINTF_TOKEN = 332,
PARS_ASSERT_TOKEN = 333,
PARS_RND_TOKEN = 334,
PARS_RND_STR_TOKEN = 335,
PARS_ROW_PRINTF_TOKEN = 336,
PARS_COMMIT_TOKEN = 337,
PARS_ROLLBACK_TOKEN = 338,
PARS_WORK_TOKEN = 339,
PARS_UNSIGNED_TOKEN = 340,
PARS_EXIT_TOKEN = 341,
PARS_FUNCTION_TOKEN = 342,
PARS_LOCK_TOKEN = 343,
PARS_SHARE_TOKEN = 344,
PARS_MODE_TOKEN = 345,
PARS_LIKE_TOKEN = 346,
PARS_LIKE_TOKEN_EXACT = 347,
PARS_LIKE_TOKEN_PREFIX = 348,
PARS_LIKE_TOKEN_SUFFIX = 349,
PARS_LIKE_TOKEN_SUBSTR = 350,
PARS_TABLE_NAME_TOKEN = 351,
PARS_COMPACT_TOKEN = 352,
PARS_BLOCK_SIZE_TOKEN = 353,
PARS_BIGINT_TOKEN = 354,
NEG = 355
PARS_INT_TOKEN = 271,
PARS_CHAR_TOKEN = 272,
PARS_IS_TOKEN = 273,
PARS_BEGIN_TOKEN = 274,
PARS_END_TOKEN = 275,
PARS_IF_TOKEN = 276,
PARS_THEN_TOKEN = 277,
PARS_ELSE_TOKEN = 278,
PARS_ELSIF_TOKEN = 279,
PARS_LOOP_TOKEN = 280,
PARS_WHILE_TOKEN = 281,
PARS_RETURN_TOKEN = 282,
PARS_SELECT_TOKEN = 283,
PARS_COUNT_TOKEN = 284,
PARS_FROM_TOKEN = 285,
PARS_WHERE_TOKEN = 286,
PARS_FOR_TOKEN = 287,
PARS_DDOT_TOKEN = 288,
PARS_ORDER_TOKEN = 289,
PARS_BY_TOKEN = 290,
PARS_ASC_TOKEN = 291,
PARS_DESC_TOKEN = 292,
PARS_INSERT_TOKEN = 293,
PARS_INTO_TOKEN = 294,
PARS_VALUES_TOKEN = 295,
PARS_UPDATE_TOKEN = 296,
PARS_SET_TOKEN = 297,
PARS_DELETE_TOKEN = 298,
PARS_CURRENT_TOKEN = 299,
PARS_OF_TOKEN = 300,
PARS_CREATE_TOKEN = 301,
PARS_TABLE_TOKEN = 302,
PARS_INDEX_TOKEN = 303,
PARS_UNIQUE_TOKEN = 304,
PARS_CLUSTERED_TOKEN = 305,
PARS_ON_TOKEN = 306,
PARS_ASSIGN_TOKEN = 307,
PARS_DECLARE_TOKEN = 308,
PARS_CURSOR_TOKEN = 309,
PARS_SQL_TOKEN = 310,
PARS_OPEN_TOKEN = 311,
PARS_FETCH_TOKEN = 312,
PARS_CLOSE_TOKEN = 313,
PARS_NOTFOUND_TOKEN = 314,
PARS_TO_BINARY_TOKEN = 315,
PARS_SUBSTR_TOKEN = 316,
PARS_CONCAT_TOKEN = 317,
PARS_INSTR_TOKEN = 318,
PARS_LENGTH_TOKEN = 319,
PARS_COMMIT_TOKEN = 320,
PARS_ROLLBACK_TOKEN = 321,
PARS_WORK_TOKEN = 322,
PARS_EXIT_TOKEN = 323,
PARS_FUNCTION_TOKEN = 324,
PARS_LOCK_TOKEN = 325,
PARS_SHARE_TOKEN = 326,
PARS_MODE_TOKEN = 327,
PARS_LIKE_TOKEN = 328,
PARS_LIKE_TOKEN_EXACT = 329,
PARS_LIKE_TOKEN_PREFIX = 330,
PARS_LIKE_TOKEN_SUFFIX = 331,
PARS_LIKE_TOKEN_SUBSTR = 332,
PARS_TABLE_NAME_TOKEN = 333,
PARS_BIGINT_TOKEN = 334,
NEG = 335
};
#endif

View file

@ -48,29 +48,15 @@ extern int yydebug;
NOT re-entrant */
extern sym_tab_t* pars_sym_tab_global;
extern pars_res_word_t pars_to_char_token;
extern pars_res_word_t pars_to_number_token;
extern pars_res_word_t pars_to_binary_token;
extern pars_res_word_t pars_binary_to_number_token;
extern pars_res_word_t pars_substr_token;
extern pars_res_word_t pars_replstr_token;
extern pars_res_word_t pars_concat_token;
extern pars_res_word_t pars_length_token;
extern pars_res_word_t pars_instr_token;
extern pars_res_word_t pars_sysdate_token;
extern pars_res_word_t pars_printf_token;
extern pars_res_word_t pars_assert_token;
extern pars_res_word_t pars_rnd_token;
extern pars_res_word_t pars_rnd_str_token;
extern pars_res_word_t pars_count_token;
extern pars_res_word_t pars_sum_token;
extern pars_res_word_t pars_distinct_token;
extern pars_res_word_t pars_binary_token;
extern pars_res_word_t pars_blob_token;
extern pars_res_word_t pars_int_token;
extern pars_res_word_t pars_bigint_token;
extern pars_res_word_t pars_char_token;
extern pars_res_word_t pars_float_token;
extern pars_res_word_t pars_update_token;
extern pars_res_word_t pars_asc_token;
extern pars_res_word_t pars_desc_token;
@ -236,17 +222,6 @@ pars_insert_statement(
que_node_t* values_list, /*!< in: value expression list or NULL */
sel_node_t* select); /*!< in: select condition or NULL */
/*********************************************************************//**
Parses a procedure parameter declaration.
@return own: symbol table node of type SYM_VAR */
sym_node_t*
pars_parameter_declaration(
/*=======================*/
sym_node_t* node, /*!< in: symbol table node allocated for the
id of the parameter */
ulint param_type,
/*!< in: PARS_INPUT or PARS_OUTPUT */
pars_res_word_t* type); /*!< in: pointer to a type token */
/*********************************************************************//**
Parses an elsif element.
@return elsif node */
elsif_node_t*
@ -358,8 +333,6 @@ pars_column_def(
pars_res_word_t* type, /*!< in: data type */
sym_node_t* len, /*!< in: length of column, or
NULL */
void* is_unsigned, /*!< in: if not NULL, column
is of type UNSIGNED. */
void* is_not_null); /*!< in: if not NULL, column
is of type NOT NULL. */
/*********************************************************************//**
@ -370,9 +343,7 @@ pars_create_table(
/*==============*/
sym_node_t* table_sym, /*!< in: table name node in the symbol
table */
sym_node_t* column_defs, /*!< in: list of column names */
sym_node_t* compact, /* in: non-NULL if COMPACT table. */
sym_node_t* block_size); /* in: block size (can be NULL) */
sym_node_t* column_defs); /*!< in: list of column names */
/*********************************************************************//**
Parses an index creation operation.
@return index create subgraph */
@ -394,7 +365,6 @@ pars_procedure_definition(
/*======================*/
sym_node_t* sym_node, /*!< in: procedure id node in the symbol
table */
sym_node_t* param_list, /*!< in: parameter declaration list */
que_node_t* stat_list); /*!< in: statement list */
/*************************************************************//**
@ -672,7 +642,6 @@ struct proc_node_t{
que_common_t common; /*!< type: QUE_NODE_PROC */
sym_node_t* proc_id; /*!< procedure name symbol in the symbol
table of this same procedure */
sym_node_t* param_list; /*!< input and output parameters */
que_node_t* stat_list; /*!< statement list */
sym_tab_t* sym_tab; /*!< symbol table of this procedure */
};
@ -747,7 +716,7 @@ struct col_assign_node_t{
#define PARS_FUNC_LOGICAL 2 /*!< AND, OR, NOT */
#define PARS_FUNC_CMP 3 /*!< comparison operators */
#define PARS_FUNC_PREDEFINED 4 /*!< TO_NUMBER, SUBSTR, ... */
#define PARS_FUNC_AGGREGATE 5 /*!< COUNT, DISTINCT, SUM */
#define PARS_FUNC_AGGREGATE 5 /*!< COUNT */
#define PARS_FUNC_OTHER 6 /*!< these are not real functions,
e.g., := */
/* @} */

View file

@ -89,7 +89,7 @@ cmp_dtuple_rec_with_gis(
/*====================*/
const dtuple_t* dtuple,
const rec_t* rec,
const ulint* offsets,
const offset_t* offsets,
page_cur_mode_t mode)
MY_ATTRIBUTE((nonnull));
@ -105,7 +105,7 @@ int
cmp_dtuple_rec_with_gis_internal(
const dtuple_t* dtuple,
const rec_t* rec,
const ulint* offsets);
const offset_t* offsets);
/** Compare a data tuple to a physical record.
@param[in] dtuple data tuple
@ -121,7 +121,7 @@ int
cmp_dtuple_rec_with_match_low(
const dtuple_t* dtuple,
const rec_t* rec,
const ulint* offsets,
const offset_t* offsets,
ulint n_cmp,
ulint* matched_fields)
MY_ATTRIBUTE((nonnull));
@ -145,7 +145,7 @@ cmp_dtuple_rec_with_match_bytes(
const dtuple_t* dtuple,
const rec_t* rec,
const dict_index_t* index,
const ulint* offsets,
const offset_t* offsets,
ulint* matched_fields,
ulint* matched_bytes)
MY_ATTRIBUTE((warn_unused_result));
@ -162,7 +162,7 @@ int
cmp_dtuple_rec(
const dtuple_t* dtuple,
const rec_t* rec,
const ulint* offsets);
const offset_t* offsets);
/**************************************************************//**
Checks if a dtuple is a prefix of a record. The last field in dtuple
is allowed to be a prefix of the corresponding field in the record.
@ -172,7 +172,7 @@ cmp_dtuple_is_prefix_of_rec(
/*========================*/
const dtuple_t* dtuple, /*!< in: data tuple */
const rec_t* rec, /*!< in: physical record */
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets);/*!< in: array returned by rec_get_offsets() */
/** Compare two physical records that contain the same number of columns,
none of which are stored externally.
@retval positive if rec1 (including non-ordering columns) is greater than rec2
@ -183,8 +183,8 @@ cmp_rec_rec_simple(
/*===============*/
const rec_t* rec1, /*!< in: physical record */
const rec_t* rec2, /*!< in: physical record */
const ulint* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
const ulint* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
const offset_t* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
const offset_t* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
const dict_index_t* index, /*!< in: data dictionary index */
struct TABLE* table) /*!< in: MySQL table, for reporting
duplicate key value if applicable,
@ -209,8 +209,8 @@ int
cmp_rec_rec_with_match(
const rec_t* rec1,
const rec_t* rec2,
const ulint* offsets1,
const ulint* offsets2,
const offset_t* offsets1,
const offset_t* offsets2,
const dict_index_t* index,
bool nulls_unequal,
ulint* matched_fields);
@ -231,8 +231,8 @@ int
cmp_rec_rec(
const rec_t* rec1,
const rec_t* rec2,
const ulint* offsets1,
const ulint* offsets2,
const offset_t* offsets1,
const offset_t* offsets2,
const dict_index_t* index,
ulint* matched_fields = NULL);

View file

@ -68,8 +68,8 @@ int
cmp_rec_rec(
const rec_t* rec1,
const rec_t* rec2,
const ulint* offsets1,
const ulint* offsets2,
const offset_t* offsets1,
const offset_t* offsets2,
const dict_index_t* index,
ulint* matched_fields)
{

View file

@ -61,45 +61,86 @@ The status is stored in the low-order bits. */
/* Length of a B-tree node pointer, in bytes */
#define REC_NODE_PTR_SIZE 4
#ifndef UNIV_INNOCHECKSUM
/** SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records */
#define REC_1BYTE_SQL_NULL_MASK 0x80UL
static const offset_t REC_1BYTE_SQL_NULL_MASK= 0x80;
/** SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records */
#define REC_2BYTE_SQL_NULL_MASK 0x8000UL
static const offset_t REC_2BYTE_SQL_NULL_MASK= 0x8000;
/** In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most
significant bit denotes that the tail of a field is stored off-page. */
#define REC_2BYTE_EXTERN_MASK 0x4000UL
static const offset_t REC_2BYTE_EXTERN_MASK= 0x4000;
static const size_t RECORD_OFFSET= 2;
static const size_t INDEX_OFFSET=
RECORD_OFFSET + sizeof(rec_t *) / sizeof(offset_t);
#endif /* UNIV_INNOCHECKSUM */
/* Length of the rec_get_offsets() header */
static const size_t REC_OFFS_HEADER_SIZE=
#ifdef UNIV_DEBUG
/* Length of the rec_get_offsets() header */
# define REC_OFFS_HEADER_SIZE 4
#else /* UNIV_DEBUG */
/* Length of the rec_get_offsets() header */
# define REC_OFFS_HEADER_SIZE 2
#ifndef UNIV_INNOCHECKSUM
sizeof(rec_t *) / sizeof(offset_t) +
sizeof(dict_index_t *) / sizeof(offset_t) +
#endif /* UNIV_INNOCHECKSUM */
#endif /* UNIV_DEBUG */
2;
/* Number of elements that should be initially allocated for the
offsets[] array, first passed to rec_get_offsets() */
#define REC_OFFS_NORMAL_SIZE OFFS_IN_REC_NORMAL_SIZE
#define REC_OFFS_SMALL_SIZE 10
static const size_t REC_OFFS_NORMAL_SIZE= 300;
static const size_t REC_OFFS_SMALL_SIZE= 18;
static const size_t REC_OFFS_SEC_INDEX_SIZE=
/* PK max key parts */ 16 + /* sec idx max key parts */ 16 +
/* child page number for non-leaf pages */ 1;
/** Get the base address of offsets. The extra_size is stored at
this position, and following positions hold the end offsets of
the fields. */
#define rec_offs_base(offsets) (offsets + REC_OFFS_HEADER_SIZE)
/** Compact flag ORed to the extra size returned by rec_get_offsets() */
const ulint REC_OFFS_COMPACT = ~(ulint(~0) >> 1);
/** SQL NULL flag in offsets returned by rec_get_offsets() */
const ulint REC_OFFS_SQL_NULL = REC_OFFS_COMPACT;
/** External flag in offsets returned by rec_get_offsets() */
const ulint REC_OFFS_EXTERNAL = REC_OFFS_COMPACT >> 1;
/** Default value flag in offsets returned by rec_get_offsets() */
const ulint REC_OFFS_DEFAULT = REC_OFFS_COMPACT >> 2;
/** Mask for offsets returned by rec_get_offsets() */
const ulint REC_OFFS_MASK = REC_OFFS_DEFAULT - 1;
#ifndef UNIV_INNOCHECKSUM
/* Offset consists of two parts: 2 upper bits is type and all other bits is
value */
/** Only 4 different values is possible! */
enum field_type_t
{
/** normal field */
STORED_IN_RECORD= 0 << 14,
/** this field is stored off-page */
STORED_OFFPAGE= 1 << 14,
/** just an SQL NULL */
SQL_NULL= 2 << 14,
/** instantly added field */
DEFAULT= 3 << 14,
};
/** without 2 upper bits */
static const offset_t DATA_MASK= 0x3fff;
/** 2 upper bits */
static const offset_t TYPE_MASK= ~DATA_MASK;
inline field_type_t get_type(offset_t n)
{
return static_cast<field_type_t>(n & TYPE_MASK);
}
inline void set_type(offset_t &n, field_type_t type)
{
n= (n & DATA_MASK) | static_cast<offset_t>(type);
}
inline offset_t get_value(offset_t n) { return n & DATA_MASK; }
inline offset_t combine(offset_t value, field_type_t type)
{
return get_value(value) | static_cast<offset_t>(type);
}
/** Compact flag ORed to the extra size returned by rec_get_offsets() */
const offset_t REC_OFFS_COMPACT= ~(offset_t(~0) >> 1);
/** External flag in offsets returned by rec_get_offsets() */
const offset_t REC_OFFS_EXTERNAL= REC_OFFS_COMPACT >> 1;
/** Default value flag in offsets returned by rec_get_offsets() */
const offset_t REC_OFFS_DEFAULT= REC_OFFS_COMPACT >> 2;
const offset_t REC_OFFS_MASK= REC_OFFS_DEFAULT - 1;
/******************************************************//**
The following function is used to get the pointer of the next chained record
on the same page.
@ -452,7 +493,7 @@ offsets form. If the field is SQL null, the flag is ORed in the returned
value.
@return offset of the start of the field, SQL null flag ORed */
UNIV_INLINE
ulint
uint8_t
rec_1_get_field_end_info(
/*=====================*/
const rec_t* rec, /*!< in: record */
@ -466,7 +507,7 @@ value.
@return offset of the start of the field, SQL null flag and extern
storage flag ORed */
UNIV_INLINE
ulint
uint16_t
rec_2_get_field_end_info(
/*=====================*/
const rec_t* rec, /*!< in: record */
@ -507,11 +548,11 @@ rec_get_n_extern_new(
(ULINT_UNDEFINED to compute all offsets)
@param[in,out] heap memory heap
@return the new offsets */
ulint*
offset_t*
rec_get_offsets_func(
const rec_t* rec,
const dict_index_t* index,
ulint* offsets,
offset_t* offsets,
bool leaf,
ulint n_fields,
#ifdef UNIV_DEBUG
@ -546,7 +587,7 @@ rec_get_offsets_reverse(
const dict_index_t* index, /*!< in: record descriptor */
ulint node_ptr,/*!< in: nonzero=node pointer,
0=leaf node */
ulint* offsets)/*!< in/out: array consisting of
offset_t* offsets)/*!< in/out: array consisting of
offsets[0] allocated elements */
MY_ATTRIBUTE((nonnull));
#ifdef UNIV_DEBUG
@ -559,7 +600,7 @@ bool
rec_offs_validate(
const rec_t* rec,
const dict_index_t* index,
const ulint* offsets)
const offset_t* offsets)
MY_ATTRIBUTE((nonnull(3), warn_unused_result));
/** Update debug data in offsets, in order to tame rec_offs_validate().
@param[in] rec record
@ -571,7 +612,7 @@ rec_offs_make_valid(
const rec_t* rec,
const dict_index_t* index,
bool leaf,
ulint* offsets)
offset_t* offsets)
MY_ATTRIBUTE((nonnull));
#else
# define rec_offs_make_valid(rec, index, leaf, offsets)
@ -608,17 +649,16 @@ The following function is used to get an offset to the nth
data field in a record.
@return offset from the origin of rec */
UNIV_INLINE
ulint
offset_t
rec_get_nth_field_offs(
/*===================*/
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n, /*!< in: index of the field */
ulint* len) /*!< out: length of the field; UNIV_SQL_NULL
if SQL null */
MY_ATTRIBUTE((nonnull));
#define rec_get_nth_field(rec, offsets, n, len) \
((rec) + rec_get_nth_field_offs(offsets, n, len))
/******************************************************//**
Determine if the offsets are for a record containing null BLOB pointers.
@return first field containing a null BLOB pointer, or NULL if none found */
@ -627,7 +667,7 @@ const byte*
rec_offs_any_null_extern(
/*=====================*/
const rec_t* rec, /*!< in: record */
const ulint* offsets) /*!< in: rec_get_offsets(rec) */
const offset_t* offsets) /*!< in: rec_get_offsets(rec) */
MY_ATTRIBUTE((warn_unused_result));
/** Mark the nth field as externally stored.
@ -635,7 +675,7 @@ rec_offs_any_null_extern(
@param[in] n nth field */
void
rec_offs_make_nth_extern(
ulint* offsets,
offset_t* offsets,
const ulint n);
/** Determine the number of allocated elements for an array of offsets.
@ -643,7 +683,7 @@ rec_offs_make_nth_extern(
@return number of elements */
inline
ulint
rec_offs_get_n_alloc(const ulint* offsets)
rec_offs_get_n_alloc(const offset_t* offsets)
{
ulint n_alloc;
ut_ad(offsets);
@ -658,7 +698,7 @@ rec_offs_get_n_alloc(const ulint* offsets)
@return number of fields */
inline
ulint
rec_offs_n_fields(const ulint* offsets)
rec_offs_n_fields(const offset_t* offsets)
{
ulint n_fields;
ut_ad(offsets);
@ -674,19 +714,12 @@ rec_offs_n_fields(const ulint* offsets)
@param[in] offsets rec_get_offsets()
@param[in] n nth field
@param[in] flag flag to extract
@return the flag of the record field */
inline
ulint
rec_offs_nth_flag(const ulint* offsets, ulint n, ulint flag)
@return type of the record field */
inline field_type_t rec_offs_nth_type(const offset_t *offsets, ulint n)
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
/* The DEFAULT, NULL, EXTERNAL flags are mutually exclusive. */
ut_ad(ut_is_2pow(rec_offs_base(offsets)[1 + n]
& (REC_OFFS_DEFAULT
| REC_OFFS_SQL_NULL
| REC_OFFS_EXTERNAL)));
return rec_offs_base(offsets)[1 + n] & flag;
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
return get_type(rec_offs_base(offsets)[1 + n]);
}
/** Determine if a record field is missing
@ -694,11 +727,9 @@ rec_offs_nth_flag(const ulint* offsets, ulint n, ulint flag)
@param[in] offsets rec_get_offsets()
@param[in] n nth field
@return nonzero if default bit is set */
inline
ulint
rec_offs_nth_default(const ulint* offsets, ulint n)
inline ulint rec_offs_nth_default(const offset_t *offsets, ulint n)
{
return rec_offs_nth_flag(offsets, n, REC_OFFS_DEFAULT);
return rec_offs_nth_type(offsets, n) == DEFAULT;
}
/** Determine if a record field is SQL NULL
@ -706,11 +737,9 @@ rec_offs_nth_default(const ulint* offsets, ulint n)
@param[in] offsets rec_get_offsets()
@param[in] n nth field
@return nonzero if SQL NULL set */
inline
ulint
rec_offs_nth_sql_null(const ulint* offsets, ulint n)
inline ulint rec_offs_nth_sql_null(const offset_t *offsets, ulint n)
{
return rec_offs_nth_flag(offsets, n, REC_OFFS_SQL_NULL);
return rec_offs_nth_type(offsets, n) == SQL_NULL;
}
/** Determine if a record field is stored off-page.
@ -718,54 +747,46 @@ rec_offs_nth_sql_null(const ulint* offsets, ulint n)
@param[in] n nth field
Returns nonzero if the extern bit is set in nth field of rec.
@return nonzero if externally stored */
inline
ulint
rec_offs_nth_extern(const ulint* offsets, ulint n)
inline ulint rec_offs_nth_extern(const offset_t *offsets, ulint n)
{
return rec_offs_nth_flag(offsets, n, REC_OFFS_EXTERNAL);
return rec_offs_nth_type(offsets, n) == STORED_OFFPAGE;
}
/** Get a global flag of a record.
@param[in] offsets rec_get_offsets()
@param[in] flag flag to extract
@return the flag of the record field */
inline
ulint
rec_offs_any_flag(const ulint* offsets, ulint flag)
inline ulint rec_offs_any_flag(const offset_t *offsets, ulint flag)
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
return *rec_offs_base(offsets) & flag;
ut_ad(rec_offs_validate(NULL, NULL, offsets));
return *rec_offs_base(offsets) & flag;
}
/** Determine if the offsets are for a record containing off-page columns.
@param[in] offsets rec_get_offsets()
@return nonzero if any off-page columns exist */
inline bool rec_offs_any_extern(const ulint* offsets)
inline bool rec_offs_any_extern(const offset_t *offsets)
{
return rec_offs_any_flag(offsets, REC_OFFS_EXTERNAL);
return rec_offs_any_flag(offsets, REC_OFFS_EXTERNAL);
}
/** Determine if the offsets are for a record that is missing fields.
@param[in] offsets rec_get_offsets()
@return nonzero if any fields need to be replaced with
dict_index_t::instant_field_value() */
inline
ulint
rec_offs_any_default(const ulint* offsets)
inline ulint rec_offs_any_default(const offset_t *offsets)
{
return rec_offs_any_flag(offsets, REC_OFFS_DEFAULT);
return rec_offs_any_flag(offsets, REC_OFFS_DEFAULT);
}
/** Determine if the offsets are for other than ROW_FORMAT=REDUNDANT.
@param[in] offsets rec_get_offsets()
@return nonzero if ROW_FORMAT is COMPACT,DYNAMIC or COMPRESSED
@retval 0 if ROW_FORMAT=REDUNDANT */
inline
ulint
rec_offs_comp(const ulint* offsets)
inline ulint rec_offs_comp(const offset_t *offsets)
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
return(*rec_offs_base(offsets) & REC_OFFS_COMPACT);
ut_ad(rec_offs_validate(NULL, NULL, offsets));
return (*rec_offs_base(offsets) & REC_OFFS_COMPACT);
}
/** Determine if the record is the metadata pseudo-record
@ -864,7 +885,7 @@ const byte*
rec_get_nth_cfield(
const rec_t* rec,
const dict_index_t* index,
const ulint* offsets,
const offset_t* offsets,
ulint n,
ulint* len)
{
@ -883,7 +904,7 @@ UNIV_INLINE
ulint
rec_offs_nth_size(
/*==============*/
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: nth field */
MY_ATTRIBUTE((warn_unused_result));
@ -894,7 +915,7 @@ UNIV_INLINE
ulint
rec_offs_n_extern(
/*==============*/
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/***********************************************************//**
This is used to modify the value of an already existing field in a record.
@ -907,7 +928,7 @@ void
rec_set_nth_field(
/*==============*/
rec_t* rec, /*!< in: record */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n, /*!< in: index number of the field */
const void* data, /*!< in: pointer to the data if not SQL null */
ulint len) /*!< in: length of the data or UNIV_SQL_NULL.
@ -935,7 +956,7 @@ UNIV_INLINE
void
rec_offs_set_n_alloc(
/*=================*/
ulint* offsets, /*!< out: array for rec_get_offsets(),
offset_t*offsets, /*!< out: array for rec_get_offsets(),
must be allocated */
ulint n_alloc) /*!< in: number of elements */
MY_ATTRIBUTE((nonnull));
@ -951,7 +972,7 @@ UNIV_INLINE
ulint
rec_offs_data_size(
/*===============*/
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/**********************************************************//**
Returns the total size of record minus data size of record.
@ -962,7 +983,7 @@ UNIV_INLINE
ulint
rec_offs_extra_size(
/*================*/
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/**********************************************************//**
Returns the total size of a physical record.
@ -971,7 +992,7 @@ UNIV_INLINE
ulint
rec_offs_size(
/*==========*/
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
#ifdef UNIV_DEBUG
/**********************************************************//**
@ -982,7 +1003,7 @@ byte*
rec_get_start(
/*==========*/
const rec_t* rec, /*!< in: pointer to record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/**********************************************************//**
Returns a pointer to the end of the record.
@ -992,7 +1013,7 @@ byte*
rec_get_end(
/*========*/
const rec_t* rec, /*!< in: pointer to record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
#else /* UNIV_DEBUG */
# define rec_get_start(rec, offsets) ((rec) - rec_offs_extra_size(offsets))
@ -1009,7 +1030,7 @@ rec_t*
rec_copy(
void* buf,
const rec_t* rec,
const ulint* offsets);
const offset_t* offsets);
/** Determine the size of a data tuple prefix in a temporary file.
@param[in] index clustered or secondary index
@ -1038,7 +1059,7 @@ void
rec_init_offsets_temp(
const rec_t* rec,
const dict_index_t* index,
ulint* offsets,
offset_t* offsets,
ulint n_core,
const dict_col_t::def_t*def_val,
rec_comp_status_t status = REC_STATUS_ORDINARY)
@ -1052,7 +1073,7 @@ void
rec_init_offsets_temp(
const rec_t* rec,
const dict_index_t* index,
ulint* offsets)
offset_t* offsets)
MY_ATTRIBUTE((nonnull));
/** Convert a data tuple prefix to the temporary file format.
@ -1172,7 +1193,7 @@ ibool
rec_validate(
/*=========*/
const rec_t* rec, /*!< in: physical record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((nonnull));
/***************************************************************//**
Prints an old-style physical record. */
@ -1189,7 +1210,7 @@ rec_print_mbr_rec(
/*==========*/
FILE* file, /*!< in: file where to print */
const rec_t* rec, /*!< in: physical record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((nonnull));
/***************************************************************//**
Prints a physical record. */
@ -1198,7 +1219,7 @@ rec_print_new(
/*==========*/
FILE* file, /*!< in: file where to print */
const rec_t* rec, /*!< in: physical record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((nonnull));
/***************************************************************//**
Prints a physical record. */
@ -1220,7 +1241,7 @@ rec_print(
std::ostream& o,
const rec_t* rec,
ulint info,
const ulint* offsets);
const offset_t* offsets);
/** Wrapper for pretty-printing a record */
struct rec_index_print
@ -1247,14 +1268,14 @@ operator<<(std::ostream& o, const rec_index_print& r);
struct rec_offsets_print
{
/** Constructor */
rec_offsets_print(const rec_t* rec, const ulint* offsets) :
rec_offsets_print(const rec_t* rec, const offset_t* offsets) :
m_rec(rec), m_offsets(offsets)
{}
/** Record */
const rec_t* m_rec;
/** Offsets to each field */
const ulint* m_offsets;
const offset_t* m_offsets;
};
/** Display a record.
@ -1271,7 +1292,7 @@ public:
/** Construct a pretty-printed record.
@param rec record with header
@param offsets rec_get_offsets(rec, ...) */
rec_printer(const rec_t* rec, const ulint* offsets)
rec_printer(const rec_t* rec, const offset_t* offsets)
:
std::ostringstream ()
{
@ -1284,7 +1305,7 @@ public:
@param rec record, possibly lacking header
@param info rec_get_info_bits(rec)
@param offsets rec_get_offsets(rec, ...) */
rec_printer(const rec_t* rec, ulint info, const ulint* offsets)
rec_printer(const rec_t* rec, ulint info, const offset_t* offsets)
:
std::ostringstream ()
{

View file

@ -800,7 +800,7 @@ offsets form. If the field is SQL null, the flag is ORed in the returned
value.
@return offset of the start of the field, SQL null flag ORed */
UNIV_INLINE
ulint
uint8_t
rec_1_get_field_end_info(
/*=====================*/
const rec_t* rec, /*!< in: record */
@ -819,7 +819,7 @@ value.
@return offset of the start of the field, SQL null flag and extern
storage flag ORed */
UNIV_INLINE
ulint
uint16_t
rec_2_get_field_end_info(
/*=====================*/
const rec_t* rec, /*!< in: record */
@ -852,13 +852,13 @@ UNIV_INLINE
void
rec_offs_set_n_alloc(
/*=================*/
ulint* offsets, /*!< out: array for rec_get_offsets(),
offset_t*offsets, /*!< out: array for rec_get_offsets(),
must be allocated */
ulint n_alloc) /*!< in: number of elements */
{
ut_ad(n_alloc > REC_OFFS_HEADER_SIZE);
UNIV_MEM_ALLOC(offsets, n_alloc * sizeof *offsets);
offsets[0] = n_alloc;
offsets[0] = static_cast<offset_t>(n_alloc);
}
/************************************************************//**
@ -866,35 +866,27 @@ The following function is used to get an offset to the nth
data field in a record.
@return offset from the origin of rec */
UNIV_INLINE
ulint
offset_t
rec_get_nth_field_offs(
/*===================*/
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n, /*!< in: index of the field */
ulint* len) /*!< out: length of the field; UNIV_SQL_NULL
if SQL null; UNIV_SQL_DEFAULT is default value */
{
ulint offs;
ut_ad(n < rec_offs_n_fields(offsets));
if (n == 0) {
offs = 0;
offset_t offs = n == 0 ? 0 : get_value(rec_offs_base(offsets)[n]);
offset_t next_offs = rec_offs_base(offsets)[1 + n];
if (get_type(next_offs) == SQL_NULL) {
*len = UNIV_SQL_NULL;
} else if (get_type(next_offs) == DEFAULT) {
*len = UNIV_SQL_DEFAULT;
} else {
offs = rec_offs_base(offsets)[n] & REC_OFFS_MASK;
*len = get_value(next_offs) - offs;
}
ulint length = rec_offs_base(offsets)[1 + n];
if (length & REC_OFFS_SQL_NULL) {
length = UNIV_SQL_NULL;
} else if (length & REC_OFFS_DEFAULT) {
length = UNIV_SQL_DEFAULT;
} else {
length &= REC_OFFS_MASK;
length -= offs;
}
*len = length;
return(offs);
}
@ -906,7 +898,7 @@ const byte*
rec_offs_any_null_extern(
/*=====================*/
const rec_t* rec, /*!< in: record */
const ulint* offsets) /*!< in: rec_get_offsets(rec) */
const offset_t* offsets) /*!< in: rec_get_offsets(rec) */
{
ulint i;
ut_ad(rec_offs_validate(rec, NULL, offsets));
@ -941,16 +933,16 @@ UNIV_INLINE
ulint
rec_offs_nth_size(
/*==============*/
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: nth field */
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
if (!n) {
return(rec_offs_base(offsets)[1 + n] & REC_OFFS_MASK);
return get_value(rec_offs_base(offsets)[1 + n]);
}
return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n])
& REC_OFFS_MASK);
return get_value((rec_offs_base(offsets)[1 + n]))
- get_value(rec_offs_base(offsets)[n]);
}
/******************************************************//**
@ -960,7 +952,7 @@ UNIV_INLINE
ulint
rec_offs_n_extern(
/*==============*/
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint n = 0;
@ -1158,7 +1150,7 @@ void
rec_set_nth_field(
/*==============*/
rec_t* rec, /*!< in: record */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n, /*!< in: index number of the field */
const void* data, /*!< in: pointer to the data
if not SQL null */
@ -1214,16 +1206,16 @@ UNIV_INLINE
void
rec_offs_set_n_fields(
/*==================*/
ulint* offsets, /*!< in/out: array returned by
offset_t* offsets, /*!< in/out: array returned by
rec_get_offsets() */
ulint n_fields) /*!< in: number of fields */
ulint n_fields) /*!< in: number of fields */
{
ut_ad(offsets);
ut_ad(n_fields > 0);
ut_ad(n_fields <= REC_MAX_N_FIELDS);
ut_ad(n_fields + REC_OFFS_HEADER_SIZE
<= rec_offs_get_n_alloc(offsets));
offsets[1] = n_fields;
offsets[1] = static_cast<offset_t>(n_fields);
}
/**********************************************************//**
@ -1236,14 +1228,12 @@ UNIV_INLINE
ulint
rec_offs_data_size(
/*===============*/
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint size;
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ulint n = rec_offs_n_fields(offsets);
size = rec_offs_base(offsets)[n] & REC_OFFS_MASK;
size = get_value(rec_offs_base(offsets)[rec_offs_n_fields(offsets)]);
ut_ad(size < srv_page_size);
return(size);
}
@ -1257,7 +1247,7 @@ UNIV_INLINE
ulint
rec_offs_extra_size(
/*================*/
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint size;
ut_ad(rec_offs_validate(NULL, NULL, offsets));
@ -1273,7 +1263,7 @@ UNIV_INLINE
ulint
rec_offs_size(
/*==========*/
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
{
return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets));
}
@ -1287,7 +1277,7 @@ byte*
rec_get_end(
/*========*/
const rec_t* rec, /*!< in: pointer to record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(rec, NULL, offsets));
return(const_cast<rec_t*>(rec + rec_offs_data_size(offsets)));
@ -1301,7 +1291,7 @@ byte*
rec_get_start(
/*==========*/
const rec_t* rec, /*!< in: pointer to record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(rec, NULL, offsets));
return(const_cast<rec_t*>(rec - rec_offs_extra_size(offsets)));
@ -1318,7 +1308,7 @@ rec_t*
rec_copy(
void* buf,
const rec_t* rec,
const ulint* offsets)
const offset_t* offsets)
{
ulint extra_len;
ulint data_len;

View file

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -29,6 +30,9 @@ Created 5/30/1994 Heikki Tuuri
/* We define the physical record simply as an array of bytes */
typedef byte rec_t;
/** This type represents a field offset in a rec_t* */
typedef unsigned short int offset_t;
/* Maximum values for various fields (for non-blob tuples) */
#define REC_MAX_N_FIELDS (1024 - 1)
#define REC_MAX_HEAP_NO (2 * 8192 - 1)

View file

@ -30,6 +30,7 @@ Created 10/13/2010 Jimmy Yang
#include "data0data.h"
#include "fts0fts.h"
#include "fts0priv.h"
#include "rem0types.h"
#include "row0merge.h"
#include "btr0bulk.h"
@ -250,7 +251,7 @@ row_merge_fts_sel_propagate(
int* sel_tree, /*<! in: selection tree */
ulint level, /*<! in: selection tree level */
const mrec_t** mrec, /*<! in: sort record */
ulint** offsets, /*<! in: record offsets */
offset_t** offsets, /*<! in: record offsets */
dict_index_t* index); /*<! in: FTS index */
/********************************************************************//**
Read sorted file containing index data tuples and insert these data

View file

@ -136,7 +136,7 @@ row_log_table_delete(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) */
const byte* sys) /*!< in: DB_TRX_ID,DB_ROLL_PTR that should
be logged, or NULL to use those in rec */
ATTRIBUTE_COLD __attribute__((nonnull(1,2,3)));
@ -151,7 +151,7 @@ row_log_table_update(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) */
const dtuple_t* old_pk);/*!< in: row_log_table_get_pk()
before the update */
@ -167,7 +167,7 @@ row_log_table_get_pk(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
const ulint* offsets,/*!< in: rec_get_offsets(rec,index),
const offset_t* offsets,/*!< in: rec_get_offsets(rec,index),
or NULL */
byte* sys, /*!< out: DB_TRX_ID,DB_ROLL_PTR for
row_log_table_delete(), or NULL */
@ -184,7 +184,7 @@ row_log_table_insert(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
const ulint* offsets);/*!< in: rec_get_offsets(rec,index) */
const offset_t* offsets);/*!< in: rec_get_offsets(rec,index) */
/******************************************************//**
Notes that a BLOB is being freed during online ALTER TABLE. */
void

View file

@ -489,7 +489,7 @@ row_merge_read_rec(
const mrec_t** mrec, /*!< out: pointer to merge record,
or NULL on end of list
(non-NULL on I/O error) */
ulint* offsets,/*!< out: offsets of mrec */
offset_t* offsets,/*!< out: offsets of mrec */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space) /*!< in: space id */
MY_ATTRIBUTE((warn_unused_result));

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2017, MariaDB Corporation.
Copyright (c) 2016, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -44,7 +44,7 @@ ulint
row_get_trx_id_offset(
/*==================*/
const dict_index_t* index, /*!< in: clustered index */
const ulint* offsets)/*!< in: record offsets */
const offset_t* offsets)/*!< in: record offsets */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
Reads the trx id field from a clustered index record.
@ -55,7 +55,7 @@ row_get_rec_trx_id(
/*===============*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: clustered index */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
Reads the roll pointer field from a clustered index record.
@ -66,7 +66,7 @@ row_get_rec_roll_ptr(
/*=================*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: clustered index */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/* Flags for row build type. */
@ -139,7 +139,7 @@ row_build(
this record must be at least
s-latched and the latch held
as long as the row dtuple is used! */
const ulint* offsets,/*!< in: rec_get_offsets(rec,index)
const offset_t* offsets,/*!< in: rec_get_offsets(rec,index)
or NULL, in which case this function
will invoke rec_get_offsets() */
const dict_table_t* col_table,
@ -190,7 +190,7 @@ row_build_w_add_vcol(
ulint type,
const dict_index_t* index,
const rec_t* rec,
const ulint* offsets,
const offset_t* offsets,
const dict_table_t* col_table,
const dtuple_t* defaults,
const dict_add_v_col_t* add_v,
@ -207,7 +207,7 @@ row_rec_to_index_entry_low(
/*=======================*/
const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint* n_ext, /*!< out: number of externally
stored columns */
mem_heap_t* heap) /*!< in: memory heap from which
@ -222,7 +222,7 @@ row_rec_to_index_entry(
/*===================*/
const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */
const ulint* offsets,/*!< in/out: rec_get_offsets(rec) */
const offset_t* offsets,/*!< in/out: rec_get_offsets(rec) */
ulint* n_ext, /*!< out: number of externally
stored columns */
mem_heap_t* heap) /*!< in: memory heap from which
@ -241,7 +241,7 @@ dtuple_t*
row_metadata_to_tuple(
const rec_t* rec,
const dict_index_t* index,
const ulint* offsets,
const offset_t* offsets,
ulint* n_ext,
mem_heap_t* heap,
ulint info_bits,
@ -287,7 +287,7 @@ row_build_row_ref_in_tuple(
held as long as the row
reference is used! */
const dict_index_t* index, /*!< in: secondary index */
ulint* offsets)/*!< in: rec_get_offsets(rec, index)
offset_t* offsets)/*!< in: rec_get_offsets(rec, index)
or NULL */
MY_ATTRIBUTE((nonnull(1,2,3)));
/*******************************************************************//**
@ -305,7 +305,7 @@ row_build_row_ref_fast(
const rec_t* rec, /*!< in: secondary index record;
must be preserved while ref is used, as we do
not copy field values to heap */
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets);/*!< in: array returned by rec_get_offsets() */
/***************************************************************//**
Searches the clustered index record for a row, if we have the row
reference.

View file

@ -37,7 +37,7 @@ ulint
row_get_trx_id_offset(
/*==================*/
const dict_index_t* index, /*!< in: clustered index */
const ulint* offsets)/*!< in: record offsets */
const offset_t* offsets)/*!< in: record offsets */
{
ulint offset;
ulint len;
@ -60,7 +60,7 @@ row_get_rec_trx_id(
/*===============*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: clustered index */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ulint offset;
@ -85,7 +85,7 @@ row_get_rec_roll_ptr(
/*=================*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: clustered index */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ulint offset;
@ -144,7 +144,7 @@ row_build_row_ref_fast(
const rec_t* rec, /*!< in: secondary index record;
must be preserved while ref is used, as we do
not copy field values to heap */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
{
dfield_t* dfield;
const byte* field;

View file

@ -28,6 +28,7 @@ Created 12/27/1996 Heikki Tuuri
#define row0upd_h
#include "data0data.h"
#include "rem0types.h"
#include "row0types.h"
#include "btr0types.h"
#include "trx0types.h"
@ -110,7 +111,7 @@ row_upd_rec_sys_fields(
page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL */
dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr);/*!< in: DB_ROLL_PTR to the undo log */
/*********************************************************************//**
@ -140,7 +141,7 @@ ibool
row_upd_changes_field_size_or_external(
/*===================================*/
dict_index_t* index, /*!< in: index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const upd_t* update);/*!< in: update vector */
/***********************************************************//**
Returns true if row update contains disowned external fields.
@ -161,7 +162,7 @@ row_upd_rec_in_place(
/*=================*/
rec_t* rec, /*!< in/out: record where replaced */
dict_index_t* index, /*!< in: the index the record belongs to */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
page_zip_des_t* page_zip);/*!< in: compressed page with enough space
available, or NULL */
@ -176,7 +177,7 @@ row_upd_build_sec_rec_difference_binary(
/*====================================*/
const rec_t* rec, /*!< in: secondary index record */
dict_index_t* index, /*!< in: index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const dtuple_t* entry, /*!< in: entry to insert */
mem_heap_t* heap) /*!< in: memory heap from which allocated */
MY_ATTRIBUTE((warn_unused_result, nonnull));
@ -202,7 +203,7 @@ row_upd_build_difference_binary(
dict_index_t* index,
const dtuple_t* entry,
const rec_t* rec,
const ulint* offsets,
const offset_t* offsets,
bool no_sys,
trx_t* trx,
mem_heap_t* heap,
@ -374,7 +375,7 @@ row_upd_rec_sys_fields_in_recovery(
/*===============================*/
rec_t* rec, /*!< in/out: record */
page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint pos, /*!< in: TRX_ID position in rec */
trx_id_t trx_id, /*!< in: transaction id */
roll_ptr_t roll_ptr);/*!< in: roll ptr of the undo log record */

View file

@ -163,7 +163,7 @@ row_upd_rec_sys_fields(
page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL */
dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr)/*!< in: DB_ROLL_PTR to the undo log */
{

View file

@ -52,7 +52,7 @@ row_vers_impl_x_locked(
trx_t* caller_trx,
const rec_t* rec,
dict_index_t* index,
const ulint* offsets);
const offset_t* offsets);
/** Finds out if a version of the record, where the version >= the current
purge view, should have ientry as its secondary index entry. We check
@ -98,7 +98,7 @@ row_vers_build_for_consistent_read(
mtr_t* mtr, /*!< in: mtr holding the latch on rec; it will
also hold the latch on purge_view */
dict_index_t* index, /*!< in: the clustered index */
ulint** offsets,/*!< in/out: offsets returned by
offset_t** offsets,/*!< in/out: offsets returned by
rec_get_offsets(rec, index) */
ReadView* view, /*!< in: the consistent read view */
mem_heap_t** offset_heap,/*!< in/out: memory heap from which
@ -126,7 +126,7 @@ row_vers_build_for_semi_consistent_read(
of this records */
mtr_t* mtr, /*!< in: mtr holding the latch on rec */
dict_index_t* index, /*!< in: the clustered index */
ulint** offsets,/*!< in/out: offsets returned by
offset_t** offsets,/*!< in/out: offsets returned by
rec_get_offsets(rec, index) */
mem_heap_t** offset_heap,/*!< in/out: memory heap from which
the offsets are allocated */

View file

@ -191,7 +191,7 @@ trx_undo_report_row_operation(
const rec_t* rec, /*!< in: case of an update or delete
marking, the record in the clustered
index; NULL if insert */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
const offset_t* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the
undo log record */
MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result));
@ -224,7 +224,7 @@ trx_undo_prev_version_build(
index_rec page and purge_view */
const rec_t* rec, /*!< in: version of a clustered index record */
dict_index_t* index, /*!< in: clustered index */
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mem_heap_t* heap, /*!< in: memory heap from which the memory
needed is allocated */
rec_t** old_vers,/*!< out, own: previous version, or NULL if

View file

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -27,37 +28,49 @@ Created 1/20/1994 Heikki Tuuri
#define ut0rnd_h
#include "ut0byte.h"
#include <my_sys.h>
#ifndef UNIV_INNOCHECKSUM
/** The 'character code' for end of field or string (used
in folding records */
#define UT_END_OF_FIELD 257
/** Seed value of ut_rnd_gen() */
extern int32 ut_rnd_current;
/** @return a pseudo-random 32-bit number */
inline uint32_t ut_rnd_gen()
{
/* This is a Galois linear-feedback shift register.
https://en.wikipedia.org/wiki/Linear-feedback_shift_register#Galois_LFSRs
The generating primitive Galois Field polynomial is the Castagnoli
polynomial that was made popular by CRC-32C:
x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+
x^19+x^18+x^14+x^13+x^11+x^10+x^9+x^8+x^6+1 */
const uint32_t crc32c= 0x1edc6f41;
uint32_t rnd= my_atomic_load32_explicit(&ut_rnd_current,
MY_MEMORY_ORDER_RELAXED);
if (UNIV_UNLIKELY(rnd == 0))
{
rnd= static_cast<uint32_t>(my_interval_timer());
if (!rnd) rnd= 1;
}
else
{
bool lsb= rnd & 1;
rnd>>= 1;
if (lsb)
rnd^= crc32c;
}
my_atomic_store32_explicit(&ut_rnd_current, rnd, MY_MEMORY_ORDER_RELAXED);
return rnd;
}
/** @return a random number between 0 and n-1, inclusive */
inline ulint ut_rnd_interval(ulint n)
{
return n > 1 ? static_cast<ulint>(ut_rnd_gen() % n) : 0;
}
/********************************************************//**
This is used to set the random number seed. */
UNIV_INLINE
void
ut_rnd_set_seed(
/*============*/
ulint seed); /*!< in: seed */
/********************************************************//**
The following function generates a series of 'random' ulint integers.
@return the next 'random' number */
UNIV_INLINE
ulint
ut_rnd_gen_next_ulint(
/*==================*/
ulint rnd); /*!< in: the previous random number value */
/*********************************************************//**
The following function generates 'random' ulint integers which
enumerate the value space (let there be N of them) of ulint integers
in a pseudo-random fashion. Note that the same integer is repeated
always after N calls to the generator.
@return the 'random' number */
UNIV_INLINE
ulint
ut_rnd_gen_ulint(void);
/*==================*/
/*******************************************************//**
The following function generates a hash value for a ulint integer
to a hash table of size table_size, which should be a prime or some

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -29,74 +29,6 @@ Created 5/30/1994 Heikki Tuuri
#ifndef UNIV_INNOCHECKSUM
#define UT_RND1 151117737
#define UT_RND2 119785373
#define UT_RND3 85689495
#define UT_RND4 76595339
#define UT_SUM_RND2 98781234
#define UT_SUM_RND3 126792457
#define UT_SUM_RND4 63498502
#define UT_XOR_RND1 187678878
#define UT_XOR_RND2 143537923
/** Seed value of ut_rnd_gen_ulint() */
extern ulint ut_rnd_ulint_counter;
/********************************************************//**
This is used to set the random number seed. */
UNIV_INLINE
void
ut_rnd_set_seed(
/*============*/
ulint seed) /*!< in: seed */
{
ut_rnd_ulint_counter = seed;
}
/********************************************************//**
The following function generates a series of 'random' ulint integers.
@return the next 'random' number */
UNIV_INLINE
ulint
ut_rnd_gen_next_ulint(
/*==================*/
ulint rnd) /*!< in: the previous random number value */
{
ulint n_bits;
n_bits = 8 * sizeof(ulint);
rnd = UT_RND2 * rnd + UT_SUM_RND3;
rnd = UT_XOR_RND1 ^ rnd;
rnd = (rnd << 20) + (rnd >> (n_bits - 20));
rnd = UT_RND3 * rnd + UT_SUM_RND4;
rnd = UT_XOR_RND2 ^ rnd;
rnd = (rnd << 20) + (rnd >> (n_bits - 20));
rnd = UT_RND1 * rnd + UT_SUM_RND2;
return(rnd);
}
/********************************************************//**
The following function generates 'random' ulint integers which
enumerate the value space of ulint integers in a pseudo random
fashion. Note that the same integer is repeated always after
2 to power 32 calls to the generator (if ulint is 32-bit).
@return the 'random' number */
UNIV_INLINE
ulint
ut_rnd_gen_ulint(void)
/*==================*/
{
ulint rnd;
ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2;
rnd = ut_rnd_gen_next_ulint(ut_rnd_ulint_counter);
return(rnd);
}
/*******************************************************//**
The following function generates a hash value for a ulint integer
to a hash table of size table_size, which should be a prime

View file

@ -324,7 +324,7 @@ lock_report_trx_id_insanity(
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index) */
trx_id_t max_trx_id) /*!< in: trx_sys.get_max_trx_id() */
{
ut_ad(rec_offs_validate(rec, index, offsets));
@ -348,7 +348,7 @@ lock_check_trx_id_sanity(
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
const ulint* offsets) /*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets) /*!< in: rec_get_offsets(rec, index) */
{
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!rec_is_metadata(rec, *index));
@ -374,7 +374,7 @@ lock_clust_rec_cons_read_sees(
const rec_t* rec, /*!< in: user record which should be read or
passed over by a read cursor */
dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ReadView* view) /*!< in: consistent read view */
{
ut_ad(dict_index_is_clust(index));
@ -1201,7 +1201,7 @@ lock_sec_rec_some_has_impl(
trx_t* caller_trx,/*!<in/out: trx of current thread */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: secondary index */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
{
trx_t* trx;
trx_id_t max_trx_id;
@ -4466,8 +4466,8 @@ static void lock_rec_print(FILE* file, const lock_t* lock, mtr_t& mtr)
putc('\n', file);
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
mtr.start();
@ -4815,7 +4815,7 @@ lock_rec_queue_validate(
const buf_block_t* block, /*!< in: buffer block containing rec */
const rec_t* rec, /*!< in: record to look at */
const dict_index_t* index, /*!< in: index, or NULL if not known */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
{
const lock_t* lock;
ulint heap_no;
@ -4982,8 +4982,8 @@ lock_rec_validate_page(
ulint nth_bit = 0;
ulint i;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(!lock_mutex_own());
@ -5352,8 +5352,8 @@ lock_rec_insert_check_and_lock(
#ifdef UNIV_DEBUG
{
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
const offset_t* offsets;
rec_offs_init(offsets_);
offsets = rec_get_offsets(next_rec, index, offsets_, true,
@ -5512,7 +5512,7 @@ lock_rec_convert_impl_to_expl(
const buf_block_t* block,
const rec_t* rec,
dict_index_t* index,
const ulint* offsets)
const offset_t* offsets)
{
trx_t* trx;
@ -5583,7 +5583,7 @@ lock_clust_rec_modify_check_and_lock(
const rec_t* rec, /*!< in: record which should be
modified */
dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
que_thr_t* thr) /*!< in: query thread */
{
dberr_t err;
@ -5675,8 +5675,8 @@ lock_sec_rec_modify_check_and_lock(
#ifdef UNIV_DEBUG
{
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
const offset_t* offsets;
rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index, offsets_, true,
@ -5720,7 +5720,7 @@ lock_sec_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: secondary index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@ -5790,7 +5790,7 @@ lock_clust_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: clustered index */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@ -5868,8 +5868,8 @@ lock_clust_rec_read_check_and_lock_alt(
que_thr_t* thr) /*!< in: query thread */
{
mem_heap_t* tmp_heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
dberr_t err;
rec_offs_init(offsets_);

View file

@ -35,38 +35,6 @@ Created 10/4/1994 Heikki Tuuri
#include <algorithm>
/*******************************************************************//**
This is a linear congruential generator PRNG. Returns a pseudo random
number between 0 and 2^64-1 inclusive. The formula and the constants
being used are:
X[n+1] = (a * X[n] + c) mod m
where:
X[0] = my_interval_timer()
a = 1103515245 (3^5 * 5 * 7 * 129749)
c = 12345 (3 * 5 * 823)
m = 18446744073709551616 (2^64)
@return number between 0 and 2^64-1 */
static
ib_uint64_t
page_cur_lcg_prng(void)
/*===================*/
{
#define LCG_a 1103515245
#define LCG_c 12345
static uint64_t lcg_current;
if (!lcg_current) {
lcg_current = my_interval_timer();
}
/* no need to "% 2^64" explicitly because lcg_current is
64 bit and this will be done anyway */
lcg_current = LCG_a * lcg_current + LCG_c;
return(lcg_current);
}
#ifdef BTR_CUR_HASH_ADAPT
# ifdef UNIV_SEARCH_PERF_STAT
static ulint page_cur_short_succ;
@ -99,8 +67,8 @@ page_cur_try_search_shortcut(
ibool success = FALSE;
const page_t* page = buf_block_get_frame(block);
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(dtuple_check_typed(tuple));
@ -183,8 +151,8 @@ page_cur_try_search_shortcut_bytes(
ibool success = FALSE;
const page_t* page = buf_block_get_frame(block);
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(dtuple_check_typed(tuple));
@ -255,7 +223,7 @@ page_cur_rec_field_extends(
/*=======================*/
const dtuple_t* tuple, /*!< in: data tuple */
const rec_t* rec, /*!< in: record */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: compare nth field */
{
const dtype_t* type;
@ -331,8 +299,8 @@ page_cur_search_with_match(
const page_zip_des_t* page_zip = buf_block_get_page_zip(block);
#endif /* UNIV_ZIP_DEBUG */
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(dtuple_validate(tuple));
@ -590,8 +558,8 @@ page_cur_search_with_match_bytes(
const page_zip_des_t* page_zip = buf_block_get_page_zip(block);
#endif /* UNIV_ZIP_DEBUG */
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(dtuple_validate(tuple));
@ -803,8 +771,7 @@ page_cur_open_on_rnd_user_rec(
buf_block_t* block, /*!< in: page */
page_cur_t* cursor) /*!< out: page cursor */
{
ulint rnd;
ulint n_recs = page_get_n_recs(buf_block_get_frame(block));
const ulint n_recs = page_get_n_recs(block->frame);
page_cur_set_before_first(block, cursor);
@ -813,11 +780,8 @@ page_cur_open_on_rnd_user_rec(
return;
}
rnd = (ulint) (page_cur_lcg_prng() % n_recs);
do {
page_cur_move_to_next(cursor);
} while (rnd--);
cursor->rec = page_rec_get_nth(block->frame,
ut_rnd_interval(n_recs) + 1);
}
/** Write a redo log record of inserting a record into an index page.
@ -857,11 +821,11 @@ page_cur_insert_rec_write_log(
{
mem_heap_t* heap = NULL;
ulint cur_offs_[REC_OFFS_NORMAL_SIZE];
ulint ins_offs_[REC_OFFS_NORMAL_SIZE];
offset_t cur_offs_[REC_OFFS_NORMAL_SIZE];
offset_t ins_offs_[REC_OFFS_NORMAL_SIZE];
ulint* cur_offs;
ulint* ins_offs;
offset_t* cur_offs;
offset_t* ins_offs;
rec_offs_init(cur_offs_);
rec_offs_init(ins_offs_);
@ -1037,8 +1001,8 @@ page_cur_parse_insert_rec(
ulint info_and_status_bits = 0; /* remove warning */
page_cur_t cursor;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
page = block ? buf_block_get_frame(block) : NULL;
@ -1255,7 +1219,7 @@ page_cur_insert_rec_low(
which the new record is inserted */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
{
byte* insert_buf;
@ -1306,8 +1270,8 @@ page_cur_insert_rec_low(
free_rec = page_header_get_ptr(page, PAGE_FREE);
if (UNIV_LIKELY_NULL(free_rec)) {
/* Try to allocate from the head of the free list. */
ulint foffsets_[REC_OFFS_NORMAL_SIZE];
ulint* foffsets = foffsets_;
offset_t foffsets_[REC_OFFS_NORMAL_SIZE];
offset_t* foffsets = foffsets_;
mem_heap_t* heap = NULL;
rec_offs_init(foffsets_);
@ -1478,7 +1442,7 @@ page_cur_insert_rec_zip(
page_cur_t* cursor, /*!< in/out: page cursor */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
{
byte* insert_buf;
@ -1719,8 +1683,8 @@ page_cur_insert_rec_zip(
if (UNIV_LIKELY_NULL(free_rec)) {
/* Try to allocate from the head of the free list. */
lint extra_size_diff;
ulint foffsets_[REC_OFFS_NORMAL_SIZE];
ulint* foffsets = foffsets_;
offset_t foffsets_[REC_OFFS_NORMAL_SIZE];
offset_t* foffsets = foffsets_;
mem_heap_t* heap = NULL;
rec_offs_init(foffsets_);
@ -2036,8 +2000,8 @@ page_copy_rec_list_end_to_created_page(
byte* log_ptr;
ulint log_data_len;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW);
@ -2260,7 +2224,7 @@ page_cur_parse_delete_rec(
if (block) {
page_t* page = buf_block_get_frame(block);
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
rec_t* rec = page + offset;
rec_offs_init(offsets_);
@ -2288,7 +2252,7 @@ page_cur_delete_rec(
/*================*/
page_cur_t* cursor, /*!< in/out: a page cursor */
const dict_index_t* index, /*!< in: record descriptor */
const ulint* offsets,/*!< in: rec_get_offsets(
const offset_t* offsets,/*!< in: rec_get_offsets(
cursor->rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle
or NULL */
@ -2425,18 +2389,17 @@ page_cur_delete_rec(
#ifdef UNIV_COMPILE_TEST_FUNCS
/*******************************************************************//**
Print the first n numbers, generated by page_cur_lcg_prng() to make sure
Print the first n numbers, generated by ut_rnd_gen() to make sure
(visually) that it works properly. */
void
test_page_cur_lcg_prng(
/*===================*/
test_ut_rnd_gen(
int n) /*!< in: print first n numbers */
{
int i;
unsigned long long rnd;
for (i = 0; i < n; i++) {
rnd = page_cur_lcg_prng();
rnd = ut_rnd_gen();
printf("%llu\t%%2=%llu %%3=%llu %%5=%llu %%7=%llu %%11=%llu\n",
rnd,
rnd % 2,

View file

@ -36,6 +36,7 @@ Created 2/2/1994 Heikki Tuuri
#include "fut0lst.h"
#include "btr0sea.h"
#include "trx0sys.h"
#include <algorithm>
/* THE INDEX PAGE
==============
@ -561,8 +562,8 @@ page_copy_rec_list_end_no_locks(
page_cur_t cur1;
rec_t* cur2;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
page_cur_position(rec, block, &cur1);
@ -791,8 +792,8 @@ page_copy_rec_list_start(
rtr_rec_move_t* rec_move = NULL;
rec_t* ret
= page_rec_get_prev(page_get_supremum_rec(new_page));
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
/* Here, "ret" may be pointing to a user record or the
@ -1028,8 +1029,8 @@ page_delete_rec_list_end(
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
page_t* page = page_align(rec);
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(size == ULINT_UNDEFINED || size < srv_page_size);
@ -1230,8 +1231,8 @@ page_delete_rec_list_start(
mtr_t* mtr) /*!< in: mtr */
{
page_cur_t cur1;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
mem_heap_t* heap = NULL;
rec_offs_init(offsets_);
@ -1718,7 +1719,7 @@ void
page_rec_print(
/*===========*/
const rec_t* rec, /*!< in: physical record */
const ulint* offsets)/*!< in: record descriptor */
const offset_t* offsets)/*!< in: record descriptor */
{
ut_a(!page_rec_is_comp(rec) == !rec_offs_comp(offsets));
rec_print_new(stderr, rec, offsets);
@ -1793,8 +1794,8 @@ page_print_list(
ulint count;
ulint n_recs;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs_init(offsets_);
ut_a((ibool)!!page_is_comp(page) == dict_table_is_comp(index->table));
@ -1906,7 +1907,7 @@ ibool
page_rec_validate(
/*==============*/
const rec_t* rec, /*!< in: physical record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint n_owned;
ulint heap_no;
@ -2391,8 +2392,13 @@ bool page_validate(const page_t* page, const dict_index_t* index)
ulint n_slots;
ibool ret = TRUE;
ulint i;
ulint* offsets = NULL;
ulint* old_offsets = NULL;
offset_t offsets_1[REC_OFFS_NORMAL_SIZE];
offset_t offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_1;
offset_t* old_offsets = offsets_2;
rec_offs_init(offsets_1);
rec_offs_init(offsets_2);
#ifdef UNIV_GIS_DEBUG
if (dict_index_is_spatial(index)) {
@ -2657,11 +2663,7 @@ next_rec:
}
/* set old_offsets to offsets; recycle offsets */
{
ulint* offs = old_offsets;
old_offsets = offsets;
offsets = offs;
}
std::swap(old_offsets, offsets);
}
if (page_is_comp(page)) {
@ -2822,7 +2824,7 @@ page_delete_rec(
page_zip/*!< in: compressed page descriptor */
#endif
,
const ulint* offsets)/*!< in: offsets for record */
const offset_t* offsets)/*!< in: offsets for record */
{
bool no_compress_needed;
buf_block_t* block = pcur->block;

View file

@ -869,7 +869,7 @@ page_zip_compress_node_ptrs(
mem_heap_t* heap) /*!< in: temporary memory heap */
{
int err = Z_OK;
ulint* offsets = NULL;
offset_t* offsets = NULL;
do {
const rec_t* rec = *recs++;
@ -974,7 +974,7 @@ page_zip_compress_clust_ext(
FILE_LOGFILE
z_stream* c_stream, /*!< in/out: compressed page stream */
const rec_t* rec, /*!< in: record */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
const offset_t* offsets, /*!< in: rec_get_offsets(rec) */
ulint trx_id_col, /*!< in: position of of DB_TRX_ID */
byte* deleted, /*!< in: dense directory entry pointing
to the head of the free list */
@ -1113,7 +1113,7 @@ page_zip_compress_clust(
mem_heap_t* heap) /*!< in: temporary memory heap */
{
int err = Z_OK;
ulint* offsets = NULL;
offset_t* offsets = NULL;
/* BTR_EXTERN_FIELD_REF storage */
byte* externs = storage - n_dense
* (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
@ -1933,7 +1933,7 @@ const byte*
page_zip_apply_log_ext(
/*===================*/
rec_t* rec, /*!< in/out: record */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
const offset_t* offsets, /*!< in: rec_get_offsets(rec) */
ulint trx_id_col, /*!< in: position of of DB_TRX_ID */
const byte* data, /*!< in: modification log */
const byte* end) /*!< in: end of modification log */
@ -2034,7 +2034,7 @@ page_zip_apply_log(
/*!< in: heap_no and status bits for
the next record to uncompress */
dict_index_t* index, /*!< in: index of the page */
ulint* offsets)/*!< in/out: work area for
offset_t* offsets)/*!< in/out: work area for
rec_get_offsets_reverse() */
{
const byte* const end = data + size;
@ -2102,7 +2102,7 @@ page_zip_apply_log(
if (val & 1) {
/* Clear the data bytes of the record. */
mem_heap_t* heap = NULL;
ulint* offs;
offset_t* offs;
offs = rec_get_offsets(rec, index, offsets, is_leaf,
ULINT_UNDEFINED, &heap);
memset(rec, 0, rec_offs_data_size(offs));
@ -2256,7 +2256,7 @@ page_zip_decompress_node_ptrs(
sorted by address */
ulint n_dense, /*!< in: size of recs[] */
dict_index_t* index, /*!< in: the index of the page */
ulint* offsets, /*!< in/out: temporary offsets */
offset_t* offsets, /*!< in/out: temporary offsets */
mem_heap_t* heap) /*!< in: temporary memory heap */
{
ulint heap_status = REC_STATUS_NODE_PTR
@ -2446,7 +2446,7 @@ page_zip_decompress_sec(
sorted by address */
ulint n_dense, /*!< in: size of recs[] */
dict_index_t* index, /*!< in: the index of the page */
ulint* offsets) /*!< in/out: temporary offsets */
offset_t* offsets) /*!< in/out: temporary offsets */
{
ulint heap_status = REC_STATUS_ORDINARY
| PAGE_HEAP_NO_USER_LOW << REC_HEAP_NO_SHIFT;
@ -2579,7 +2579,7 @@ page_zip_decompress_clust_ext(
/*==========================*/
z_stream* d_stream, /*!< in/out: compressed page stream */
rec_t* rec, /*!< in/out: record */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
const offset_t* offsets, /*!< in: rec_get_offsets(rec) */
ulint trx_id_col) /*!< in: position of of DB_TRX_ID */
{
ulint i;
@ -2694,7 +2694,7 @@ page_zip_decompress_clust(
ulint n_dense, /*!< in: size of recs[] */
dict_index_t* index, /*!< in: the index of the page */
ulint trx_id_col, /*!< index of the trx_id column */
ulint* offsets, /*!< in/out: temporary offsets */
offset_t* offsets, /*!< in/out: temporary offsets */
mem_heap_t* heap) /*!< in: temporary memory heap */
{
int err;
@ -2998,7 +2998,7 @@ page_zip_decompress_low(
ulint n_dense;/* number of user records on the page */
ulint trx_id_col = ULINT_UNDEFINED;
mem_heap_t* heap;
ulint* offsets;
offset_t* offsets;
ut_ad(page_zip_simple_validate(page_zip));
UNIV_MEM_ASSERT_W(page, srv_page_size);
@ -3122,10 +3122,10 @@ zlib_error:
ulint n = 1 + 1/* node ptr */ + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index);
offsets = static_cast<ulint*>(
offsets = static_cast<offset_t*>(
mem_heap_alloc(heap, n * sizeof(ulint)));
*offsets = n;
rec_offs_set_n_alloc(offsets, n);
}
/* Decompress the records in heap_no order. */
@ -3350,7 +3350,7 @@ page_zip_validate_low(
committed. Let us tolerate that difference when we
are performing a sloppy validation. */
ulint* offsets;
offset_t* offsets;
mem_heap_t* heap;
const rec_t* rec;
const rec_t* trec;
@ -3517,7 +3517,7 @@ page_zip_write_rec_ext(
const page_t* page, /*!< in: page containing rec */
const byte* rec, /*!< in: record being written */
dict_index_t* index, /*!< in: record descriptor */
const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index) */
ulint create, /*!< in: nonzero=insert, zero=update */
ulint trx_id_col, /*!< in: position of DB_TRX_ID */
ulint heap_no, /*!< in: heap number of rec */
@ -3636,7 +3636,7 @@ page_zip_write_rec(
page_zip_des_t* page_zip,/*!< in/out: compressed page */
const byte* rec, /*!< in: record being written */
dict_index_t* index, /*!< in: the index the record belongs to */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint create) /*!< in: nonzero=insert, zero=update */
{
const page_t* page;
@ -3880,7 +3880,7 @@ page_zip_write_blob_ptr(
const byte* rec, /*!< in/out: record whose data is being
written */
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint n, /*!< in: column index */
mtr_t* mtr) /*!< in: mini-transaction handle,
or NULL if no logging is needed */
@ -4101,7 +4101,7 @@ void
page_zip_write_trx_id_and_roll_ptr(
page_zip_des_t* page_zip,
byte* rec,
const ulint* offsets,
const offset_t* offsets,
ulint trx_id_col,
trx_id_t trx_id,
roll_ptr_t roll_ptr,
@ -4240,7 +4240,7 @@ page_zip_clear_rec(
page_zip_des_t* page_zip, /*!< in/out: compressed page */
byte* rec, /*!< in: record to clear */
const dict_index_t* index, /*!< in: index of rec */
const ulint* offsets) /*!< in: rec_get_offsets(rec, index) */
const offset_t* offsets) /*!< in: rec_get_offsets(rec, index) */
{
ulint heap_no;
page_t* page = page_align(rec);
@ -4446,7 +4446,7 @@ page_zip_dir_delete(
page_zip_des_t* page_zip, /*!< in/out: compressed page */
byte* rec, /*!< in: deleted record */
const dict_index_t* index, /*!< in: index of rec */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
const offset_t* offsets, /*!< in: rec_get_offsets(rec) */
const byte* free) /*!< in: previous start of
the free list */
{

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -58,11 +58,7 @@ yylex(void);
%token PARS_NE_TOKEN
%token PARS_PROCEDURE_TOKEN
%token PARS_IN_TOKEN
%token PARS_OUT_TOKEN
%token PARS_BINARY_TOKEN
%token PARS_BLOB_TOKEN
%token PARS_INT_TOKEN
%token PARS_FLOAT_TOKEN
%token PARS_CHAR_TOKEN
%token PARS_IS_TOKEN
%token PARS_BEGIN_TOKEN
@ -75,14 +71,11 @@ yylex(void);
%token PARS_WHILE_TOKEN
%token PARS_RETURN_TOKEN
%token PARS_SELECT_TOKEN
%token PARS_SUM_TOKEN
%token PARS_COUNT_TOKEN
%token PARS_DISTINCT_TOKEN
%token PARS_FROM_TOKEN
%token PARS_WHERE_TOKEN
%token PARS_FOR_TOKEN
%token PARS_DDOT_TOKEN
%token PARS_READ_TOKEN
%token PARS_ORDER_TOKEN
%token PARS_BY_TOKEN
%token PARS_ASC_TOKEN
@ -109,25 +102,14 @@ yylex(void);
%token PARS_FETCH_TOKEN
%token PARS_CLOSE_TOKEN
%token PARS_NOTFOUND_TOKEN
%token PARS_TO_CHAR_TOKEN
%token PARS_TO_NUMBER_TOKEN
%token PARS_TO_BINARY_TOKEN
%token PARS_BINARY_TO_NUMBER_TOKEN
%token PARS_SUBSTR_TOKEN
%token PARS_REPLSTR_TOKEN
%token PARS_CONCAT_TOKEN
%token PARS_INSTR_TOKEN
%token PARS_LENGTH_TOKEN
%token PARS_SYSDATE_TOKEN
%token PARS_PRINTF_TOKEN
%token PARS_ASSERT_TOKEN
%token PARS_RND_TOKEN
%token PARS_RND_STR_TOKEN
%token PARS_ROW_PRINTF_TOKEN
%token PARS_COMMIT_TOKEN
%token PARS_ROLLBACK_TOKEN
%token PARS_WORK_TOKEN
%token PARS_UNSIGNED_TOKEN
%token PARS_EXIT_TOKEN
%token PARS_FUNCTION_TOKEN
%token PARS_LOCK_TOKEN
@ -139,8 +121,6 @@ yylex(void);
%token PARS_LIKE_TOKEN_SUFFIX
%token PARS_LIKE_TOKEN_SUBSTR
%token PARS_TABLE_NAME_TOKEN
%token PARS_COMPACT_TOKEN
%token PARS_BLOCK_SIZE_TOKEN
%token PARS_BIGINT_TOKEN
%left PARS_AND_TOKEN PARS_OR_TOKEN
@ -161,7 +141,6 @@ top_statement:
statement:
stored_procedure_call
| predefined_procedure_call ';'
| while_statement ';'
| for_statement ';'
| exit_statement ';'
@ -170,7 +149,6 @@ statement:
| assignment_statement ';'
| select_statement ';'
| insert_statement ';'
| row_printf_statement ';'
| delete_statement_searched ';'
| delete_statement_positioned ';'
| update_statement_searched ';'
@ -223,18 +201,11 @@ exp:
;
function_name:
PARS_TO_CHAR_TOKEN { $$ = &pars_to_char_token; }
| PARS_TO_NUMBER_TOKEN { $$ = &pars_to_number_token; }
| PARS_TO_BINARY_TOKEN { $$ = &pars_to_binary_token; }
| PARS_BINARY_TO_NUMBER_TOKEN
{ $$ = &pars_binary_to_number_token; }
PARS_TO_BINARY_TOKEN { $$ = &pars_to_binary_token; }
| PARS_SUBSTR_TOKEN { $$ = &pars_substr_token; }
| PARS_CONCAT_TOKEN { $$ = &pars_concat_token; }
| PARS_INSTR_TOKEN { $$ = &pars_instr_token; }
| PARS_LENGTH_TOKEN { $$ = &pars_length_token; }
| PARS_SYSDATE_TOKEN { $$ = &pars_sysdate_token; }
| PARS_RND_TOKEN { $$ = &pars_rnd_token; }
| PARS_RND_STR_TOKEN { $$ = &pars_rnd_str_token; }
;
question_mark_list:
@ -249,17 +220,6 @@ stored_procedure_call:
static_cast<sym_node_t*>($2)); }
;
predefined_procedure_call:
predefined_procedure_name '(' exp_list ')'
{ $$ = pars_procedure_call($1, $3); }
;
predefined_procedure_name:
PARS_REPLSTR_TOKEN { $$ = &pars_replstr_token; }
| PARS_PRINTF_TOKEN { $$ = &pars_printf_token; }
| PARS_ASSERT_TOKEN { $$ = &pars_assert_token; }
;
user_function_call:
PARS_ID_TOKEN '(' ')' { $$ = $1; }
;
@ -287,19 +247,9 @@ select_item:
exp { $$ = $1; }
| PARS_COUNT_TOKEN '(' '*' ')'
{ $$ = pars_func(&pars_count_token,
que_node_list_add_last(NULL,
que_node_list_add_last(NULL,
sym_tab_add_int_lit(
pars_sym_tab_global, 1))); }
| PARS_COUNT_TOKEN '(' PARS_DISTINCT_TOKEN PARS_ID_TOKEN ')'
{ $$ = pars_func(&pars_count_token,
que_node_list_add_last(NULL,
pars_func(&pars_distinct_token,
que_node_list_add_last(
NULL, $4)))); }
| PARS_SUM_TOKEN '(' exp ')'
{ $$ = pars_func(&pars_sum_token,
que_node_list_add_last(NULL,
$3)); }
;
select_item_list:
@ -446,12 +396,6 @@ delete_statement_positioned:
NULL); }
;
row_printf_statement:
PARS_ROW_PRINTF_TOKEN select_statement
{ $$ = pars_row_printf_statement(
static_cast<sel_node_t*>($2)); }
;
assignment_statement:
PARS_ID_TOKEN PARS_ASSIGN_TOKEN exp
{ $$ = pars_assignment_statement(
@ -536,12 +480,12 @@ fetch_statement:
;
column_def:
PARS_ID_TOKEN type_name opt_column_len opt_unsigned opt_not_null
PARS_ID_TOKEN type_name opt_column_len opt_not_null
{ $$ = pars_column_def(
static_cast<sym_node_t*>($1),
static_cast<pars_res_word_t*>($2),
static_cast<sym_node_t*>($3),
$4, $5); }
$4); }
;
column_def_list:
@ -556,13 +500,6 @@ opt_column_len:
{ $$ = $2; }
;
opt_unsigned:
/* Nothing */ { $$ = NULL; }
| PARS_UNSIGNED_TOKEN
{ $$ = &pars_int_token;
/* pass any non-NULL pointer */ }
;
opt_not_null:
/* Nothing */ { $$ = NULL; }
| PARS_NOT_TOKEN PARS_NULL_LIT
@ -570,27 +507,12 @@ opt_not_null:
/* pass any non-NULL pointer */ }
;
compact:
/* Nothing */ { $$ = NULL; }
| PARS_COMPACT_TOKEN { $$ = &pars_int_token;
/* pass any non-NULL pointer */ }
;
block_size:
/* Nothing */ { $$ = NULL; }
| PARS_BLOCK_SIZE_TOKEN '=' PARS_INT_LIT
{ $$ = $3; }
;
create_table:
PARS_CREATE_TOKEN PARS_TABLE_TOKEN
table_name '(' column_def_list ')'
compact block_size
{ $$ = pars_create_table(
static_cast<sym_node_t*>($3),
static_cast<sym_node_t*>($5),
static_cast<sym_node_t*>($7),
static_cast<sym_node_t*>($8)); }
static_cast<sym_node_t*>($5)); }
;
column_list:
@ -642,28 +564,6 @@ type_name:
PARS_INT_TOKEN { $$ = &pars_int_token; }
| PARS_BIGINT_TOKEN { $$ = &pars_bigint_token; }
| PARS_CHAR_TOKEN { $$ = &pars_char_token; }
| PARS_BINARY_TOKEN { $$ = &pars_binary_token; }
| PARS_BLOB_TOKEN { $$ = &pars_blob_token; }
;
parameter_declaration:
PARS_ID_TOKEN PARS_IN_TOKEN type_name
{ $$ = pars_parameter_declaration(
static_cast<sym_node_t*>($1),
PARS_INPUT,
static_cast<pars_res_word_t*>($3)); }
| PARS_ID_TOKEN PARS_OUT_TOKEN type_name
{ $$ = pars_parameter_declaration(
static_cast<sym_node_t*>($1),
PARS_OUTPUT,
static_cast<pars_res_word_t*>($3)); }
;
parameter_declaration_list:
/* Nothing */ { $$ = NULL; }
| parameter_declaration { $$ = que_node_list_add_last(NULL, $1); }
| parameter_declaration_list ',' parameter_declaration
{ $$ = que_node_list_add_last($1, $3); }
;
variable_declaration:
@ -705,16 +605,14 @@ declaration_list:
;
procedure_definition:
PARS_PROCEDURE_TOKEN PARS_ID_TOKEN '(' parameter_declaration_list ')'
PARS_PROCEDURE_TOKEN PARS_ID_TOKEN '(' ')'
PARS_IS_TOKEN
variable_declaration_list
declaration_list
PARS_BEGIN_TOKEN
statement_list
PARS_END_TOKEN { $$ = pars_procedure_definition(
static_cast<sym_node_t*>($2),
static_cast<sym_node_t*>($4),
$10); }
static_cast<sym_node_t*>($2), $9); }
;
%%

View file

@ -249,30 +249,10 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_IN_TOKEN);
}
"OUT" {
return(PARS_OUT_TOKEN);
}
"BINARY" {
return(PARS_BINARY_TOKEN);
}
"BLOB" {
return(PARS_BLOB_TOKEN);
}
"INT" {
return(PARS_INT_TOKEN);
}
"INTEGER" {
return(PARS_INT_TOKEN);
}
"FLOAT" {
return(PARS_FLOAT_TOKEN);
}
"CHAR" {
return(PARS_CHAR_TOKEN);
}
@ -321,18 +301,10 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_SELECT_TOKEN);
}
"SUM" {
return(PARS_SUM_TOKEN);
}
"COUNT" {
return(PARS_COUNT_TOKEN);
}
"DISTINCT" {
return(PARS_DISTINCT_TOKEN);
}
"FROM" {
return(PARS_FROM_TOKEN);
}
@ -345,10 +317,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_FOR_TOKEN);
}
"READ" {
return(PARS_READ_TOKEN);
}
"ORDER" {
return(PARS_ORDER_TOKEN);
}
@ -405,14 +373,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_TABLE_TOKEN);
}
"COMPACT" {
return(PARS_COMPACT_TOKEN);
}
"BLOCK_SIZE" {
return(PARS_BLOCK_SIZE_TOKEN);
}
"INDEX" {
return(PARS_INDEX_TOKEN);
}
@ -453,30 +413,14 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_NOTFOUND_TOKEN);
}
"TO_CHAR" {
return(PARS_TO_CHAR_TOKEN);
}
"TO_NUMBER" {
return(PARS_TO_NUMBER_TOKEN);
}
"TO_BINARY" {
return(PARS_TO_BINARY_TOKEN);
}
"BINARY_TO_NUMBER" {
return(PARS_BINARY_TO_NUMBER_TOKEN);
}
"SUBSTR" {
return(PARS_SUBSTR_TOKEN);
}
"REPLSTR" {
return(PARS_REPLSTR_TOKEN);
}
"CONCAT" {
return(PARS_CONCAT_TOKEN);
}
@ -489,30 +433,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_LENGTH_TOKEN);
}
"SYSDATE" {
return(PARS_SYSDATE_TOKEN);
}
"PRINTF" {
return(PARS_PRINTF_TOKEN);
}
"ASSERT" {
return(PARS_ASSERT_TOKEN);
}
"RND" {
return(PARS_RND_TOKEN);
}
"RND_STR" {
return(PARS_RND_STR_TOKEN);
}
"ROW_PRINTF" {
return(PARS_ROW_PRINTF_TOKEN);
}
"COMMIT" {
return(PARS_COMMIT_TOKEN);
}
@ -525,10 +445,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_WORK_TOKEN);
}
"UNSIGNED" {
return(PARS_UNSIGNED_TOKEN);
}
"EXIT" {
return(PARS_EXIT_TOKEN);
}

Some files were not shown because too many files have changed in this diff Show more