TDengine icon indicating copy to clipboard operation
TDengine copied to clipboard

different results with the same series of operations on newly created stable

Open deuxmille opened this issue 6 years ago • 4 comments

请问这个图片里显示1个stable有2条一模一样的记录 正常吗? 每次这一套操作下来,stable里数据有时候是1行有时候是2行,请问是为什么?

Environment (please complete the following information):

  • OS: [e.g. Ubuntu 20.04]
  • Memory, CPU, current Disk Space
  • TDengine Version [e.g. 2.0.7.0]

deuxmille avatar Dec 04 '20 01:12 deuxmille

updated to ver 2.0.8.2, problem easily reproduces.

deuxmille avatar Dec 04 '20 16:12 deuxmille

taos> use test; Database changed.

taos> use sample_db; Database changed.

taos> INSERT INTO table1 using sample_db.sample_stable TAGS(sh600000,0) VALUES(1 563249722000,1,2,3.0,4,'abcde',5,6,true,'fd'); Query OK, 1 row(s) affected (0.008122s)

taos> use test; Database changed.

taos> INSERT INTO table1 using sample_db.sample_stable TAGS(sh600000,0) VALUES(1 563249722000,1,2,3.0,4,'abcde',5,6,true,'fd'); Query OK, 1 row(s) affected (0.004836s)

taos> INSERT INTO table1 using sample_db.sample_stable TAGS(sh600001,0) VALUES(1 Query OK, 1 row(s) affected (0.000472s),'fd');

taos> select * from sample_db.sample_stable; col_ts | col_int | col_bigint | col_float | clo_double | col_binary | col_smallint | col_tinyint | col_bool | col_nchar | instrument_config_name | exchange_id |

2019-07-16 04:02:02.000 | 1 | 2 | 3.00000 | 4.000000000 | abcde | 5 | 6 | true | fd | sh600000 | 0 | 2019-07-16 04:02:02.000 | 1 | 2 | 3.00000 | 4.000000000 | abcde | 5 | 6 | true | fd | sh600000 | 0 | Query OK, 2 row(s) in set (0.007480s)

taos> describe sample_db.sample_stable; Field | Type | Length | Note |

col_ts | TIMESTAMP | 8 | | col_int | INT | 4 | | col_bigint | BIGINT | 8 | | col_float | FLOAT | 4 | | clo_double | DOUBLE | 8 | | col_binary | BINARY | 5 | | col_smallint | SMALLINT | 2 | | col_tinyint | TINYINT | 1 | | col_bool | BOOL | 1 | | col_nchar | NCHAR | 20 | | instrument_config_name | BINARY | 50 | TAG | exchange_id | TINYINT | 1 | TAG | Query OK, 12 row(s) in set (0.000217s)

taos> use sample_db; Database changed.

taos> show tables; table_name | created_time | columns | stable_name | uid | tid | vgId |

table1 | 2020-12-04 15:58:58.809 | 10 | sample_stable | 3096224763168379 | 1 | 11 | Query OK, 1 row(s) in set (0.001177s)

taos> show stables; name | created_time | columns | tags | tables |

sample_stable | 2020-12-04 15:55:47.747 | 10 | 2 | 2 | Query OK, 1 row(s) in set (0.000747s)

deuxmille avatar Dec 04 '20 16:12 deuxmille

"select loc,* from test.meters where loc='shanghai' limit 10", // 显示集群节点 "SHOW DNODES", // 显示数据库 "SHOW DATABASES", // 删除数据库 "DROP DATABASE sample_db", // 删除一个不存在的数据库 "DROP DATABASE sample_db", // 创造一个保存100年的数据库 "CREATE DATABASE sample_db KEEP 36500", // 设定数据库不压缩 "ALTER DATABASE sample_db COMP 0", // 显示数据库 "SHOW DATABASES", // 新建超级表 "CREATE TABLE sample_db.sample_stable (col_ts TIMESTAMP, col_int INT, col_bigint BIGINT, col_float FLOAT, clo_double DOUBLE, col_binary BINARY(5), col_smallint SMALLINT, col_tinyint TINYINT, col_bool BOOL, col_nchar NCHAR(20)) TAGS(instrument_config_name BINARY(50), exchange_id TINYINT)", // 显示超级表属性 "DESCRIBE sample_db.sample_stable", // 插入数据到超级表 //"INSERT INTO table1 USING sample_db.sample_stable TAGS('SH600',0) VALUES(" + to_string(TimeUtils::GetCurrentNanosecondUnixTime()) + ",1,2,3.0,4,'abcde',5,6,true,'中文')", "use test", "use sample_db", "INSERT INTO table1 using sample_db.sample_stable TAGS(sh600000,0) VALUES(1563249722000,1,2,3.0,4,'abcde',5,6,true,'fd')", "use test", "INSERT INTO table1 using sample_db.sample_stable TAGS(sh600000,0) VALUES(1563249722000,1,2,3.0,4,'abcde',5,6,true,'fd')", "INSERT INTO table1 using sample_db.sample_stable TAGS(sh600001,0) VALUES(1563249722000,1,2,3.0,4,'abcde',5,6,true,'fd')", "select * from sample_db.sample_stable", "select count(*) from sample_db.sample_stable", "DESCRIBE sample_db.sample_stable", "show tables", "show stables",

这套语句跑下来必出问题。 "select * from sample_db.sample_stable",跑到这一步的时候,在cli里能显示出2条一模一样的记录,在cpp程序里用taos_fetch_row都拿不到正确的指针。

deuxmille avatar Dec 04 '20 16:12 deuxmille

注意到您在数据库 test 中基于数据库 sample_db 中的超级表 sample_stable 创建了一个字表,这是导致两条相同记录的原因。 跨库建子表是一个我们已知的 bug,目前需要用户在使用时避免。

localvar avatar Dec 05 '20 03:12 localvar