Skip to content

After shutting down cnosdb, tenant cannot be recovered after restarting #2397

Description

@paradox0503

Describe the bug

I set the tenant to have the drop_after option, then dropped the tenant, after that,i shut down CNOSDB and restarted it, but I cannot recover the tenant and it says tenant not found. However, when I create the tenant, it says tenant already exists.
QQ_1732272988202

To Reproduce

start CNOSDB
./target/debug/cnosdb run -M singleton --config ./config/config_8902.toml
in client:

public ❯ create tenant aaa with drop_after='1d';
Query took 0.016 seconds.
public ❯ drop tenant aaa;
+--------------------------------------------------------------------------------+
| tips                                                                           |
+--------------------------------------------------------------------------------+
| This tenant will drop after 86400s                                             |
| If you want to delete this tenant immediately, you need to do something extra: |
| 1)recover tenant "aaa";                                                        |
| 2)alter tenant "aaa" unset drop_after;                                         |
| 3)drop tenant "aaa";                                                           |
+--------------------------------------------------------------------------------+
Query took 0.015 seconds.

shutdown CNOSDB
restart CNOSDB
in client:

public ❯ SELECT * FROM cluster_schema.tenants;
+-------------+----------------------------------------------------------------------------------------------+
| tenant_name | tenant_options                                                                               |
+-------------+----------------------------------------------------------------------------------------------+
| cnosdb      | {"comment":"system tenant","limiter_config":null,"drop_after":null,"tenant_is_hidden":false} |
+-------------+----------------------------------------------------------------------------------------------+
Query took 0.014 seconds.
public ❯ create tenant aaa with drop_after='1d';
422 Unprocessable Entity, details: {"error_code":"030009","error_message":"The tenant aaa already exists"}
public ❯ recover tenant aaa;
422 Unprocessable Entity, details: {"error_code":"030010","error_message":"The tenant aaa not found"}
public ❯ 

Expected behavior

I need to recover tenant after I restart CNOSDB,otherwise I can‘t drop that tenant immediately

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions