Hi guys,
i’m having rather interesting problem. We have a server_history table that keeps some information about our servers. we use version column to keep track of changed things. when we do some update queries through golang+mysql driver, we got Error 1749: Feature ‘fully distributed join inside a multi-statement transaction’ is not supported by MemSQL Distributed.
the same queries run on DBeaver connected to the same server via mariadb driver performs update without a blink or warning, and correctly. Can somebody shed some light on this?
I’m attaching queries that we run on the table after batch loading data with mark version=-1 (no signify new coming records)
UPDATE
collector.SERVER_HISTORY
SET
UPDATED_TS = CURRENT_TIMESTAMP(6)
WHERE
VERSION = 0
AND SERVER_ID IN (
select
sh2.SERVER_ID
from
collector.SERVER_HISTORY sh
inner join collector.SERVER_HISTORY sh2 ON
(sh.SERVER_ID = sh2.SERVER_ID
AND sh.VERSION =-1
AND sh2.VERSION = 0)
WHERE
sh.CHECK_SUM = sh2.CHECK_SUM );
DELETE
FROM
collector.SERVER_HISTORY
WHERE
VERSION =-1
AND SERVER_ID IN (
SELECT
sh.SERVER_ID
FROM
collector.SERVER_HISTORY sh
INNER JOIN collector.SERVER_HISTORY sh2 ON
(sh.SERVER_ID = sh2.SERVER_ID
AND sh.VERSION =-1
AND sh2.VERSION = 0)
WHERE
sh.CHECK_SUM = sh2.CHECK_SUM );
UPDATE
collector.SERVER_HISTORY
SET
VERSION = VERSION + 1
WHERE
SERVER_ID IN (
SELECT
sh.SERVER_ID
FROM
collector.SERVER_HISTORY sh
INNER JOIN collector.SERVER_HISTORY sh2 ON
(sh.SERVER_ID = sh2.SERVER_ID
AND sh.VERSION =-1
AND sh2.VERSION = 0)
WHERE
sh.CHECK_SUM <> sh2.CHECK_SUM );
UPDATE
collector.SERVER_HISTORY
SET
VERSION = 0
WHERE
VERSION =-1
and SERVER_ID NOT IN (
SELECT
SERVER_ID
FROM
collector.SERVER_HISTORY
WHERE
VERSION = 0);
and the table definition is
CREATE TABLE collector.SERVER_HISTORY
(
SERVER_ID
varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
DEVICE_ID
int(11) DEFAULT NULL,
VERSION
int(11) DEFAULT -1,
DATA
JSON COLLATE utf8_bin NOT NULL,
CREATED_TS
timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
UPDATED_TS
timestamp(6) NULL DEFAULT NULL,
CHECK_SUM
varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
SKIP
int(11) NOT NULL DEFAULT 0,
SKIP_REASON
text CHARACTER SET utf8 COLLATE utf8_general_ci,
UPDATE_LOCK
tinyint(4) DEFAULT 0,
ASK_UPDATE
int(11) DEFAULT 0,
KEY idx_version
(VERSION
),
KEY idx_server_version
(SERVER_ID
,VERSION
));
I’m curious how this is happening.