matrixone
matrixone copied to clipboard
[Bug]: now() function return same result with same query.
Is there an existing issue for the same bug?
- [X] I have checked the existing issues.
Branch Name
main, 1.1-dev
Commit ID
87ea4a47b
Other Environment Information
- Hardware parameters: macbook pro
- OS type:
- Others:
Actual Behavior
mysql> select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10;
+----------+----------------------------+----------------------------+
| count(1) | collecttime | now() |
+----------+----------------------------+----------------------------+
| 24 | 2024-04-22 15:43:29.238959 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:43:14.242375 | 2024-04-22 15:43:40.549003 |
| 3 | 2024-04-22 15:43:14.227293 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:42:59.250878 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:42:44.253483 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:42:29.253833 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:42:14.253756 | 2024-04-22 15:43:40.549003 |
| 3 | 2024-04-22 15:42:14.208582 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:41:59.248344 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:41:44.246250 | 2024-04-22 15:43:40.549003 |
+----------+----------------------------+----------------------------+
10 rows in set (0.00 sec)
mysql> select now();
+----------------------------+
| now() |
+----------------------------+
| 2024-04-22 15:43:48.463132 |
+----------------------------+
1 row in set (0.00 sec)
mysql> select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10;
+----------+----------------------------+----------------------------+
| count(1) | collecttime | now() |
+----------+----------------------------+----------------------------+
| 24 | 2024-04-22 15:43:44.241509 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:43:29.238959 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:43:14.242375 | 2024-04-22 15:43:40.549003 |
| 3 | 2024-04-22 15:43:14.227293 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:42:59.250878 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:42:44.253483 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:42:29.253833 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:42:14.253756 | 2024-04-22 15:43:40.549003 |
| 3 | 2024-04-22 15:42:14.208582 | 2024-04-22 15:43:40.549003 |
| 24 | 2024-04-22 15:41:59.248344 | 2024-04-22 15:43:40.549003 |
+----------+----------------------------+----------------------------+
10 rows in set (0.00 sec)
Expected Behavior
No response
Steps to Reproduce
-- exec 1st time.
select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10;
-- exec 2rd time. (same query)
select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10;
Additional information
No response
reproduced with MOC prod:
MySQL [write_test]> show create table test_table;
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test_table | CREATE TABLE `test_table` (
`id` INT NOT NULL AUTO_INCREMENT,
`column1` VARCHAR(255) NOT NULL,
`column2` VARCHAR(255) NOT NULL,
`created_at` TIMESTAMP DEFAULT current_timestamp(6),
PRIMARY KEY (`id`)
) |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.12 sec)
MySQL [write_test]> select count(1), created_at, now() from write_test.test_table group by created_at order by created_at desc limit 10;+----------+----------------------------+----------------------------+
| count(1) | created_at | now() |
+----------+----------------------------+----------------------------+
| 1 | 2024-04-01 08:46:20.420321 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:20.189302 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.964423 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.738155 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.511382 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.284956 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.060356 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:18.836158 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:18.610871 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:18.382331 | 2024-05-06 09:51:18.237814 |
+----------+----------------------------+----------------------------+
10 rows in set (4.03 sec)
MySQL [write_test]> select count(1), created_at, now() from write_test.test_table group by created_at order by created_at desc limit 10;
+----------+----------------------------+----------------------------+
| count(1) | created_at | now() |
+----------+----------------------------+----------------------------+
| 1 | 2024-04-01 08:46:20.420321 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:20.189302 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.964423 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.738155 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.511382 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.284956 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.060356 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:18.836158 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:18.610871 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:18.382331 | 2024-05-06 09:51:18.237814 |
+----------+----------------------------+----------------------------+
10 rows in set (2.80 sec)
MySQL [write_test]> select now();
+----------------------------+
| now() |
+----------------------------+
| 2024-05-06 09:52:41.474057 |
+----------------------------+
1 row in set (0.02 sec)
MySQL [write_test]> select count(1), created_at, now() from write_test.test_table group by created_at order by created_at desc limit 10;
+----------+----------------------------+----------------------------+
| count(1) | created_at | now() |
+----------+----------------------------+----------------------------+
| 1 | 2024-04-01 08:46:20.420321 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:20.189302 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.964423 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.738155 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.511382 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.284956 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:19.060356 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:18.836158 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:18.610871 | 2024-05-06 09:51:18.237814 |
| 1 | 2024-04-01 08:46:18.382331 | 2024-05-06 09:51:18.237814 |
+----------+----------------------------+----------------------------+
10 rows in set (4.84 sec)
未投入
未投入
未投入
未投入
未投入
和彭振沟通,放到1.3.0版本,优先级不高
未投入
未投入
未投入
未投入
未投入
未投入
未投入
兼容性相关。now函数行为问题。
还在看
还在看
mysql> create table test_snapshot_read (a int);
Query OK, 0 rows affected (0.02 sec)
mysql> INSERT INTO test_snapshot_read (a) VALUES(1), (2), (3), (4), (5),(6), (7), (8), (9), (10), (11), (12),(13), (14), (15), (16), (17), (18), (19), (20),(21), (22), (23), (24), (25), (26), (27), (28), (29), (30),(31), (32), (33), (34), (35), (36), (37), (38), (39), (40),(41), (42), (43), (44), (45), (46), (47), (48), (49), (50),(51), (52), (53), (54), (55), (56), (57), (58), (59), (60),(61), (62), (63), (64), (65), (66), (67), (68), (69), (70),(71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90),(91), (92), (93), (94), (95), (96), (97), (98), (99), (100);
Query OK, 100 rows affected (0.01 sec)
Records: 100 Duplicates: 0 Warnings: 0
mysql> select count(*) from test_snapshot_read;
+----------+
| count(*) |
+----------+
| 100 |
+----------+
1 row in set (0.00 sec)
mysql>
mysql> select a, now() from test_snapshot_read;
+------+---------------------+
| a | now() |
+------+---------------------+
| 1 | 2024-08-22 15:31:11 |
| 2 | 2024-08-22 15:31:11 |
| 3 | 2024-08-22 15:31:11 |
| 4 | 2024-08-22 15:31:11 |
| 5 | 2024-08-22 15:31:11 |
| 6 | 2024-08-22 15:31:11 |
| 7 | 2024-08-22 15:31:11 |
| 8 | 2024-08-22 15:31:11 |
| 9 | 2024-08-22 15:31:11 |
| 10 | 2024-08-22 15:31:11 |
| 11 | 2024-08-22 15:31:11 |
| 12 | 2024-08-22 15:31:11 |
| 13 | 2024-08-22 15:31:11 |
| 14 | 2024-08-22 15:31:11 |
| 15 | 2024-08-22 15:31:11 |
| 16 | 2024-08-22 15:31:11 |
| 17 | 2024-08-22 15:31:11 |
| 18 | 2024-08-22 15:31:11 |
| 19 | 2024-08-22 15:31:11 |
| 20 | 2024-08-22 15:31:11 |
| 21 | 2024-08-22 15:31:11 |
| 22 | 2024-08-22 15:31:11 |
| 23 | 2024-08-22 15:31:11 |
| 24 | 2024-08-22 15:31:11 |
| 25 | 2024-08-22 15:31:11 |
| 26 | 2024-08-22 15:31:11 |
| 27 | 2024-08-22 15:31:11 |
| 28 | 2024-08-22 15:31:11 |
| 29 | 2024-08-22 15:31:11 |
| 30 | 2024-08-22 15:31:11 |
| 31 | 2024-08-22 15:31:11 |
| 32 | 2024-08-22 15:31:11 |
| 33 | 2024-08-22 15:31:11 |
| 34 | 2024-08-22 15:31:11 |
| 35 | 2024-08-22 15:31:11 |
| 36 | 2024-08-22 15:31:11 |
| 37 | 2024-08-22 15:31:11 |
| 38 | 2024-08-22 15:31:11 |
| 39 | 2024-08-22 15:31:11 |
| 40 | 2024-08-22 15:31:11 |
| 41 | 2024-08-22 15:31:11 |
| 42 | 2024-08-22 15:31:11 |
| 43 | 2024-08-22 15:31:11 |
| 44 | 2024-08-22 15:31:11 |
| 45 | 2024-08-22 15:31:11 |
| 46 | 2024-08-22 15:31:11 |
| 47 | 2024-08-22 15:31:11 |
| 48 | 2024-08-22 15:31:11 |
| 49 | 2024-08-22 15:31:11 |
| 50 | 2024-08-22 15:31:11 |
| 51 | 2024-08-22 15:31:11 |
| 52 | 2024-08-22 15:31:11 |
| 53 | 2024-08-22 15:31:11 |
| 54 | 2024-08-22 15:31:11 |
| 55 | 2024-08-22 15:31:11 |
| 56 | 2024-08-22 15:31:11 |
| 57 | 2024-08-22 15:31:11 |
| 58 | 2024-08-22 15:31:11 |
| 59 | 2024-08-22 15:31:11 |
| 60 | 2024-08-22 15:31:11 |
| 61 | 2024-08-22 15:31:11 |
| 62 | 2024-08-22 15:31:11 |
| 63 | 2024-08-22 15:31:11 |
| 64 | 2024-08-22 15:31:11 |
| 65 | 2024-08-22 15:31:11 |
| 66 | 2024-08-22 15:31:11 |
| 67 | 2024-08-22 15:31:11 |
| 68 | 2024-08-22 15:31:11 |
| 69 | 2024-08-22 15:31:11 |
| 70 | 2024-08-22 15:31:11 |
| 71 | 2024-08-22 15:31:11 |
| 72 | 2024-08-22 15:31:11 |
| 73 | 2024-08-22 15:31:11 |
| 74 | 2024-08-22 15:31:11 |
| 75 | 2024-08-22 15:31:11 |
| 76 | 2024-08-22 15:31:11 |
| 77 | 2024-08-22 15:31:11 |
| 78 | 2024-08-22 15:31:11 |
| 79 | 2024-08-22 15:31:11 |
| 80 | 2024-08-22 15:31:11 |
| 81 | 2024-08-22 15:31:11 |
| 82 | 2024-08-22 15:31:11 |
| 83 | 2024-08-22 15:31:11 |
| 84 | 2024-08-22 15:31:11 |
| 85 | 2024-08-22 15:31:11 |
| 86 | 2024-08-22 15:31:11 |
| 87 | 2024-08-22 15:31:11 |
| 88 | 2024-08-22 15:31:11 |
| 89 | 2024-08-22 15:31:11 |
| 90 | 2024-08-22 15:31:11 |
| 91 | 2024-08-22 15:31:11 |
| 92 | 2024-08-22 15:31:11 |
| 93 | 2024-08-22 15:31:11 |
| 94 | 2024-08-22 15:31:11 |
| 95 | 2024-08-22 15:31:11 |
| 96 | 2024-08-22 15:31:11 |
| 97 | 2024-08-22 15:31:11 |
| 98 | 2024-08-22 15:31:11 |
| 99 | 2024-08-22 15:31:11 |
| 100 | 2024-08-22 15:31:11 |
+------+---------------------+
100 rows in set (0.00 sec)
test in mysql, it saves that mo have some behavior as mysql
mysql> select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10;
+----------+----------------------------+----------------------------+
| count(1) | collecttime | now() |
+----------+----------------------------+----------------------------+
| 27 | 2024-08-22 15:37:53.017211 | 2024-08-22 15:38:10.134201 |
| 27 | 2024-08-22 15:37:38.016420 | 2024-08-22 15:38:10.134201 |
| 27 | 2024-08-22 15:37:23.013585 | 2024-08-22 15:38:10.134201 |
| 27 | 2024-08-22 15:37:08.012573 | 2024-08-22 15:38:10.134201 |
| 3 | 2024-08-22 15:37:07.983366 | 2024-08-22 15:38:10.134201 |
| 27 | 2024-08-22 15:36:53.029679 | 2024-08-22 15:38:10.134201 |
| 27 | 2024-08-22 15:36:38.013604 | 2024-08-22 15:38:10.134201 |
| 27 | 2024-08-22 15:36:23.019134 | 2024-08-22 15:38:10.134201 |
| 27 | 2024-08-22 15:36:08.013703 | 2024-08-22 15:38:10.134201 |
| 3 | 2024-08-22 15:36:07.982602 | 2024-08-22 15:38:10.134201 |
+----------+----------------------------+----------------------------+
10 rows in set (0.04 sec)
mysql> select now();
+----------------------------+
| now() |
+----------------------------+
| 2024-08-22 15:38:15.663587 |
+----------------------------+
1 row in set (0.00 sec)
mysql> select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10;
+----------+----------------------------+----------------------------+
| count(1) | collecttime | now() |
+----------+----------------------------+----------------------------+
| 27 | 2024-08-22 15:37:53.017211 | 2024-08-22 15:38:17.093492 |
| 27 | 2024-08-22 15:37:38.016420 | 2024-08-22 15:38:17.093492 |
| 27 | 2024-08-22 15:37:23.013585 | 2024-08-22 15:38:17.093492 |
| 27 | 2024-08-22 15:37:08.012573 | 2024-08-22 15:38:17.093492 |
| 3 | 2024-08-22 15:37:07.983366 | 2024-08-22 15:38:17.093492 |
| 27 | 2024-08-22 15:36:53.029679 | 2024-08-22 15:38:17.093492 |
| 27 | 2024-08-22 15:36:38.013604 | 2024-08-22 15:38:17.093492 |
| 27 | 2024-08-22 15:36:23.019134 | 2024-08-22 15:38:17.093492 |
| 27 | 2024-08-22 15:36:08.013703 | 2024-08-22 15:38:17.093492 |
| 3 | 2024-08-22 15:36:07.982602 | 2024-08-22 15:38:17.093492 |
+----------+----------------------------+----------------------------+
10 rows in set (0.01 sec)
mysql> select now();
+----------------------------+
| now() |
+----------------------------+
| 2024-08-22 15:38:43.428470 |
+----------------------------+
1 row in set (0.00 sec)
mysql> select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10;
+----------+----------------------------+----------------------------+
| count(1) | collecttime | now() |
+----------+----------------------------+----------------------------+
| 27 | 2024-08-22 15:38:23.010317 | 2024-08-22 15:38:48.168510 |
| 27 | 2024-08-22 15:38:08.012070 | 2024-08-22 15:38:48.168510 |
| 3 | 2024-08-22 15:38:07.985746 | 2024-08-22 15:38:48.168510 |
| 27 | 2024-08-22 15:37:53.017211 | 2024-08-22 15:38:48.168510 |
| 27 | 2024-08-22 15:37:38.016420 | 2024-08-22 15:38:48.168510 |
| 27 | 2024-08-22 15:37:23.013585 | 2024-08-22 15:38:48.168510 |
| 27 | 2024-08-22 15:37:08.012573 | 2024-08-22 15:38:48.168510 |
| 3 | 2024-08-22 15:37:07.983366 | 2024-08-22 15:38:48.168510 |
| 27 | 2024-08-22 15:36:53.029679 | 2024-08-22 15:38:48.168510 |
| 27 | 2024-08-22 15:36:38.013604 | 2024-08-22 15:38:48.168510 |
+----------+----------------------------+----------------------------+
10 rows in set (0.02 sec)
checked.
commit id: 80509e68b
@aressu1985 ptal
confirm,closed commit:b951e492203ed7e953c84c4fa0417272a72c0a34 mysql> select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10; +----------+----------------------------+----------------------------+ | count(1) | collecttime | now() | +----------+----------------------------+----------------------------+ | 25 | 2024-10-24 17:32:35.467566 | 2024-10-24 17:32:41.783535 | | 24 | 2024-10-24 17:32:20.460961 | 2024-10-24 17:32:41.783535 | | 24 | 2024-10-24 17:32:05.461440 | 2024-10-24 17:32:41.783535 | | 24 | 2024-10-24 17:31:50.465662 | 2024-10-24 17:32:41.783535 | | 3 | 2024-10-24 17:31:50.439749 | 2024-10-24 17:32:41.783535 | | 24 | 2024-10-24 17:31:35.465384 | 2024-10-24 17:32:41.783535 | | 24 | 2024-10-24 17:31:20.459111 | 2024-10-24 17:32:41.783535 | | 24 | 2024-10-24 17:31:05.467360 | 2024-10-24 17:32:41.783535 | | 24 | 2024-10-24 17:30:50.463041 | 2024-10-24 17:32:41.783535 | | 3 | 2024-10-24 17:30:50.442002 | 2024-10-24 17:32:41.783535 | +----------+----------------------------+----------------------------+ 10 rows in set (0.02 sec)
mysql> select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10; +----------+----------------------------+----------------------------+ | count(1) | collecttime | now() | +----------+----------------------------+----------------------------+ | 25 | 2024-10-24 17:32:35.467566 | 2024-10-24 17:32:45.098684 | | 24 | 2024-10-24 17:32:20.460961 | 2024-10-24 17:32:45.098684 | | 24 | 2024-10-24 17:32:05.461440 | 2024-10-24 17:32:45.098684 | | 24 | 2024-10-24 17:31:50.465662 | 2024-10-24 17:32:45.098684 | | 3 | 2024-10-24 17:31:50.439749 | 2024-10-24 17:32:45.098684 | | 24 | 2024-10-24 17:31:35.465384 | 2024-10-24 17:32:45.098684 | | 24 | 2024-10-24 17:31:20.459111 | 2024-10-24 17:32:45.098684 | | 24 | 2024-10-24 17:31:05.467360 | 2024-10-24 17:32:45.098684 | | 24 | 2024-10-24 17:30:50.463041 | 2024-10-24 17:32:45.098684 | | 3 | 2024-10-24 17:30:50.442002 | 2024-10-24 17:32:45.098684 | +----------+----------------------------+----------------------------+ 10 rows in set (0.01 sec)
mysql> select count(1), collecttime, now() from system_metrics.metric group by collecttime order by collecttime desc limit 10; +----------+----------------------------+----------------------------+ | count(1) | collecttime | now() | +----------+----------------------------+----------------------------+ | 25 | 2024-10-24 17:32:35.467566 | 2024-10-24 17:32:46.396011 | | 24 | 2024-10-24 17:32:20.460961 | 2024-10-24 17:32:46.396011 | | 24 | 2024-10-24 17:32:05.461440 | 2024-10-24 17:32:46.396011 | | 24 | 2024-10-24 17:31:50.465662 | 2024-10-24 17:32:46.396011 | | 3 | 2024-10-24 17:31:50.439749 | 2024-10-24 17:32:46.396011 | | 24 | 2024-10-24 17:31:35.465384 | 2024-10-24 17:32:46.396011 | | 24 | 2024-10-24 17:31:20.459111 | 2024-10-24 17:32:46.396011 | | 24 | 2024-10-24 17:31:05.467360 | 2024-10-24 17:32:46.396011 | | 24 | 2024-10-24 17:30:50.463041 | 2024-10-24 17:32:46.396011 | | 3 | 2024-10-24 17:30:50.442002 | 2024-10-24 17:32:46.396011 | +----------+----------------------------+----------------------------+ 10 rows in set (0.00 sec)