Skip to content

Commit 20969aa

Browse files
committed
Merge 10.3 into 10.4
2 parents 8fb176c + 6b91792 commit 20969aa

File tree

7 files changed

+28
-10
lines changed

7 files changed

+28
-10
lines changed

storage/connect/mysql-test/connect/r/odbc_postgresql.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,12 @@ SELECT * from pg_in_maria;
319319
my space column
320320
My value
321321
DROP TABLE pg_in_maria;
322+
#
323+
# MDEV-29397 UPDATE with WHERE on part of two-part primary key causes
324+
# info to turn into error.
325+
#
326+
CREATE TABLE t1 (a VARCHAR(6), b VARCHAR(6), PRIMARY KEY(a, b)) ENGINE=CONNECT TABNAME='schema1.t3' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr';
327+
UPDATE t1 SET a='10' WHERE a='20';
328+
Warnings:
329+
Note 1105 schema1.t3: 0 affected rows
330+
DROP TABLE t1;

storage/connect/mysql-test/connect/t/odbc_postgresql.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,12 @@ DROP TABLE t1;
223223
CREATE TABLE pg_in_maria ENGINE=CONNECT TABNAME='schema1.space_in_column_name' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' quoted=1;
224224
SELECT * from pg_in_maria;
225225
DROP TABLE pg_in_maria;
226+
227+
--echo #
228+
--echo # MDEV-29397 UPDATE with WHERE on part of two-part primary key causes
229+
--echo # info to turn into error.
230+
--echo #
231+
CREATE TABLE t1 (a VARCHAR(6), b VARCHAR(6), PRIMARY KEY(a, b)) ENGINE=CONNECT TABNAME='schema1.t3' CHARSET=utf8 DATA_CHARSET=utf8 TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr';
232+
UPDATE t1 SET a='10' WHERE a='20';
233+
DROP TABLE t1;
234+

storage/connect/odbconn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2582,7 +2582,7 @@ int ODBConn::Rewind(char *sql, ODBCCOL *tocols)
25822582
int rc, rbuf = -1;
25832583

25842584
if (!m_hstmt)
2585-
rbuf = -1;
2585+
rbuf = 0;
25862586
else if (m_Full)
25872587
rbuf = m_Rows; // No need to "rewind"
25882588
else if (m_Scrollable) {

storage/connect/tabext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,15 +472,15 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt)
472472
my_len= res - buf + 1;
473473
my_schema_table= (char *) malloc(my_len);
474474
memcpy(my_schema_table, buf, my_len - 1);
475-
my_schema_table[my_len] = 0;
475+
my_schema_table[my_len - 1] = 0;
476476
Query->Append(Quote);
477477
Query->Append(my_schema_table);
478478
Query->Append(Quote);
479479
free(my_schema_table);
480480
Query->Append(".");
481481
// Parse table
482482
my_len= strlen(buf) - my_len + 1;
483-
my_schema_table= (char *) malloc(my_len);
483+
my_schema_table= (char *) malloc(my_len + 1);
484484
memcpy(my_schema_table, ++res, my_len);
485485
my_schema_table[my_len] = 0;
486486
Query->Append(Quote);

storage/innobase/btr/btr0btr.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ btr_get_size(
614614

615615
ut_ad(srv_read_only_mode
616616
|| mtr_memo_contains(mtr, dict_index_get_lock(index),
617-
MTR_MEMO_S_LOCK));
617+
MTR_MEMO_SX_LOCK));
618618

619619
if (index->page == FIL_NULL
620620
|| dict_index_is_online_ddl(index)
@@ -668,7 +668,7 @@ btr_get_size_and_reserved(
668668
ulint dummy;
669669

670670
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
671-
MTR_MEMO_S_LOCK));
671+
MTR_MEMO_SX_LOCK));
672672

673673
ut_a(flag == BTR_N_LEAF_PAGES || flag == BTR_TOTAL_SIZE);
674674

storage/innobase/dict/dict0defrag_bg.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 2016, 2019, MariaDB Corporation.
3+
Copyright (c) 2016, 2022, MariaDB Corporation.
44
55
This program is free software; you can redistribute it and/or modify it under
66
the terms of the GNU General Public License as published by the Free Software
@@ -280,7 +280,7 @@ dict_stats_save_defrag_stats(
280280
ulint n_leaf_pages;
281281
ulint n_leaf_reserved;
282282
mtr.start();
283-
mtr_s_lock_index(index, &mtr);
283+
mtr_sx_lock_index(index, &mtr);
284284
n_leaf_reserved = btr_get_size_and_reserved(index, BTR_N_LEAF_PAGES,
285285
&n_leaf_pages, &mtr);
286286
mtr.commit();

storage/innobase/dict/dict0stats.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2015, 2021, MariaDB Corporation.
4+
Copyright (c) 2015, 2022, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -851,7 +851,7 @@ dict_stats_update_transient_for_index(
851851
ulint size;
852852

853853
mtr.start();
854-
mtr_s_lock_index(index, &mtr);
854+
mtr_sx_lock_index(index, &mtr);
855855
size = btr_get_size(index, BTR_TOTAL_SIZE, &mtr);
856856

857857
if (size != ULINT_UNDEFINED) {
@@ -1944,7 +1944,7 @@ static index_stats_t dict_stats_analyze_index(dict_index_t* index)
19441944
DEBUG_PRINTF(" %s(index=%s)\n", __func__, index->name());
19451945

19461946
mtr.start();
1947-
mtr_s_lock_index(index, &mtr);
1947+
mtr_sx_lock_index(index, &mtr);
19481948
size = btr_get_size(index, BTR_TOTAL_SIZE, &mtr);
19491949

19501950
if (size != ULINT_UNDEFINED) {

0 commit comments

Comments
 (0)