Skip to content

Partition ordering for multi-column keys is incorrect #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jcjones opened this issue Apr 12, 2023 · 0 comments · Fixed by #61
Closed

Partition ordering for multi-column keys is incorrect #60

jcjones opened this issue Apr 12, 2023 · 0 comments · Fixed by #61
Milestone

Comments

@jcjones
Copy link
Collaborator

jcjones commented Apr 12, 2023

Given the partition layout:

PARTITION `p_20220413` VALUES LESS THAN (2300107903,2178845982) ENGINE = InnoDB,
 PARTITION `p_20220513` VALUES LESS THAN (2517982016,2390412410) ENGINE = InnoDB,
 PARTITION `p_20220508` VALUES LESS THAN (2661645087,2536435703) ENGINE = InnoDB,
 PARTITION `p_20220525` VALUES LESS THAN (2805308158,2682458996) ENGINE = InnoDB,
 PARTITION `p_20220611` VALUES LESS THAN (7882495694,7856340600) ENGINE = InnoDB,
 PARTITION `p_20230519` VALUES LESS THAN (10790547177,11048018089) ENGINE = InnoDB,
 PARTITION `p_20230724` VALUES LESS THAN (95233456870,97348306298) ENGINE = InnoDB,
 PARTITION `p_20230823` VALUES LESS THAN (MAXVALUE,MAXVALUE) ENGINE = InnoDB

and the position (8236363504, 6096301914), current versions of Partition Manager will assume the "current" partition is p_20220611. However, that is not correct: MySQL writes into the next partition if any of those values moves beyond the limits of a partition, not if all do.

In reality, partition p_20230519 is the "current" one.

To quote from the documentation:

With RANGE COLUMNS, a row matches a partition if all row values are less than specified values. The first partition that matches row values will be used.

jcjones added a commit that referenced this issue Apr 12, 2023
To quote from the documentation:

> With RANGE COLUMNS, a row matches a partition if all row values are less
> than specified values. The first partition that matches row values will be
> used.

Previously, with `RANGE COLUMNS`, partition-manager got this logic backward,
which led to partitions being considered "unfilled" and candidates for rename
which actually had data in them.

Fixes #60
@jcjones jcjones added this to the v.0.4.0 milestone Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant