ALTERing TokuDB table with clustering key can lead to a server crash
Description
Environment
Smart Checklist
Activity
Julia Vural March 4, 2025 at 9:02 PM
It appears that this issue is no longer being worked on, so we are closing it for housekeeping purposes. If you believe the issue still exists, please open a new ticket after confirming it's present in the latest release.
roel.vandepaar December 19, 2018 at 3:25 AM
Secondary testcase split off to
Peter Schwaller December 18, 2018 at 5:23 PM
Deferred during 8.0 triage slack chat.
Tyler Duzan December 18, 2018 at 5:21 PM
Thank you , that was very helpful in understanding the impact of these. Considering the minimal impact I agree that this is something which should be deferred till after the GA.
George Lorch December 18, 2018 at 5:16 PMEdited
There are two distinct bug here, and both of them are present in 5.6, 5.7, and 8.0.
______________________________________
First, this SEGFAULT as initially reported:
CREATE TABLE t1(a INT, b INT, c INT, PRIMARY KEY(a), KEY(b), CLUSTERING KEY(c)) ENGINE=TokuDB;
ALTER TABLE t1 ADD COLUMN aaa INT, DROP INDEX b, ADD INDEX b(b);
This happens only on the ALTER, and the ALTER requires that the table has at least one secondary key and one clustering key, primary key presence is irrelevant. The ALTER also requires that all three operations, ADD COLUMN, DROP INDEX and ADD INDEX be specified. The ADD INDEX must be identical to the index that was just dropped. i.e if the new index is just (c), or (b,c) it will not trigger, only when the new index is exactly (b) will it trigger.
______________________________________
Second, a different issue as pointed out by Roel is more of a parser error from what I can tell and not really directly related to TokuDB other than the fact that TokuDB is the only engine that currently supports CLUSTERING KEYs. It should be reported separately.
These fails with multiple PK error. CREATE must have a a PRIMARY KEY, at least one secondary KEY (more have no impact), and at least one CLUSTERING KEY (more have no impact). The order of specification is irrelevant.
CREATE TABLE t1(a INT PRIMARY KEY, b INT KEY, c INT CLUSTERING KEY) ENGINE=TokuDB;
CREATE TABLE t1(a INT PRIMARY KEY, b INT CLUSTERING KEY, c INT KEY) ENGINE=TokuDB;
The KEY specification MUST be a part of the column definition. This works and creates the exact same table correctly, but with only different SQL semantics:
CREATE TABLE t1(a INT, b INT, c INT, PRIMARY KEY(a), KEY(b), CLUSTERING KEY(c)) ENGINE=TokuDB;
______________________________________
Considering:
As far as we know, this is an unused feature specific to TokuDB (CLUSTERING KEYS). It is unused enough that we considered dropping it from the 8.0 port. We solicited input from support and got no response except surprise that the feature even existed.
Both issues have existed as long as the feature has in all version of the server. As far as I can tell and nobody has reported them, commented to them, or mentioned them outside of our own QA.
Both issues have easy workarounds with the first "ALTER" issue being a uniquely odd combination of operations.
I would not recommend these as either blockers or fix in time for 8.0. IMHO it would be a waste of precious developer time to prioritize these over the hundreds(thousands) of other real issues in order to fix something that doesn't seem would help a single user on the planet. If someone can counter that and prove there is some user and there is a risk of impact, then my opinion could be altered.
Details
Assignee
UnassignedUnassignedReporter
Hrvoje MatijakovicHrvoje MatijakovicTime tracking
1h 25m loggedComponents
Affects versions
Priority
High
Details
Details
Assignee
Reporter
Time tracking
Components
Affects versions
Priority
Smart Checklist
Open Smart Checklist
Smart Checklist
Open Smart Checklist
Smart Checklist

sql:
gdb:
Reproduced on both release and debug builds for RM-383.
I'm able to reproduce it on a release build for 5.6.41-84.1 as well.