matrixorigin / matrixone

Hyperconverged cloud-edge native database
https://docs.matrixorigin.cn/en
Apache License 2.0
1.74k stars 271 forks source link

[Bug]: DROP ACCOUNT IF EXISTS returns error #7460

Closed aylei closed 1 year ago

aylei commented 1 year ago

Is there an existing issue for the same bug?

Environment

- Version or commit-id (e.g. v0.1.0 or 8b23a93): nightly-ca387368

Actual Behavior

mysql> select * from mo_catalog.mo_account;
+------------+--------------------------------------+--------+---------------------+----------------+----------------+
| account_id | account_name                         | status | created_time        | comments       | suspended_time |
+------------+--------------------------------------+--------+---------------------+----------------+----------------+
|          5 | 66a4365a_b5df_40b4_9f90_1123cccabcff | open   | 2023-01-04 12:05:55 |                | NULL           |
|          2 | tecent                               | open   | 2023-01-04 06:31:15 |                | NULL           |
|          8 | f1276616_ab61_4ef5_8975_b65ecc62e0c8 | open   | 2023-01-05 06:56:38 |                | NULL           |
|          3 | test1                                | open   | 2023-01-04 09:17:25 |                | NULL           |
|          0 | sys                                  | open   | 2023-01-04 05:25:52 | system account | NULL           |
|          4 | 6114f60d_2077_4bd6_9338_33ceb01eeea8 | open   | 2023-01-04 09:44:34 |                | NULL           |
+------------+--------------------------------------+--------+---------------------+----------------+----------------+
6 rows in set (2.30 sec)

mysql> DROP ACCOUNT IF EXISTS 0e6cc8c7_3b16_4caf_a8eb_0dfa0848e0f4;
ERROR 1064 (HY000): SQL parser error: table "__mo_index_unique_uniq_acc_2e8bd38e-8c0f-11ed-8836-562ee6bc62d9" does not exist
mysql> DROP ACCOUNT IF EXISTS 0e6cc8c7_3b16_4caf_a8eb_0dfa0848e0f4;
ERROR 1064 (HY000): SQL parser error: table "__mo_index_unique_uniq_acc_2e8bd38e-8c0f-11ed-8836-562ee6bc62d9" does not exist

Update: drop existing account will succeed but still complain error

mysql> create account test2 admin_name admin identified by '123456';
Query OK, 0 rows affected (6.54 sec)
mysql> select * from mo_catalog.mo_account;
+------------+--------------------------------------+---------+---------------------+----------------+---------------------+
| account_id | account_name                         | status  | created_time        | comments       | suspended_time      |
+------------+--------------------------------------+---------+---------------------+----------------+---------------------+
|         12 | test2                                | open    | 2023-01-06 02:55:32 |                | NULL                |
|          8 | f1276616_ab61_4ef5_8975_b65ecc62e0c8 | open    | 2023-01-05 06:56:38 |                | NULL                |
|          3 | test1                                | open    | 2023-01-04 09:17:25 |                | NULL                |
|          2 | tecent                               | suspend | 2023-01-04 06:31:15 |                | 2023-01-05 09:28:39 |
|          5 | 66a4365a_b5df_40b4_9f90_1123cccabcff | open    | 2023-01-04 12:05:55 |                | NULL                |
|         10 | 5d9c42d7_65b4_4a1d_ac42_f027998aeaf0 | open    | 2023-01-05 09:37:56 |                | NULL                |
|          4 | 6114f60d_2077_4bd6_9338_33ceb01eeea8 | open    | 2023-01-04 09:44:34 |                | NULL                |
|          0 | sys                                  | open    | 2023-01-04 05:25:52 | system account | NULL                |
|          9 | 1ba05dbd_dae5_4d3b_9051_218d4eb6bd24 | open    | 2023-01-05 08:04:32 |                | NULL                |
+------------+--------------------------------------+---------+---------------------+----------------+---------------------+
9 rows in set (2.73 sec)

mysql> drop account test2;
ERROR 1064 (HY000): SQL parser error: table "__mo_index_unique_uniq_acc_2e8bd38e-8c0f-11ed-8836-562ee6bc62d9" does not exist
mysql> select * from mo_catalog.mo_account;
+------------+--------------------------------------+---------+---------------------+----------------+---------------------+
| account_id | account_name                         | status  | created_time        | comments       | suspended_time      |
+------------+--------------------------------------+---------+---------------------+----------------+---------------------+
|          0 | sys                                  | open    | 2023-01-04 05:25:52 | system account | NULL                |
|         10 | 5d9c42d7_65b4_4a1d_ac42_f027998aeaf0 | open    | 2023-01-05 09:37:56 |                | NULL                |
|          9 | 1ba05dbd_dae5_4d3b_9051_218d4eb6bd24 | open    | 2023-01-05 08:04:32 |                | NULL                |
|          4 | 6114f60d_2077_4bd6_9338_33ceb01eeea8 | open    | 2023-01-04 09:44:34 |                | NULL                |
|          5 | 66a4365a_b5df_40b4_9f90_1123cccabcff | open    | 2023-01-04 12:05:55 |                | NULL                |
|          3 | test1                                | open    | 2023-01-04 09:17:25 |                | NULL                |
|          8 | f1276616_ab61_4ef5_8975_b65ecc62e0c8 | open    | 2023-01-05 06:56:38 |                | NULL                |
|          2 | tecent                               | suspend | 2023-01-04 06:31:15 |                | 2023-01-05 09:28:39 |
+------------+--------------------------------------+---------+---------------------+----------------+---------------------+
8 rows in set (2.75 sec)

Expected Behavior

DROP ACCOUNT IF EXISTS should succeed if the account is not exist.

Steps to Reproduce

N/A

Additional information

No response

aylei commented 1 year ago

@daviszhen PTAL

qingxinhome commented 1 year ago

I will deal with it as soon as possible

qingxinhome commented 1 year ago

I will deal with it as soon as possible

qingxinhome commented 1 year ago

I know this

aylei commented 1 year ago

According to @qingxinhome , a similar issue was fixed in https://github.com/matrixorigin/matrixone/issues/7475 and we cannot reproduce this issue anymore.

Closing, will reopen if we reproduce this issue in the future.