cube-js / cube-js/cube

Pre-aggregation queries are not GTID safe - MySQL

Open
#1,810 5 comments 0 reactions 0 assignees View on GitHub
driver:mysql help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**

Queries to create pre-agg tables use ` CREATE TABLE ... SELECT ` syntax.
This syntax is not valid when running MySQL with GTID based replication. [see here](https://dev.mysql.com/doc/refman/5.6/en/replication-gtids-restrictions.html)

GTID based replication also happens to be used by Google CloudSQL and is not configurable.
This means that pre-aggregations cannot by used.

Note: This issue theoretically will also appear when using statement based replication.

**To Reproduce**
[Run a MySQL database using GTIDs for replication](https://dev.mysql.com/doc/refman/5.6/en/replication-gtids-howto.html)

Add a cube with a pre-aggregation.
Will fail with an error like `"Error: ER_GTID_UNSAFE_CREATE_SELECT: Statement violates GTID consistency: CREATE TABLE ... SELECT."`

**Expected behavior**
Pre-aggregation queries should be safe for statement based replication as well as replication with GTIDs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.