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

Error creating placement_policy using singleton mode #1967

Open
IvanGao01 opened this issue Jan 27, 2024 · 0 comments
Open

Error creating placement_policy using singleton mode #1967

IvanGao01 opened this issue Jan 27, 2024 · 0 comments
Assignees
Labels
type/bug Something isn't working

Comments

@IvanGao01
Copy link
Member

Describe the bug

Error creating placement_policy using singleton mode

To Reproduce

  1. Create placement_policy
```sql
create placement_policy test_policy WITH rule simple dc 'dc1' rack 'rack1';
  1. Create database and associating test_policy
create database db with replica 1 placement_policy 'test_policy';

Creation failed:

{
    "error_code": "030053",
    "error_message": "Valid node is not enough, need: 1, but found: 0"
}
  1. But when I change replica to 0, I can create it successfully
create database test_db with replica 0 placement_policy 'test_policy';

When I write data to the database, I can't query the data under test_db and find that the log reports an error:

2024-01-27T09:20:56.298321132Z  INFO meta::store::state_machine: METADATA WRITE: /cluster_xxx/auto_incr_id :5
The application panicked (crashed).
Message:  attempt to calculate the remainder with a divisor of zero
Location: common/models/src/meta_data.rs:428

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 8 frames hidden ⋮
   9: core::panicking::panic::hee3e155c560a4e20
      at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/core/src/panicking.rs:117
  10: models::meta_data::allocation_replication_set::h4d6b808c885b4d3f
      at <unknown source file>:<unknown line>
  11: meta::store::state_machine::StateMachine::process_write_command::h2fc24e1a8c881abf
      at <unknown source file>:<unknown line>
  12: actix_web::handler::handler_service::{{closure}}::{{closure}}::h6e488a4e070caf18
      at <unknown source file>:<unknown line>
  13: <actix_web::resource::Resource<T> as actix_web::service::HttpServiceFactory>::register::{{closure}}::{{closure}}::h4815bb3d14bc3b9c
      at <unknown source file>:<unknown line>
  14: <actix_service::map_err::MapErrFuture<A,Req,F,E> as core::future::future::Future>::poll::hde61340ade70a6d8
      at <unknown source file>:<unknown line>
  15: actix_http::h1::dispatcher::InnerDispatcher<T,S,B,X,U>::poll_response::h25178d24b741b807
      at <unknown source file>:<unknown line>
  16: <actix_http::h1::dispatcher::Dispatcher<T,S,B,X,U> as core::future::future::Future>::poll::h340f185ed0aad9c0
      at <unknown source file>:<unknown line>
  17: tokio::runtime::task::raw::poll::had57e85f3bca3a32
      at <unknown source file>:<unknown line>
  18: tokio::task::local::LocalSet::tick::h47770efa15dedf30
      at <unknown source file>:<unknown line>
  19: tokio::task::local::LocalSet::run_until::{{closure}}::hbd66aee0e8111ffd
      at <unknown source file>:<unknown line>
  20: actix_server::worker::ServerWorker::start::{{closure}}::h031fc9509d266ab8
      at <unknown source file>:<unknown line>
  21: std::sys_common::backtrace::__rust_begin_short_backtrace::h8e338473f25467be
      at <unknown source file>:<unknown line>
  22: core::ops::function::FnOnce::call_once{{vtable.shim}}::h7153ce45ece5d917
      at <unknown source file>:<unknown line>
  23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h40268ec1e3f75121
      at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1976
  24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb4cdee1772a16528
      at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1976
  25: std::sys::unix::thread::Thread::new::thread_start::h71a921bd46112f49
      at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys/unix/thread.rs:108
  26: __clone<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
2024-01-27T09:21:00.892444134Z  INFO meta::store::state_machine: METADATA WRITE: /data_version :231
2024-01-27T09:21:00.892748176Z  INFO meta::store::state_machine: METADATA WRITE(ver: 231): /cluster_xxx/tenants/cnosdb/dbs/usage_schema/schemas/http_data_in :{"TsKvTableSchema":{"tenant":"cnosdb","db":"usage_schema","name":"http_data_in","schema_id":1,"next_column_id":8,"columns":[{"id":0,"name":"time","column_type":{"Time":"Nanosecond"},"encoding":"Default"},{"id":1,"name":"api","column_type":"Tag","encoding":"Default"},{"id":2,"name":"host","column_type":"Tag","encoding":"Default"},{"id":3,"name":"node_id","column_type":"Tag","encoding":"Default"},{"id":4,"name":"tenant","column_type":"Tag","encoding":"Default"},{"id":5,"name":"user","column_type":"Tag","encoding":"Default"},{"id":6,"name":"value","column_type":{"Field":"Unsigned"},"encoding":"Default"},{"id":7,"name":"database","column_type":"Tag","encoding":"Default"}],"columns_index":{"time":0,"database":7,"node_id":3,"user":5,"tenant":4,"api":1,"value":6,"host":2}}}
2024-01-27T09:21:00.904460134Z  INFO meta::store::state_machine: METADATA WRITE: /data_version :232
2024-01-27T09:21:00.904525801Z  INFO meta::store::state_machine: METADATA WRITE(ver: 232): /cluster_xxx/tenants/cnosdb/dbs/usage_schema/schemas/http_write_duration :{"TsKvTableSchema":{"tenant":"cnosdb","db":"usage_schema","name":"http_write_duration","schema_id":0,"next_column_id":9,"columns":[{"id":0,"name":"time","column_type":{"Time":"Nanosecond"},"encoding":"Default"},{"id":1,"name":"api","column_type":"Tag","encoding":"Default"},{"id":2,"name":"database","column_type":"Tag","encoding":"Default"},{"id":3,"name":"host","column_type":"Tag","encoding":"Default"},{"id":4,"name":"le","column_type":"Tag","encoding":"Default"},{"id":5,"name":"node_id","column_type":"Tag","encoding":"Default"},{"id":6,"name":"tenant","column_type":"Tag","encoding":"Default"},{"id":7,"name":"user","column_type":"Tag","encoding":"Default"},{"id":8,"name":"value","column_type":{"Field":"Float"},"encoding":"Default"}],"columns_index":{"time":0,"tenant":6,"database":2,"api":1,"host":3,"le":4,"user":7,"value":8,"node_id":5}}}
2024-01-27T09:21:00.912708051Z  INFO meta::store::state_machine: METADATA WRITE: /data_version :233
2024-01-27T09:21:00.912760843Z  INFO meta::store::state_machine: METADATA WRITE(ver: 233): /cluster_xxx/tenants/cnosdb/dbs/usage_schema/schemas/http_writes :{"TsKvTableSchema":{"tenant":"cnosdb","db":"usage_schema","name":"http_writes","schema_id":0,"next_column_id":8,"columns":[{"id":0,"name":"time","column_type":{"Time":"Nanosecond"},"encoding":"Default"},{"id":1,"name":"api","column_type":"Tag","encoding":"Default"},{"id":2,"name":"database","column_type":"Tag","encoding":"Default"},{"id":3,"name":"host","column_type":"Tag","encoding":"Default"},{"id":4,"name":"node_id","column_type":"Tag","encoding":"Default"},{"id":5,"name":"tenant","column_type":"Tag","encoding":"Default"},{"id":6,"name":"user","column_type":"Tag","encoding":"Default"},{"id":7,"name":"value","column_type":{"Field":"Unsigned"},"encoding":"Default"}],"columns_index":{"tenant":5,"value":7,"database":2,"time":0,"user":6,"api":1,"host":3,"node_id":4}}}
2024-01-27T09:21:06.255026970Z  INFO meta::store::state_machine: METADATA WRITE: /cluster_xxx/auto_incr_id :6
The application panicked (crashed).
Message:  attempt to calculate the remainder with a divisor of zero
Location: common/models/src/meta_data.rs:428

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 8 frames hidden ⋮
   9: core::panicking::panic::hee3e155c560a4e20
      at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/core/src/panicking.rs:117
  10: models::meta_data::allocation_replication_set::h4d6b808c885b4d3f
      at <unknown source file>:<unknown line>
  11: meta::store::state_machine::StateMachine::process_write_command::h2fc24e1a8c881abf
      at <unknown source file>:<unknown line>
  12: actix_web::handler::handler_service::{{closure}}::{{closure}}::h6e488a4e070caf18
      at <unknown source file>:<unknown line>
  13: <actix_web::resource::Resource<T> as actix_web::service::HttpServiceFactory>::register::{{closure}}::{{closure}}::h4815bb3d14bc3b9c
      at <unknown source file>:<unknown line>
  14: <actix_service::map_err::MapErrFuture<A,Req,F,E> as core::future::future::Future>::poll::hde61340ade70a6d8
      at <unknown source file>:<unknown line>
  15: actix_http::h1::dispatcher::InnerDispatcher<T,S,B,X,U>::poll_response::h25178d24b741b807
      at <unknown source file>:<unknown line>
  16: <actix_http::h1::dispatcher::Dispatcher<T,S,B,X,U> as core::future::future::Future>::poll::h340f185ed0aad9c0
      at <unknown source file>:<unknown line>
  17: tokio::runtime::task::raw::poll::had57e85f3bca3a32
      at <unknown source file>:<unknown line>
  18: tokio::task::local::LocalSet::tick::h47770efa15dedf30
      at <unknown source file>:<unknown line>
  19: tokio::task::local::LocalSet::run_until::{{closure}}::hbd66aee0e8111ffd
      at <unknown source file>:<unknown line>
  20: actix_server::worker::ServerWorker::start::{{closure}}::h031fc9509d266ab8
      at <unknown source file>:<unknown line>
  21: std::sys_common::backtrace::__rust_begin_short_backtrace::h8e338473f25467be
      at <unknown source file>:<unknown line>
  22: core::ops::function::FnOnce::call_once{{vtable.shim}}::h7153ce45ece5d917
      at <unknown source file>:<unknown line>
  23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h40268ec1e3f75121
      at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1976
  24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb4cdee1772a16528
      at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1976
  25: std::sys::unix::thread::Thread::new::thread_start::h71a921bd46112f49
      at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys/unix/thread.rs:108
  26: __clone<unknown>
      at <unknown source file>:<unknown line>

Expected behavior

  1. replica should not be equal to 0.

Additional context

Version: cnosdb 2.3.4, revision df9517afd1b54e493caa549cc4adcefeb0ac9f32

deployment.mode = 'singleton'
@IvanGao01 IvanGao01 added the type/bug Something isn't working label Jan 27, 2024
@roseboy-liu roseboy-liu assigned lutengda and unassigned roseboy-liu Mar 27, 2024
@lutengda lutengda assigned IvanGao01 and unassigned lutengda May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants