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

Query timestamp in append mode yields incorrect result #4668

Closed
v0y4g3r opened this issue Sep 3, 2024 · 1 comment · Fixed by #4669
Closed

Query timestamp in append mode yields incorrect result #4668

v0y4g3r opened this issue Sep 3, 2024 · 1 comment · Fixed by #4669
Assignees
Labels
C-bug Category Bugs

Comments

@v0y4g3r
Copy link
Contributor

v0y4g3r commented Sep 3, 2024

What type of bug is this?

Incorrect result

What subsystems are affected?

Standalone mode

Minimal reproduce step

  1. Create table with append mode:
create table t (
    ts timestamp time index,
    host string primary key,
    not_pk string,
    val double,
) with (append_mode='true', 'compaction.type'='twcs','compaction.twcs.max_active_window_files'='8','compaction.twcs.max_inactive_window_files'='8');
  1. Insert 9 rows and flush
insert into t values
    (0, 'a', '🌕', 1.0),
    (1, 'b', '🌖', 2.0),
    (1, 'a', '🌗', 3.0),
    (1, 'c', '🌘', 4.0),
    (2, 'a', '🌑', 5.0),
    (2, 'b', '🌒', 6.0),
    (2, 'a', '🌓', 7.0),
    (3, 'c', '🌔', 8.0),
    (3, 'd', '🌕', 9.0);

admin flush_table('t');    
  1. Insert another 9 rows and flush
insert into t values
    (10, 'a', '🌕', 1.0),
    (11, 'b', '🌖', 2.0),
    (11, 'a', '🌗', 3.0),
    (11, 'c', '🌘', 4.0),
    (12, 'a', '🌑', 5.0),
    (12, 'b', '🌒', 6.0),
    (12, 'a', '🌓', 7.0),
    (13, 'c', '🌔', 8.0),
    (13, 'd', '🌕', 9.0);
admin flush_table('t');    
  1. Then select num of total rows and all timestamps
select count(ts) from t;    

select ts from t;

What did you expect to see?

  • select count(ts) from t should give 18 since 18 rows are written
+-------------+
| COUNT(t.ts) |
+-------------+
| 18          |
+-------------+
  • select ts from t should list all inserted timestamps
+-------------------------+
| ts                      |
+-------------------------+
| 1970-01-01T00:00:00     |
| 1970-01-01T00:00:00.001 |
| 1970-01-01T00:00:00.002 |
| 1970-01-01T00:00:00.002 |
| 1970-01-01T00:00:00.010 |
| 1970-01-01T00:00:00.011 |
| 1970-01-01T00:00:00.012 |
| 1970-01-01T00:00:00.012 |
| 1970-01-01T00:00:00.001 |
| 1970-01-01T00:00:00.002 |
| 1970-01-01T00:00:00.011 |
| 1970-01-01T00:00:00.012 |
| 1970-01-01T00:00:00.001 |
| 1970-01-01T00:00:00.003 |
| 1970-01-01T00:00:00.011 |
| 1970-01-01T00:00:00.013 |
| 1970-01-01T00:00:00.003 |
| 1970-01-01T00:00:00.013 |
+-------------------------+

What did you see instead?

  • select count(ts) from t gives 18:
+-------------+
| COUNT(t.ts) |
+-------------+
| 18          |
+-------------+
  • But select ts from t only returns 9 rows:
+----------------------------+
| ts                         |
+----------------------------+
| 1970-01-01 00:00:00.010000 |
| 1970-01-01 00:00:00.011000 |
| 1970-01-01 00:00:00.012000 |
| 1970-01-01 00:00:00.012000 |
| 1970-01-01 00:00:00.011000 |
| 1970-01-01 00:00:00.012000 |
| 1970-01-01 00:00:00.011000 |
| 1970-01-01 00:00:00.013000 |
| 1970-01-01 00:00:00.013000 |
+----------------------------+
9 rows in set (0.07 sec)

What operating system did you use?

NA

What version of GreptimeDB did you use?

0.9.2

Relevant log output and stack trace

No response

@v0y4g3r v0y4g3r added the C-bug Category Bugs label Sep 3, 2024
@v0y4g3r
Copy link
Contributor Author

v0y4g3r commented Sep 3, 2024

This bug was introduced in #4627

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category Bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants