Skip to content
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

DELETE not work in last_non_null mode #5073

Closed
evenyag opened this issue Nov 29, 2024 · 0 comments · Fixed by #5168
Closed

DELETE not work in last_non_null mode #5073

evenyag opened this issue Nov 29, 2024 · 0 comments · Fixed by #5168
Assignees
Labels
A-storage Involves code in storage engines C-bug Category Bugs
Milestone

Comments

@evenyag
Copy link
Contributor

evenyag commented Nov 29, 2024

What type of bug is this?

Incorrect result

What subsystems are affected?

Standalone mode, Distributed Cluster

Minimal reproduce step

mysql> CREATE TABLE IF NOT EXISTS `test` (
    ->   `time` TIMESTAMP(0) NOT NULL,
    ->   `code` STRING NULL,
    ->   `name` STRING NULL,
    ->   `status` TINYINT NULL,
    ->   TIME INDEX (`time`),
    ->   PRIMARY KEY (`code`)
    -> ) ENGINE=mito WITH(
    ->   append_mode = 'false',
    ->   merge_mode = 'last_non_null'
    -> );
Query OK, 0 rows affected (0.19 sec)

mysql>
mysql> INSERT INTO `test` (`time`, `code`, `name`, `status`) VALUES ('2024-11-26 10:00:00', 'achn', '1.png', 0);
Query OK, 1 row affected (0.03 sec)

mysql> INSERT INTO `test` (`time`, `code`, `name`, `status`) VALUES ('2024-11-26 10:01:00', 'achn', '2.png', 0);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO `test` (`time`, `code`, `name`, `status`) VALUES ('2024-11-26 10:02:00', 'achn', '3.png', 1);
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> SELECT * FROM `test`;
+---------------------+------+-------+--------+
| time                | code | name  | status |
+---------------------+------+-------+--------+
| 2024-11-26 10:00:00 | achn | 1.png |      0 |
| 2024-11-26 10:01:00 | achn | 2.png |      0 |
| 2024-11-26 10:02:00 | achn | 3.png |      1 |
+---------------------+------+-------+--------+
3 rows in set (0.15 sec)

mysql> DELETE FROM `test`;

mysql>
mysql> INSERT INTO `test` (`time`, `code`, `name`) VALUES ('2024-11-26 10:00:00', 'achn', '1.png');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO `test` (`time`, `code`, `name`) VALUES ('2024-11-26 10:01:00', 'achn', '2.png');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO `test` (`time`, `code`, `name`) VALUES ('2024-11-26 10:02:00', 'achn', '3.png');
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> SELECT * FROM `test`;
+---------------------+------+-------+--------+
| time                | code | name  | status |
+---------------------+------+-------+--------+
| 2024-11-26 10:00:00 | achn | 1.png |      0 |
| 2024-11-26 10:01:00 | achn | 2.png |      0 |
| 2024-11-26 10:02:00 | achn | 3.png |      1 |
+---------------------+------+-------+--------+
3 rows in set (0.02 sec)

What did you expect to see?

status should return null

What did you see instead?

status return the last value

What operating system did you use?

Unrelated

What version of GreptimeDB did you use?

0.10.2

Relevant log output and stack trace

No response

@evenyag evenyag added the C-bug Category Bugs label Nov 29, 2024
@evenyag evenyag self-assigned this Nov 29, 2024
@evenyag evenyag added the A-storage Involves code in storage engines label Dec 11, 2024
@evenyag evenyag added this to the v0.12 milestone Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-storage Involves code in storage engines C-bug Category Bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant