Commit 1ca72a0c authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into bb-10.2-ext

parents 0bb0d522 5d142f99
......@@ -960,9 +960,12 @@ INSERT INTO t1 VALUES (11, 3, DEFAULT, 'mm');
INSERT INTO t1 VALUES (18, 1, DEFAULT, 'mm');
INSERT INTO t1 VALUES (28, 1, DEFAULT, 'mm');
ALTER TABLE t1 ADD INDEX idx12 (c) , FORCE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t1 ADD INDEX idx12 (c), LOCK=NONE;
ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c) , FORCE, LOCK=NONE;
Warnings:
Note 1831 Duplicate index `idx`. This is deprecated and will be disallowed in a future release
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c), LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
DROP TABLE t1 ;
CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), d INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));
INSERT INTO t1 VALUES (11, 3, DEFAULT, DEFAULT, 'mm');
......@@ -1322,6 +1325,8 @@ t CREATE TABLE `t` (
ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD COLUMN j INT, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY
ALTER TABLE t ADD INDEX (x), ADD COLUMN j INT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t ADD INDEX (x), ADD COLUMN j INT, ALGORITHM=INPLACE;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
......
......@@ -53,46 +53,8 @@ a b c h
18 1 19 mm
28 1 29 mm
NULL NULL NULL mx
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
ALTER TABLE t ADD COLUMN x INT;
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR start_create';
start transaction;
update t set a=1 where a = 0;
rollback;
start transaction;
delete from t;
insert into t values(1,null,default,null);
rollback;
start transaction;
update t set b=b+1;
rollback;
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
connection default;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SELECT c FROM t;
c
NULL
3
19
29
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
ALTER TABLE t ADD COLUMN x2 INT;
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR start_create';
start transaction;
DELETE FROM t WHERE a = 0;
ROLLBACK;
DELETE FROM t WHERE a = 0;
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
connection default;
SELECT c FROM t;
c
NULL
19
29
ALTER TABLE t FORCE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
disconnect con1;
DROP TABLE t;
SET DEBUG_SYNC = 'RESET';
......@@ -123,135 +85,4 @@ NULL
19
29
DROP TABLE t;
#
# Bug#22018532 ASSERTION WHEN ONLINE REAPPLY REBUILD LOG ON
# MULTIPLE INDEXED VIRTUAL COLUMNS
#
create table t (
a int as (1) virtual,
b int,
c int as (1) virtual,
unique(b),
unique(c),
key(a)
) engine=innodb;
insert ignore into t values();
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
optimize table t;
connect con1,localhost,root,,;
SET DEBUG_SYNC = 'now WAIT_FOR start_create';
insert ignore into t values();
Warnings:
Warning 1062 Duplicate entry '1' for key 'c'
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
connection default;
/* connection default */ optimize table t;
Table Op Msg_type Msg_text
test.t optimize note Table does not support optimize, doing recreate + analyze instead
test.t optimize error Duplicate entry '1' for key 'a'
test.t optimize status Operation failed
Warnings:
Error 1062 Duplicate entry '1' for key 'a'
SELECT c FROM t;
c
1
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) GENERATED ALWAYS AS (1) VIRTUAL,
`b` int(11) DEFAULT NULL,
`c` int(11) GENERATED ALWAYS AS (1) VIRTUAL,
UNIQUE KEY `b` (`b`),
UNIQUE KEY `c` (`c`),
KEY `a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t;
a b c
1 NULL 1
DROP TABLE t;
CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));
INSERT INTO t VALUES (11, 3, DEFAULT, 'mm');
INSERT INTO t VALUES (18, 1, DEFAULT, 'mm');
INSERT INTO t VALUES (28, 1, DEFAULT, 'mm');
INSERT INTO t VALUES (null, null, DEFAULT, 'mm');
CREATE INDEX idx ON t(c);
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_rebuild WAIT_FOR go_ahead';
optimize table t;
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR start_rebuild';
INSERT INTO t VALUES (48, 2, DEFAULT, 'xx');
INSERT INTO t VALUES (68, 3, DEFAULT, 'sx');
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
connection default;
/* connection default */ optimize table t;
Table Op Msg_type Msg_text
test.t optimize note Table does not support optimize, doing recreate + analyze instead
test.t optimize status OK
SELECT c FROM t;
c
NULL
14
19
29
50
71
disconnect con1;
DROP TABLE t;
#
# Bug#22951879 - ASSERTS RELATED TO ONLINE DDL AND GCOL
#
create table ibstd_14 (a int not null, d int not null, b varchar(198) not null, c char(181), vadcol int as (a+length(d)) stored, vbcol char(2) as (substr(b,2,2)) virtual, vbidxcol char(3) as (substr(b,1,3)) virtual , index(d), index(a), index(vbidxcol), index(a,vbidxcol), index(vbidxcol,d), unique key (b(10), a, d), index(c(99), b(31)), index(b(5), c(10), a) , index(a,d)) engine=InnoDB stats_persistent=1 row_format=dynamic;
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
alter table ibstd_14 row_format=compressed key_block_size=4,add key kn3 (d,c,vbcol,b);
connect con1,localhost,root;
SET DEBUG_SYNC = 'now WAIT_FOR start_create';
insert into ibstd_14 (a,d,b,c, vbidxcol, vbcol) values ('118','6',repeat('oacolaarlruoacuroauurloraarucoooarcooauoolacalllaulrruarrrucruuooclacuoouccarrcoocloccorrrrarourcooalloocooccouruolaorlcaocualolc','1'),repeat('lolrrlalcocroraaulauclaaucolcorcuooaolruaooooluooooouaoorlarucorullalcrrloccououaooaorluorraclrcooouuolocoaolcocaaculruoocucoocoooauuolarcoraraocaoolulolarru','1'),default,default);
insert into ibstd_14 (a,d,b,c, vbidxcol, vbcol) values ('118','6', 'aaaa', 'lll', default, default);
update ibstd_14 set b='11111' where b='aaaa';
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
connection default;
select * from ibstd_14;
a d b c vadcol vbcol vbidxcol
118 6 oacolaarlruoacuroauurloraarucoooarcooauoolacalllaulrruarrrucruuooclacuoouccarrcoocloccorrrrarourcooalloocooccouruolaorlcaocualolc lolrrlalcocroraaulauclaaucolcorcuooaolruaooooluooooouaoorlarucorullalcrrloccououaooaorluorraclrcooouuolocoaolcocaaculruoocucoocoooauuolarcoraraocaoolulolarru 119 ac oac
118 6 11111 lll 119 11 111
select d,c,vbcol,b from ibstd_14;
d c vbcol b
6 lll 11 11111
6 lolrrlalcocroraaulauclaaucolcorcuooaolruaooooluooooouaoorlarucorullalcrrloccououaooaorluorraclrcooouuolocoaolcocaaculruoocucoocoooauuolarcoraraocaoolulolarru ac oacolaarlruoacuroauurloraarucoooarcooauoolacalllaulrruarrrucruuooclacuoouccarrcoocloccorrrrarourcooalloocooccouruolaorlcaocualolc
select vbcol from ibstd_14;
vbcol
11
ac
drop table ibstd_14;
#
# Bug#22018745 CORRUPTION IN ONLINE TABLE REBUILD
# (ROW_FORMAT=REDUNDANT, INDEXED VIRTUAL COLUMN)
#
CREATE TABLE t (
b char(5) PRIMARY KEY,
v char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, KEY(v)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT;
connection con1;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL prepared WAIT_FOR apply';
OPTIMIZE TABLE t;
connection default;
SET DEBUG_SYNC='now WAIT_FOR prepared';
INSERT INTO t SET b='fubar';
BEGIN;
DELETE FROM t;
ROLLBACK;
SET DEBUG_SYNC='now SIGNAL apply';
connection con1;
Table Op Msg_type Msg_text
test.t optimize note Table does not support optimize, doing recreate + analyze instead
test.t optimize status OK
connection default;
CHECK TABLE t;
Table Op Msg_type Msg_text
test.t check status OK
SELECT * FROM t;
b v
fubar fub
DROP TABLE t;
disconnect con1;
SET DEBUG_SYNC = 'RESET';
CREATE TABLE t1 (j SERIAL, i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB;
CREATE TABLE t2 (j SERIAL, i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB
ROW_FORMAT=REDUNDANT;
CREATE TABLE t3 (i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB;
CREATE TABLE t4 (i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB
ROW_FORMAT=REDUNDANT;
INSERT INTO t4 SET i=1;
ALTER TABLE t4 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t4 ADD COLUMN k INT, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t4 ADD COLUMN k INT;
ALTER TABLE t4 DROP k, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t4 DROP INDEX v, LOCK=NONE;
ALTER TABLE t4 DROP k, LOCK=NONE;
INSERT INTO t3 SET i=1;
ALTER TABLE t3 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t3 ADD COLUMN k INT, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t3 ADD COLUMN k INT;
ALTER TABLE t3 DROP k, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t3 DROP INDEX v, LOCK=NONE;
ALTER TABLE t3 DROP k, LOCK=NONE;
INSERT INTO t2 SET i=1;
ALTER TABLE t2 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t2 ADD COLUMN k INT, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t2 ADD COLUMN k INT;
ALTER TABLE t2 DROP k, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t2 DROP INDEX v, LOCK=NONE;
ALTER TABLE t2 DROP k, LOCK=NONE;
INSERT INTO t1 SET i=1;
ALTER TABLE t1 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t1 ADD COLUMN k INT, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t1 ADD COLUMN k INT;
ALTER TABLE t1 DROP k, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t1 DROP INDEX v, LOCK=NONE;
ALTER TABLE t1 DROP k, LOCK=NONE;
connect ddl,localhost,root,,test;
connection default;
connection ddl;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL copied WAIT_FOR dml';
ALTER TABLE t4 FORCE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR copied';
BEGIN;
UPDATE t4 SET i = 0;
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL dml';
connection ddl;
connection default;
SELECT * FROM t4;
i v
1 1
DROP TABLE t4;
connection ddl;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL copied WAIT_FOR dml';
ALTER TABLE t3 FORCE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR copied';
BEGIN;
UPDATE t3 SET i = 0;
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL dml';
connection ddl;
connection default;
SELECT * FROM t3;
i v
1 1
DROP TABLE t3;
connection ddl;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL copied WAIT_FOR dml';
ALTER TABLE t2 FORCE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR copied';
BEGIN;
UPDATE t2 SET i = 0;
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL dml';
connection ddl;
connection default;
SELECT * FROM t2;
j i v
1 1 1
DROP TABLE t2;
connection ddl;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL copied WAIT_FOR dml';
ALTER TABLE t1 FORCE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR copied';
BEGIN;
UPDATE t1 SET i = 0;
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL dml';
connection ddl;
connection default;
SELECT * FROM t1;
j i v
1 1 1
DROP TABLE t1;
disconnect ddl;
SET DEBUG_SYNC = 'RESET';
......@@ -877,8 +877,13 @@ INSERT INTO t1 VALUES (18, 1, DEFAULT, 'mm');
INSERT INTO t1 VALUES (28, 1, DEFAULT, 'mm');
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 ADD INDEX idx12 (c) , FORCE, LOCK=NONE;
ALTER TABLE t1 ADD INDEX idx12 (c), LOCK=NONE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c) , FORCE, LOCK=NONE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c), LOCK=NONE;
DROP TABLE t1 ;
......@@ -1304,8 +1309,9 @@ SHOW CREATE TABLE t;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t ADD COLUMN i INT GENERATED ALWAYS AS(a+a+b), ADD COLUMN j INT, ALGORITHM=INPLACE;
# Add an index along with adding a regular column is allowed.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t ADD INDEX (x), ADD COLUMN j INT, ALGORITHM=INPLACE, LOCK=NONE;
ALTER TABLE t ADD INDEX (x), ADD COLUMN j INT, ALGORITHM=INPLACE;
SHOW CREATE TABLE t;
# Online add an index on newly added virtual column is not allowed.
......
......@@ -53,8 +53,11 @@ SELECT c FROM t;
SHOW CREATE TABLE t;
SELECT * FROM t;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t FORCE, LOCK=NONE;
if (0) {# MDEV-14341 TODO: re-enable this
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
--send ALTER TABLE t ADD COLUMN x INT
--send ALTER TABLE t FORCE
connection con1;
......@@ -78,7 +81,7 @@ check table t;
SELECT c FROM t;
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
--send ALTER TABLE t ADD COLUMN x2 INT
--send ALTER TABLE t FORCE
connection con1;
......@@ -93,6 +96,7 @@ connection default;
reap;
SELECT c FROM t;
}
disconnect con1;
DROP TABLE t;
......@@ -129,7 +133,7 @@ SELECT c FROM t;
DROP TABLE t;
if (0) {# MDEV-14341 TODO: re-enable LOCK=NONE and these tests
--echo #
--echo # Bug#22018532 ASSERTION WHEN ONLINE REAPPLY REBUILD LOG ON
--echo # MULTIPLE INDEXED VIRTUAL COLUMNS
......@@ -264,7 +268,7 @@ SELECT * FROM t;
DROP TABLE t;
disconnect con1;
}
SET DEBUG_SYNC = 'RESET';
--source include/wait_until_count_sessions.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
CREATE TABLE t1 (j SERIAL, i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB;
CREATE TABLE t2 (j SERIAL, i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB
ROW_FORMAT=REDUNDANT;
CREATE TABLE t3 (i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB;
CREATE TABLE t4 (i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB
ROW_FORMAT=REDUNDANT;
let $n=4;
while ($n)
{
eval INSERT INTO t$n SET i=1;
eval ALTER TABLE t$n ADD INDEX(v), LOCK=NONE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
eval ALTER TABLE t$n ADD COLUMN k INT, LOCK=NONE;
eval ALTER TABLE t$n ADD COLUMN k INT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
eval ALTER TABLE t$n DROP k, LOCK=NONE;
eval ALTER TABLE t$n DROP INDEX v, LOCK=NONE;
eval ALTER TABLE t$n DROP k, LOCK=NONE;
dec $n;
}
connect (ddl,localhost,root,,test);
connection default;
let $n=4;
while ($n)
{
connection ddl;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL copied WAIT_FOR dml';
send_eval ALTER TABLE t$n FORCE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR copied';
BEGIN;
eval UPDATE t$n SET i = 0;
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL dml';
connection ddl;
reap;
connection default;
eval SELECT * FROM t$n;
eval DROP TABLE t$n;
dec $n;
}
disconnect ddl;
SET DEBUG_SYNC = 'RESET';
......@@ -4707,7 +4707,7 @@ btr_cur_del_mark_set_clust_rec(
<< rec_printer(rec, offsets).str());
if (dict_index_is_online_ddl(index)) {
row_log_table_delete(rec, entry, index, offsets, NULL);
row_log_table_delete(rec, index, offsets, NULL);
}
row_upd_rec_sys_fields(rec, page_zip, index, offsets, trx, roll_ptr);
......
......@@ -372,6 +372,26 @@ innobase_fulltext_exist(
return(false);
}
/** Determine whether indexed virtual columns exist in a table.
@param[in] table table definition
@return whether indexes exist on virtual columns */
static bool innobase_indexed_virtual_exist(const TABLE* table)
{
const KEY* const end = &table->key_info[table->s->keys];
for (const KEY* key = table->key_info; key < end; key++) {
const KEY_PART_INFO* const key_part_end = key->key_part
+ key->user_defined_key_parts;
for (const KEY_PART_INFO* key_part = key->key_part;
key_part < key_part_end; key_part++) {
if (!key_part->field->stored_in_db())
return true;
}
}
return false;
}
/** Determine if spatial indexes exist in a given table.
@param table MySQL table
@return whether spatial indexes exist on the table */
......@@ -903,9 +923,11 @@ ha_innobase::check_if_supported_inplace_alter(
& Alter_inplace_info::ADD_PK_INDEX)
|| innobase_need_rebuild(ha_alter_info, table))
&& (innobase_fulltext_exist(altered_table)
|| innobase_spatial_exist(altered_table))) {
|| innobase_spatial_exist(altered_table)
|| innobase_indexed_virtual_exist(altered_table))) {
/* Refuse to rebuild the table online, if
FULLTEXT OR SPATIAL indexes are to survive the rebuild. */
FULLTEXT OR SPATIAL indexes or indexed virtual columns
are to survive the rebuild. */
online = false;
/* If the table already contains fulltext indexes,
refuse to rebuild the table natively altogether. */
......@@ -919,6 +941,10 @@ ha_innobase::check_if_supported_inplace_alter(
ha_alter_info->unsupported_reason =
innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
} else if (!innobase_fulltext_exist(altered_table)) {
/* MDEV-14341 FIXME: Remove this limitation. */
ha_alter_info->unsupported_reason =
"online rebuild with indexed virtual columns";
} else {
ha_alter_info->unsupported_reason =
innobase_get_err_msg(
......@@ -1054,8 +1080,6 @@ ha_innobase::check_if_supported_inplace_alter(
af++;
}
cf_it.rewind();
DBUG_RETURN(online
? HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE
: HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE);
......
......@@ -794,29 +794,6 @@ rec_get_converted_size_temp(
ulint* extra)
MY_ATTRIBUTE((warn_unused_result, nonnull(1,2)));
/** Determine the converted size of virtual column data in a temporary file.
@see rec_convert_dtuple_to_temp_v()
@param[in] index clustered index
@param[in] v clustered index record augmented with the values
of virtual columns
@return size in bytes */
ulint
rec_get_converted_size_temp_v(const dict_index_t* index, const dtuple_t* v)
MY_ATTRIBUTE((warn_unused_result, nonnull));
/** Write indexed virtual column data into a temporary file.
@see rec_get_converted_size_temp_v()
@param[out] rec serialized record
@param[in] index clustered index
@param[in] v_entry clustered index record augmented with the values
of virtual columns */
void
rec_convert_dtuple_to_temp_v(
byte* rec,
const dict_index_t* index,
const dtuple_t* v_entry)
MY_ATTRIBUTE((nonnull));
/******************************************************//**
Determine the offset to each field in temporary file.
@see rec_convert_dtuple_to_temp() */
......
/*****************************************************************************
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 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
......@@ -131,7 +132,6 @@ row_log_table_delete(
/*=================*/
const rec_t* rec, /*!< in: clustered index leaf page record,
page X-latched */
const dtuple_t* ventry, /*!< in: dtuple holding virtual column info */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
......@@ -150,12 +150,8 @@ row_log_table_update(
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
const dtuple_t* old_pk, /*!< in: row_log_table_get_pk()
const dtuple_t* old_pk);/*!< in: row_log_table_get_pk()
before the update */
const dtuple_t* new_v_row,/*!< in: dtuple contains the new virtual
columns */
const dtuple_t* old_v_row);/*!< in: dtuple contains the old virtual
columns */
/******************************************************//**
Constructs the old PRIMARY KEY and DB_TRX_ID,DB_ROLL_PTR
......@@ -184,7 +180,6 @@ row_log_table_insert(
/*=================*/
const rec_t* rec, /*!< in: clustered index leaf page record,
page X-latched */
const dtuple_t* ventry, /*!< in: dtuple holding virtual column info */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
const ulint* offsets);/*!< in: rec_get_offsets(rec,index) */
......
......@@ -292,15 +292,13 @@ trx_undo_rec_get_col_val(
@param[in] table the table
@param[in] ptr undo log pointer
@param[in,out] row the dtuple to fill
@param[in] in_purge called by purge thread
@param[in] col_map online rebuild column map */
@param[in] in_purge whether this is called by purge */
void
trx_undo_read_v_cols(
const dict_table_t* table,
const byte* ptr,
const dtuple_t* row,
bool in_purge,
const ulint* col_map);
bool in_purge);
/** Read virtual column index from undo log if the undo log contains such
info, and verify the column is still indexed, and output its position
......
......@@ -936,49 +936,6 @@ rec_get_converted_size_comp_prefix_low(
return(extra_size + data_size);
}
/** Determine the converted size of virtual column data in a temporary file.
@see rec_convert_dtuple_to_temp_v()
@param[in] index clustered index
@param[in] v clustered index record augmented with the values
of virtual columns
@return size in bytes */
ulint
rec_get_converted_size_temp_v(const dict_index_t* index, const dtuple_t* v)
{
ut_ad(dict_index_is_clust(index));
/* length marker */
ulint data_size = 2;
const ulint n_v_fields = dtuple_get_n_v_fields(v);
for (ulint i = 0; i < n_v_fields; i++) {
const dict_v_col_t* col
= dict_table_get_nth_v_col(index->table, i);
/* Only those indexed needs to be logged */
if (!col->m_col.ord_part) {
continue;
}
data_size += mach_get_compressed_size(i + REC_MAX_N_FIELDS);
const dfield_t* vfield = dtuple_get_nth_v_field(v, col->v_pos);
ulint flen = vfield->len;
if (flen != UNIV_SQL_NULL) {
flen = ut_min(
flen,
static_cast<ulint>(
DICT_MAX_FIELD_LEN_BY_FORMAT(
index->table)));
data_size += flen;
}
data_size += mach_get_compressed_size(flen);
}
return(data_size);
}
/**********************************************************//**
Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
@return total size */
......@@ -1376,68 +1333,6 @@ rec_convert_dtuple_to_rec_comp(
}
}
/** Write indexed virtual column data into a temporary file.
@see rec_get_converted_size_temp_v()
@param[out] rec serialized record
@param[in] index clustered index
@param[in] v_entry clustered index record augmented with the values
of virtual columns */
void
rec_convert_dtuple_to_temp_v(
byte* rec,
const dict_index_t* index,
const dtuple_t* v_entry)
{
ut_ad(dict_index_is_clust(index));
const ulint num_v = dtuple_get_n_v_fields(v_entry);
/* reserve 2 bytes for writing length */
byte* ptr = rec;
ptr += 2;
/* Now log information on indexed virtual columns */
for (ulint col_no = 0; col_no < num_v; col_no++) {
dfield_t* vfield;
ulint flen;
const dict_v_col_t* col
= dict_table_get_nth_v_col(index->table, col_no);
if (col->m_col.ord_part) {
ulint pos = col_no;
pos += REC_MAX_N_FIELDS;
ptr += mach_write_compressed(ptr, pos);
vfield = dtuple_get_nth_v_field(
v_entry, col->v_pos);
flen = vfield->len;
if (flen != UNIV_SQL_NULL) {
/* The virtual column can only be in sec
index, and index key length is bound by
DICT_MAX_FIELD_LEN_BY_FORMAT */
flen = ut_min(
flen,
static_cast<ulint>(
DICT_MAX_FIELD_LEN_BY_FORMAT(
index->table)));
}
ptr += mach_write_compressed(ptr, flen);
if (flen != UNIV_SQL_NULL) {
ut_memcpy(ptr, dfield_get_data(vfield), flen);
ptr += flen;
}
}
}
mach_write_to_2(rec, ptr - rec);
}
/*********************************************************//**
Builds a new-style physical record out of a data tuple and
stores it beginning from the start of the given buffer.
......
......@@ -2507,8 +2507,7 @@ row_ins_index_entry_big_rec(
if (error == DB_SUCCESS
&& dict_index_is_online_ddl(index)) {
row_log_table_insert(btr_pcur_get_rec(&pcur), entry,
index, offsets);
row_log_table_insert(btr_pcur_get_rec(&pcur), index, offsets);
}
mtr.commit();
......@@ -2689,7 +2688,7 @@ row_ins_clust_index_entry_low(
entry_heap, entry, thr, &mtr);
if (err == DB_SUCCESS && dict_index_is_online_ddl(index)) {
row_log_table_insert(btr_cur_get_rec(cursor), entry,
row_log_table_insert(btr_cur_get_rec(cursor),
index, offsets);
}
......@@ -2749,7 +2748,7 @@ row_ins_clust_index_entry_low(
if (err == DB_SUCCESS
&& dict_index_is_online_ddl(index)) {
row_log_table_insert(
insert_rec, entry, index, offsets);
insert_rec, index, offsets);
}
mtr_commit(&mtr);
......
This diff is collapsed.
......@@ -116,7 +116,7 @@ row_undo_ins_remove_clust_rec(
mem_heap_t* heap = NULL;
const ulint* offsets = rec_get_offsets(
rec, index, NULL, true, ULINT_UNDEFINED, &heap);
row_log_table_delete(rec, node->row, index, offsets, NULL);
row_log_table_delete(rec, index, offsets, NULL);
mem_heap_free(heap);
}
......@@ -380,7 +380,7 @@ row_undo_ins_parse_undo_rec(
}
if (node->table->n_v_cols) {
trx_undo_read_v_cols(node->table, ptr,
node->row, false, NULL);
node->row, false);
}
} else {
......
......@@ -334,18 +334,16 @@ row_undo_mod_clust(
switch (node->rec_type) {
case TRX_UNDO_DEL_MARK_REC:
row_log_table_insert(
btr_pcur_get_rec(pcur), node->row,
index, offsets);
btr_pcur_get_rec(pcur), index, offsets);
break;
case TRX_UNDO_UPD_EXIST_REC:
row_log_table_update(
btr_pcur_get_rec(pcur), index, offsets,
rebuilt_old_pk, node->undo_row, node->row);
rebuilt_old_pk);
break;
case TRX_UNDO_UPD_DEL_REC:
row_log_table_delete(
btr_pcur_get_rec(pcur), node->row,
index, offsets, sys);
btr_pcur_get_rec(pcur), index, offsets, sys);
break;
default:
ut_ad(0);
......
......@@ -2902,18 +2902,9 @@ row_upd_clust_rec(
if (err == DB_SUCCESS) {
success:
if (dict_index_is_online_ddl(index)) {
dtuple_t* new_v_row = NULL;
dtuple_t* old_v_row = NULL;
if (!(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
new_v_row = node->upd_row;
old_v_row = node->update->old_vrow;
}
row_log_table_update(
btr_cur_get_rec(btr_cur),
index, offsets, rebuilt_old_pk, new_v_row,
old_v_row);
index, offsets, rebuilt_old_pk);
}
}
......
......@@ -2359,7 +2359,7 @@ trx_undo_prev_version_build(
ut_ad(index->table->n_v_cols);
trx_undo_read_v_cols(index->table, ptr, *vrow,
v_status & TRX_UNDO_PREV_IN_PURGE, NULL);
v_status & TRX_UNDO_PREV_IN_PURGE);
}
return(true);
......@@ -2368,16 +2368,14 @@ trx_undo_prev_version_build(
/** Read virtual column value from undo log
@param[in] table the table
@param[in] ptr undo log pointer
@param[in,out] row the row struct to fill
@param[in] in_purge called by purge thread
@param[in] col_map online rebuild column map */
@param[in,out] row the dtuple to fill
@param[in] in_purge whether this is called by purge */
void
trx_undo_read_v_cols(
const dict_table_t* table,
const byte* ptr,
const dtuple_t* row,
bool in_purge,
const ulint* col_map)
bool in_purge)
{
const byte* end_ptr;
bool first_v_col = true;
......@@ -2417,21 +2415,10 @@ trx_undo_read_v_cols(
}
if (is_virtual) {
ulint col_no;
dict_v_col_t* vcol = dict_table_get_nth_v_col(
table, field_no);
if (!col_map) {
col_no = vcol->v_pos;
} else {
col_no = col_map[vcol->v_pos];
}
if (col_no == ULINT_UNDEFINED) {
continue;
}
dfield = dtuple_get_nth_v_field(row, col_no);
dfield = dtuple_get_nth_v_field(row, vcol->v_pos);
if (!in_purge
|| dfield_get_type(dfield)->mtype == DATA_MISSING) {
......
......@@ -21,6 +21,7 @@ b CHAR(30),
PRIMARY KEY(pk) COMMENT "cf1",
KEY(a)
) COLLATE 'latin1_bin' PARTITION BY KEY() PARTITIONS 4;
connect other,localhost,root,,;
set session transaction isolation level repeatable read;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE
......@@ -29,6 +30,7 @@ start transaction with consistent snapshot;
select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS';
STAT_TYPE VALUE
DB_NUM_SNAPSHOTS 1
connection default;
set rocksdb_bulk_load=1;
set rocksdb_bulk_load_size=100000;
LOAD DATA INFILE <input_file> INTO TABLE t1;
......@@ -79,4 +81,5 @@ count(b)
5000000
longfilenamethatvalidatesthatthiswillgetdeleted.bulk_load.tmp
test.bulk_load.tmp
disconnect other;
DROP TABLE t1, t2, t3;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment