Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tianmu): merge to Stonedb 5.7 stable #1919

Merged
merged 127 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
0a2f9be
docs(downlaod):update the docs of download(#1453)
Nliver Mar 20, 2023
dd8247b
fix(mtr):Resolve the nightly run error problem(#1458)
konghaiya Mar 21, 2023
e06793e
fix(workflow): fix can not run lcov in workflow
RingsC Mar 16, 2023
4193cf6
feat(tianmu):New configuration parameters: "tianmu_mandatory" and "ti…
konghaiya Mar 22, 2023
3dcc3fd
feat(tianmu):Discard "MANDATORY_TIANMU" and "NO_KEY_ERROR" in (sql_mode)
konghaiya Mar 22, 2023
ef58f6c
feat(tianmu):Resolve the issue of warning messages when setting new p…
konghaiya Mar 22, 2023
05db04d
fix(tianmu):(Primary/Secondary)Error 1032 occasionally occurs during …
konghaiya Mar 22, 2023
1fa5661
test(mtr): add integer/unsigned/in subquery/create temporary testcase…
davidshiz Mar 23, 2023
fd653e1
docs(v1.0.3): update the docs for v1.0.3
Nliver Mar 30, 2023
37beb82
fix(dcoker): FixDocker deployment commands(#1499)
Nliver Mar 30, 2023
45874be
feat: add Baidu statistics script(#1498)
Nliver Mar 30, 2023
d29544b
fix(website): fix Baidu statistics script(#1502)
Nliver Mar 30, 2023
9c87c73
test(mtr): Optimize parallel scheduling to execute more innodb engine…
davidshiz Mar 30, 2023
4bd09ac
fix crash when the aggregated element was decimal (#1402)
adofsauron Mar 31, 2023
ee41be0
build(deps): bump nth-check and unist-util-select in /website
dependabot[bot] Mar 31, 2023
b90030f
docs(deploy): Update the document and fix the link
Nliver Mar 31, 2023
3ac5796
update the copyright
Nliver Mar 31, 2023
e7de186
update the readme(#1324)
Nliver Mar 31, 2023
a4c5f7c
Create FUNDING.yml
stoneatomadmin Apr 3, 2023
7484c58
Update FUNDING.yml
stoneatomadmin Apr 3, 2023
e7bbe88
remove dup lines in git workflow
zzzz-vincent Apr 5, 2023
82b249a
feat(tianmu): mv func from public to protected(#1501)
zzzz-vincent Apr 4, 2023
7b03c28
style change
zzzz-vincent Apr 4, 2023
e049e3b
strip spaces
zzzz-vincent Apr 4, 2023
1675216
remove dup lines
zzzz-vincent Apr 4, 2023
59e9174
change to uint
zzzz-vincent Apr 4, 2023
d49df15
fix(tianmu):Resolve DDL and insert inot select Possible space inflati…
konghaiya Mar 20, 2023
1de9a91
feat(tianmu):Reconstruct direct insert into parallel execution, impro…
konghaiya Mar 28, 2023
bcc42ad
feat(tianmu):Add code comments for easy understanding
konghaiya Mar 28, 2023
9d45726
fix(tianmu):The myloader cann't work if the autocommit is closed. (#1…
konghaiya Apr 4, 2023
03f5df2
fix(core): fix bug: The instance occasionally crashes if both fields …
wisehead Apr 4, 2023
65e7c25
fix: page hover font style
Agility6 Apr 7, 2023
166f87a
feat(mtr): To fix the mtr usage
RingsC Apr 10, 2023
56cd1f3
fix(tianmu):The mysqld is crashed when you are starting replication.(…
konghaiya Apr 4, 2023
44d6ff8
feat(tianmu):Add delta layer mtr
konghaiya Apr 11, 2023
758bce8
bug 1538:The instance occasionally crashes when the parallel degree i…
wisehead Apr 10, 2023
8146e9b
feat(tianmu): To support vocalno framwork
RingsC Apr 10, 2023
16d2c01
docs(quickstart): add stonedb-8.0 compiling guide #1449
Double0101 Apr 3, 2023
8a4b65b
fix(website): fix website error #1449
Double0101 Apr 11, 2023
d0665f9
feat(tianmu): support volcano framewrok (#1546)
RingsC Apr 12, 2023
8e197ae
fix(tianmu): revert code, mv ret value from try block back to catch b…
Dysprosium0626 Apr 13, 2023
45e75ee
feat(tiamnu): hard code in defs.h (#1481)
zzzz-vincent Apr 6, 2023
f8cf62b
docs:update the compile guides #1562
Apr 14, 2023
09f0e40
test(mtr): add more innodb testcases and tianmu range testcase(#1196)
davidshiz Apr 16, 2023
99c5e80
fix(tianmu):Remove excess log printing and add some code comments(#1545)
konghaiya Apr 11, 2023
4b7c64b
fix(tianmu): fix mysqld crash when exec query with AggregateRough, as…
adofsauron Apr 19, 2023
e510ad3
fix(website): fix the download link of 5.7(#1518)
Nliver Apr 19, 2023
f79002e
feat(website): update the latest content(#1587)
Nliver Apr 19, 2023
6e56cef
feat(tianmu): support volcano framework (#1554)
RingsC Apr 19, 2023
875be6f
fix: max-width navbar search style
Agility6 Apr 20, 2023
c8c37fd
feat(website): upgrade the docusaurus version(#1604)
Nliver Apr 20, 2023
6b56366
fix(website): fix Roadmap module location(#1597)
Nliver Apr 20, 2023
2f6ae10
website(community): update the content
Nliver Apr 20, 2023
ba8cead
feat(website): update the logo of XinChuang(#1590)
Nliver Apr 20, 2023
0b1c15a
fix(tianmu):The instance occasionally crashes when the memory leak. (…
konghaiya Apr 17, 2023
feb4b53
fix(tianmu):Modify merge_ The assignment method of ID, delaying the a…
konghaiya Apr 18, 2023
6703037
fix(tianmu):Fix bug in delta layer initialization
konghaiya Apr 18, 2023
2e4dbdc
fix(tianmu):Resolve the issue of assertion failure caused by memory a…
konghaiya Apr 19, 2023
31919be
fix(tianmu):Code format adjustment
konghaiya Apr 20, 2023
561f653
fix(website): fix the wrong QR code(#1624)
Nliver Apr 26, 2023
29000c9
feat(tianmu):Add delta layer information output and table name output
konghaiya Apr 26, 2023
32cb03c
fix(tianmu):Perfect atomic operations for delta_table
konghaiya Apr 26, 2023
cc8a96b
feat(tianmu):Optimize delta layer merge operations to remove useless …
konghaiya Apr 26, 2023
f1a7259
fix(tianmu):assert failed on ptr == buff.get() + data_.sum_len at pac…
konghaiya Apr 26, 2023
4a41514
fix(tianmu):assert failed on oldv <= dpn_->max_i at pack_int.cpp:337 …
konghaiya Apr 26, 2023
70f15f1
feat(tianmu):Increase assertion printing information and optimize cod…
konghaiya Apr 26, 2023
587d276
fix(tianmu): fix mysqld crash when query where JOIN::propagate_de…
adofsauron Apr 27, 2023
4a35d96
fix(tianmu): fix MySQL server has gone away when exec query (#164…
adofsauron Apr 28, 2023
57e3497
fix(tianmu):Support insert ignore syntax (#1637)
konghaiya Apr 28, 2023
1ba5663
fix(tianmu): fix query input variables wrong result (#1647)
adofsauron May 5, 2023
70bdb91
fix(tianmu): fix result of the query using the subquery derived t…
adofsauron May 6, 2023
b728610
fix(tianmu): fix results of two queries using a derived table and…
adofsauron May 6, 2023
c95d263
feat(tianmu): Test cases that supplement custom variables (#1703)
adofsauron May 6, 2023
2daac7c
fix(tianmu): fix mysqld crash when assigning return values using …
adofsauron May 8, 2023
74b5b05
fix(tianmu): Insert ignore can insert duplicate values.(#1699)
konghaiya May 8, 2023
a33ba87
fix(tianmu): fix error occurred in the union all query result (#1…
adofsauron May 8, 2023
6ed8fb1
remove unused code block
zzzz-vincent May 1, 2023
8d438e1
fix bug and change test case exptected result
zzzz-vincent May 7, 2023
b16bfaa
add stonedb-8.0 compiling guide for CentOS 7.x
Xinqiangxu May 9, 2023
c4d2d2f
docs(quickstart): add stonedb-8.0 compiling guide(Chinese) for CentOS…
Xinqiangxu May 10, 2023
304df8e
fix(tianmu):Even if a primary key is defined, duplicate data may be i…
konghaiya May 10, 2023
2c96b13
add delete/drop into tianmu log stat
duanjr May 8, 2023
d9b4126
open log for all cmds
duanjr May 9, 2023
141918d
fit format
duanjr May 10, 2023
c3931fe
fix(tianmu): fix Error result set of the IN subquery with semi jo…
adofsauron May 11, 2023
65585be
doc(develop-guide): modify method for complie stonedb using docker
Dysprosium0626 May 10, 2023
20abfc7
docs:add docker compile guide of stonedb8.0.(#1780)
May 16, 2023
9b50843
feature: remove DBUG_OFF and repalce DEBUG_ASSERT with assert
duanjr May 8, 2023
72a160c
automatically formatting
duanjr May 9, 2023
9805e07
fix: fix storage of DT type
duanjr May 9, 2023
6c11356
fix incorrect result of TIME type by distinguishing the processing of…
duanjr May 11, 2023
69a49bd
fix(tinmu): fix tianmu crash when set varchar to num when order by
May 19, 2023
d99c9d5
docs(website): update the documentation for Compile StoneDB 8.0 in Do…
davidshiz May 25, 2023
2579bd4
fix(tianmu): fix up the incompatible type
RingsC May 25, 2023
0b853cd
fix(tianmu): Fix up the unknown exception after instance killed rando…
RingsC May 31, 2023
e28183b
fix(tianmu): fix up the incorrect meta-info leads unexpected behavior…
RingsC May 31, 2023
988cf1d
fix(workflow): nightly build failed #1830
hustjieke May 29, 2023
6cba6d7
feat(tianmu): revert assert() --> debug_assert() #1551
hustjieke May 31, 2023
1f43e44
feat(tianmu): fixup the default delimeter for load data (#1843)
RingsC May 31, 2023
12fa952
fix(tianmu): revert PR #1841. (#1850)
RingsC Jun 3, 2023
1b51907
fix(tianmu): fix up mtr test case for delim of load data command (#1854)
RingsC Jun 5, 2023
bde212a
fix(tianmu): fix up the `group_concat` function in tianmu (#1852)
RingsC Jun 6, 2023
1a7fe0f
fix(tianmu): To fixup the instance crashed if the result of aggregate…
RingsC Jun 6, 2023
9404338
docs(developer-guide): update the compiling guide of stonedb 8.0 for …
Xinqiangxu May 26, 2023
6b369e5
fix(tianmu): Fixup the mem leakage of aggregation function
RingsC Jun 8, 2023
f180323
fix(tianmu): fix UNION of non-matching columns (column no 0)
adofsauron Jun 14, 2023
798ca7a
test(tianmu): add order by sentence in the mtr case various_join.test
Xinqiangxu Jun 15, 2023
288262f
test(mtr): add more test cases for tianmu(#1196)
davidshiz Jun 15, 2023
c990b5f
test(mtr): add order by sentence in the mtr case various_join.test
Xinqiangxu Jun 16, 2023
9939611
ci(codecov): update the config
Nliver Jun 20, 2023
d7584f1
fix(tianmu): To suuport ignore option for update statement
RingsC Jun 14, 2023
5606c87
ci(codecov): update the codecov congfig
Nliver Jun 20, 2023
105b730
docs(intro): update the support for 8.0
Nliver Jun 20, 2023
186f694
wokflow(codecov): Filter out excess code files
Nliver Jun 25, 2023
7d03695
workflow(coverage): Update the lcov running logic
Nliver Jun 26, 2023
73dcfec
fix(tianmu): default value of the field take unaffect in load #1865
Double0101 Jun 19, 2023
a4600c4
fix(tianmu): To support union(all) the statement which is without fro…
RingsC Jun 15, 2023
6a560a0
fix(tianmu): To remove unnessary optimization in tianmu
RingsC Jun 27, 2023
60a8cf7
fix(tianmu): hotfix corruption in ValueOrNull under multi-thread
RingsC Jun 9, 2023
6349898
fix(tianmu): incorrect result when using where expr and args > bigint…
hustjieke Jun 9, 2023
34b73a1
fix(tianmu): add TIME_to_ulonglong_time_round process and fix up prec…
Xinqiangxu Jun 19, 2023
deb0600
fix(tianmu): fix format using clang-format #792
hustjieke Oct 24, 2022
25b767b
feat: rm files after rebase leftover #1217
hustjieke Jan 14, 2023
422bd73
Merge branch 'stonedb-5.7-stable' of github.com:RingsC/stonedb into HEAD
RingsC Jun 29, 2023
969435a
Merge branch 'stoneatom:stonedb-5.7-stable' into stonedb-5.7-stable
RingsC Jun 29, 2023
69213ff
fix(sql,tianmu):fix when binlog format is row, the load data statemen…
Jun 25, 2023
4494273
Merge branch 'stonedb-5.7-dev' into stable-binlog
RingsC Jun 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions mysql-test/suite/tianmu/r/issue1876.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
[connection master]
create table t1 (b int not null default 1, c varchar(60) default '\\')engine=tianmu;
insert into t1 values(1, 'AAAAAAAA');
insert into t1 values(2, 'BBBBBBBB');
SELECT * from t1 INTO OUTFILE '1876_tmp_dat';
create table t2 like t1;
load data infile '1876_tmp_dat' into table t2;
CREATE TABLE `column_type_test1` (
`c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint',
`c_smallint` smallint(6) DEFAULT NULL COMMENT 'smallint',
`c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint',
`c_int` int(11) DEFAULT NULL COMMENT 'int',
`c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint',
`c_float` float DEFAULT NULL COMMENT 'float',
`c_double` double DEFAULT NULL COMMENT 'double',
`c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal',
`c_date` date DEFAULT NULL COMMENT 'date',
`c_datetime` datetime DEFAULT NULL COMMENT 'datetime',
`c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp',
`c_time` time DEFAULT NULL COMMENT 'time',
`c_char` char(10) DEFAULT NULL COMMENT 'char',
`c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar',
`c_blob` blob COMMENT 'blob',
`c_text` text COMMENT 'text',
`c_longblob` longblob COMMENT 'longblob'
) engine=tianmu;
insert into column_type_test1 values(100, 100, 100, 100, 100, 5.2, 10.88, 100.08300, '2016-02-25', '2016-02-25 10:20:01', '2007-04-23 08:12:49', '10:20:01', 'stonedb', 'hello', null, 'bcdefghijklmn', null);
insert into column_type_test1 values(101, 101, 101, 101, 101, 5.2, 10.88, 101.08300, '2016-02-25', '2016-02-25 10:20:01', '1985-08-11 09:10:25', '10:20:01', 'stoneatom', 'hello', null, 'bcdefghijklmn', null);
SELECT * from column_type_test1 INTO OUTFILE '1876_tmp1_dat';
create table column_type_test2 like column_type_test1;
load data infile '1876_tmp1_dat' into table column_type_test2;
create table user_t1(id int, department varchar(10)) engine=tianmu;
SELECT * from user_t1 INTO OUTFILE '1876_tmp2_dat';
create table user_t2 like user_t1;
load data infile '1876_tmp2_dat' into table user_t2;
SHOW STATUS LIKE 'Slave_running';
Variable_name Value
Slave_running ON
select * from t2;
b c
1 AAAAAAAA
2 BBBBBBBB
select * from column_type_test2;
c_tinyint c_smallint c_mediumint c_int c_bigint c_float c_double c_decimal c_date c_datetime c_timestamp c_time c_char c_varchar c_blob c_text c_longblob
100 100 100 100 100 5.2 10.88 100.08300 2016-02-25 2016-02-25 10:20:01 2007-04-23 08:12:49 10:20:01 stonedb hello NULL bcdefghijklmn NULL
101 101 101 101 101 5.2 10.88 101.08300 2016-02-25 2016-02-25 10:20:01 1985-08-11 09:10:25 10:20:01 stoneatom hello NULL bcdefghijklmn NULL
checksum table user_t2;
Table Checksum
test.user_t2 536836232
drop table t1, t2;
drop table column_type_test1, column_type_test2;
drop table user_t1, user_t2;
include/rpl_end.inc
5 changes: 5 additions & 0 deletions mysql-test/suite/tianmu/t/issue1876-master.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--testcase-timeout=40
--secure-file-priv=""
--tianmu_insert_delayed=off
--log-bin=bin
--binlog_format=row
66 changes: 66 additions & 0 deletions mysql-test/suite/tianmu/t/issue1876.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--source include/have_tianmu.inc
--source include/master-slave.inc

connection master;
create table t1 (b int not null default 1, c varchar(60) default '\\')engine=tianmu;
insert into t1 values(1, 'AAAAAAAA');
insert into t1 values(2, 'BBBBBBBB');
SELECT * from t1 INTO OUTFILE '1876_tmp_dat';
create table t2 like t1;
load data infile '1876_tmp_dat' into table t2;

CREATE TABLE `column_type_test1` (
`c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint',
`c_smallint` smallint(6) DEFAULT NULL COMMENT 'smallint',
`c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint',
`c_int` int(11) DEFAULT NULL COMMENT 'int',
`c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint',
`c_float` float DEFAULT NULL COMMENT 'float',
`c_double` double DEFAULT NULL COMMENT 'double',
`c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal',
`c_date` date DEFAULT NULL COMMENT 'date',
`c_datetime` datetime DEFAULT NULL COMMENT 'datetime',
`c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp',
`c_time` time DEFAULT NULL COMMENT 'time',
`c_char` char(10) DEFAULT NULL COMMENT 'char',
`c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar',
`c_blob` blob COMMENT 'blob',
`c_text` text COMMENT 'text',
`c_longblob` longblob COMMENT 'longblob'
) engine=tianmu;
insert into column_type_test1 values(100, 100, 100, 100, 100, 5.2, 10.88, 100.08300, '2016-02-25', '2016-02-25 10:20:01', '2007-04-23 08:12:49', '10:20:01', 'stonedb', 'hello', null, 'bcdefghijklmn', null);
insert into column_type_test1 values(101, 101, 101, 101, 101, 5.2, 10.88, 101.08300, '2016-02-25', '2016-02-25 10:20:01', '1985-08-11 09:10:25', '10:20:01', 'stoneatom', 'hello', null, 'bcdefghijklmn', null);
SELECT * from column_type_test1 INTO OUTFILE '1876_tmp1_dat';
create table column_type_test2 like column_type_test1;
load data infile '1876_tmp1_dat' into table column_type_test2;

create table user_t1(id int, department varchar(10)) engine=tianmu;
--disable_query_log
let $i = 0;
while($i < 70000)
{
eval insert into user_t1 values($i, 'stonedb');
inc $i;
}
--enable_query_log
SELECT * from user_t1 INTO OUTFILE '1876_tmp2_dat';
create table user_t2 like user_t1;
load data infile '1876_tmp2_dat' into table user_t2;

--sync_slave_with_master

connection slave;
# check the rpl is running normally
SHOW STATUS LIKE 'Slave_running';

# the data in table t2 in slave is the same to that's in master, means the binlog is written correctly
select * from t2;
select * from column_type_test2;
checksum table user_t2;

connection master;
drop table t1, t2;
drop table column_type_test1, column_type_test2;
drop table user_t1, user_t2;
--sync_slave_with_master
--source include/rpl_end.inc
6 changes: 4 additions & 2 deletions sql/binlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8802,12 +8802,14 @@ TC_LOG::enum_result MYSQL_BIN_LOG::commit(THD *thd, bool all)
DBUG_RETURN(RESULT_ABORTED);
}
}
else if (real_trans && xid && trn_ctx->rw_ha_count(trx_scope) > 1 &&
!trn_ctx->no_2pc(trx_scope))
else if (thd->tianmu_need_xid || (real_trans && xid && trn_ctx->rw_ha_count(trx_scope) > 1 &&
!trn_ctx->no_2pc(trx_scope)))
{
Xid_log_event end_evt(thd, xid);
if (cache_mngr->trx_cache.finalize(thd, &end_evt))
DBUG_RETURN(RESULT_ABORTED);
// used for tianmu only
thd->tianmu_need_xid= false;
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,8 @@ class THD :public MDL_context_owner,
{ assert(0); return Query_arena::is_conventional(); }

public:
/* Used only for tianmu to wirte xid log event */
bool tianmu_need_xid;
MDL_context mdl_context;

/*
Expand Down
42 changes: 38 additions & 4 deletions storage/tianmu/core/tianmu_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,11 +1118,20 @@ uint64_t TianmuTable::ProceedNormal(system::IOParameters &iop) {

auto no_loaded_rows = parser.GetNoRow();

if (no_loaded_rows > 0 && mysql_bin_log.is_open())
if (binlog_load_query_log_event(iop) != 0) {
TIANMU_LOG(LogCtl_Level::ERROR, "Write load binlog fail!");
throw common::FormatException("Write load binlog fail!");
if (no_loaded_rows > 0 && mysql_bin_log.is_open()) {
LOAD_FILE_INFO *lf_info = (LOAD_FILE_INFO *)iop.GetLogInfo();
THD *thd = lf_info->thd;
if (thd->is_current_stmt_binlog_format_row()) { // if binlog format is row
if (binlog_flush_pending_rows_event(iop, true, iop.GetTable()->file->has_transactions()) != 0) {
TIANMU_LOG(LogCtl_Level::ERROR, "Write row binlog fail!");
throw common::FormatException("Write row binlog fail!");
}
} else if (binlog_load_query_log_event(iop) != 0) {
TIANMU_LOG(LogCtl_Level::ERROR, "Write statement binlog fail!");
throw common::FormatException("Write statement binlog fail!");
}
}

timer.Print(__PRETTY_FUNCTION__);

no_rejected_rows = parser.GetNumOfRejectedRows();
Expand All @@ -1137,6 +1146,31 @@ uint64_t TianmuTable::ProceedNormal(system::IOParameters &iop) {
return no_loaded_rows;
}

int TianmuTable::binlog_flush_pending_rows_event(system::IOParameters &iop, bool stmt_end, bool is_transactional) {
DBUG_ENTER(__PRETTY_FUNCTION__);
/*
We shall flush the pending event even if we are not in row-based
mode: it might be the case that we left row-based mode before
flushing anything (e.g., if we have explicitly locked tables).
*/
if (!mysql_bin_log.is_open())
DBUG_RETURN(0);

LOAD_FILE_INFO *lf_info = (LOAD_FILE_INFO *)iop.GetLogInfo();
THD *thd = lf_info->thd;
thd->tianmu_need_xid = true;
int error = 0;

if (Rows_log_event *pending = thd->binlog_get_pending_rows_event(is_transactional)) {
if (stmt_end) {
pending->set_flags(Rows_log_event::STMT_END_F);
thd->clear_binlog_table_maps();
}
error = mysql_bin_log.flush_and_set_pending_rows_event(thd, 0, is_transactional);
}
DBUG_RETURN(error);
}

int TianmuTable::binlog_load_query_log_event(system::IOParameters &iop) {
char *load_data_query, *end, *fname_start, *fname_end, *p = nullptr;
size_t pl = 0;
Expand Down
1 change: 1 addition & 0 deletions storage/tianmu/core/tianmu_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class TianmuTable final : public JustATable {
uint64_t ProceedNormal(system::IOParameters &iop);
uint64_t ProcessDelayed(system::IOParameters &iop);
void Field2VC(Field *f, loader::ValueCache &vc, size_t col);
int binlog_flush_pending_rows_event(system::IOParameters &iop, bool stmt_end, bool is_transactional);
int binlog_load_query_log_event(system::IOParameters &iop);
int binlog_insert2load_log_event(system::IOParameters &iop);
int binlog_insert2load_block(std::vector<loader::ValueCache> &vcs, uint load_obj, system::IOParameters &iop);
Expand Down
15 changes: 15 additions & 0 deletions storage/tianmu/loader/load_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,25 @@ uint LoadParser::GetPackrow(uint no_of_rows, std::vector<ValueCache> &value_buff
value_buffers.emplace_back(pack_size_, init_capacity);
}

THD *thd = io_param_.GetTHD();
TABLE *table = io_param_.GetTable();
bool is_transactional = table->file->has_transactions();
bool need_rows_binlog = false;
if (mysql_bin_log.is_open() && thd->is_current_stmt_binlog_format_row()) {
need_rows_binlog = true;
const bool has_trans = thd->lex->sql_command == SQLCOM_CREATE_TABLE || is_transactional;
bool need_binlog_rows_query = thd->variables.binlog_rows_query_log_events;
/* write table map event */
[[maybe_unused]] int err = thd->binlog_write_table_map(table, has_trans, need_binlog_rows_query);
}

uint no_of_rows_returned;
for (no_of_rows_returned = 0; no_of_rows_returned < no_of_rows; no_of_rows_returned++) {
if (!MakeRow(value_buffers))
break;
/* write row after one row is ready */
if (need_rows_binlog)
[[maybe_unused]] int err = thd->binlog_write_row(table, is_transactional, table->record[0], NULL);
}

last_pack_size_.clear();
Expand Down