Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions storage/duckdb/ha_duckdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ static int duckdb_prepare(handlerton *hton, THD *thd, bool all)
return 0;
}

#if MYSQL_VERSION_ID >= 110800

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is most likely killing the messenger.

The real issue is that Gtid_log_event::Gtid_log_event() expects that ha_count_rw_2pc() would return non-zero. And it can only return non-zero if the recover hook is defined.

Why is that, I have no idea (and is a question for the final review).

Feel free to ignore this for now, but I strongly suspect that this is wrong and it will come up in the final review.

static int duckdb_recover(XID *, uint)
#else
static int duckdb_recover(handlerton *, XID *, uint)
#endif
{
return 0;
}

static void push_duckdb_query_error(const std::string &err)
{
if (err.find("Parser Error") != std::string::npos ||
Expand Down Expand Up @@ -231,6 +240,7 @@ static int duckdb_init_func(void *p)
duckdb_hton->create= duckdb_create_handler;
duckdb_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED | HTON_NO_PARTITION;
duckdb_hton->prepare= duckdb_prepare;
duckdb_hton->recover= duckdb_recover;
duckdb_hton->commit= duckdb_commit;
duckdb_hton->rollback= duckdb_rollback;
duckdb_hton->close_connection= duckdb_close_connection;
Expand Down
15 changes: 15 additions & 0 deletions storage/duckdb/mysql-test/duckdb/r/mdev_40818.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=DuckDB;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
id
1
DROP TABLE t1;
CREATE TABLE t1 (id INT PRIMARY KEY, v VARCHAR(16)) ENGINE=DuckDB;
BEGIN;
INSERT INTO t1 VALUES (1, 'one'), (2, 'two');
COMMIT;
SELECT * FROM t1 ORDER BY id;
id v
1 one
2 two
DROP TABLE t1;
20 changes: 20 additions & 0 deletions storage/duckdb/mysql-test/duckdb/t/mdev_40818.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--source ../include/have_duckdb.inc
--source include/have_log_bin.inc
--source include/not_msan.inc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the not_msan.inc. there's currently no compatibility problem.

--disable_warnings

#
# MDEV-40818 INSERT into ENGINE=DuckDB crashes when binary logging is enabled
#

CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=DuckDB;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1 (id INT PRIMARY KEY, v VARCHAR(16)) ENGINE=DuckDB;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need two separate tables here? The mdev claims that the above is enough to reproduce.

BEGIN;
INSERT INTO t1 VALUES (1, 'one'), (2, 'two');
COMMIT;
SELECT * FROM t1 ORDER BY id;
DROP TABLE t1;