acelyc111 / pegasus

Apache License 2.0
1 stars 0 forks source link

meta level #42

Open acelyc111 opened 1 year ago

acelyc111 commented 1 year ago
enum meta_function_level
{
    // there are 4 ways to modify the meta-server's status:
    // 0. DDL operation: create/drop/recall table
    // 1. downgrade primary when dectect it is not alive
    // 2. accept primary's update-request to kickoff some secondaries
    // 3. make balancer proposal, which further trigger 2
    // according to these ways, we give meta several active level.

    fl_stopped = 100, //we don't take any action to modify the meta's status, even the DDL operations are not responsed
    fl_blind = 200, //only DDL operations are responsed, 1 2 3 are just ignored
    fl_freezed = 300, //0 1 are responsed, 2 3 ignored
    fl_steady = 400, //0 1 2 are responsed, don't do any balancer
    fl_lively = 500, //full functional
    fl_invalid = 10000
}

update_configuration_on_remote触发条件:

  1. drop_partition
    • 删表时
    • 初始化时,从remote同步表状态
  2. downgrade_primary_to_inactive
    • 节点挂掉时,将其上的primary副本置为inactive
  3. downgrade_stateless_nodes
    • 节点挂掉时,将其上无状态表(是啥?)的副本置为inactive
  4. on_update_configuration
    • 在meta server收到RPC_CM_UPDATE_PARTITION_CONFIGURATION请求,且level>fl_freezed时,会转调server_state::on_update_configuration
    • 它由replica server的update_configuration_on_meta_server发出,会在以下时机触发:
      • assign_primary
      • CT_ASSIGN_PRIMARY: 新建表时,DDD时,shell
      • CT_UPGRADE_TO_PRIMARY: rebalance时,move_primary、copy_primary
      • upgrade_to_secondary_on_primary: CT_UPGRADE_TO_SECONDARY
      • potential secondary -> secondary
      • downgrade_to_secondary_on_primary: CT_DOWNGRADE_TO_SECONDARY
      • move_primary、copy_primary、downgrade_to_secondary
      • downgrade_to_inactive_on_primary: CT_DOWNGRADE_TO_INACTIVE
      • downgrade_primary_to_inactive、downgrade_secondary_to_inactive
      • remove: CT_REMOVE
      • copy_primary、copy_secondary、on_redundant_secondary、downgrade_stateless_nodes、shell
      • on_config_sync中initializing: CT_PRIMARY_FORCE_UPDATE_BALLOT

小于等于fl_stopped

没有直接使用

小于等于fl_blind

当前level低于fl_blind时,将会一直pending,直到level满足条件时会执行_meta_svc->get_remote_storage()->set_data 超时时也会执行重试

小于等于fl_freezed

忽略on_update_configuration请求 忽略create app请求 忽略check_all_partitions

小于等于fl_steady

设置为这些时,将清理所有表的proposal队列 on_config_sync时

等于fl_lively

做rebalance

acelyc111 commented 1 year ago

在freezed状态只要放过CT_UPGRADE_TO_PRIMARY消息就能避免这个问题 企业微信截图_4d21adba-8683-4c0c-8530-7f75ddf62a35