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

meta level #42

Open
acelyc111 opened this issue Nov 7, 2022 · 2 comments
Open

meta level #42

acelyc111 opened this issue Nov 7, 2022 · 2 comments

Comments

@acelyc111
Copy link
Owner

No description provided.

@acelyc111
Copy link
Owner Author

acelyc111 commented Nov 7, 2022

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
超时时也会执行重试

  • update_configuration_on_remote
    更新partition的配置信息
  • update_partition_max_replica_count_on_remote
    设置表的最大副本数

小于等于fl_freezed

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

  • 由定时任务meta_service::balancer_run发起,受参数lb_interval_ms控制,默认10秒
    忽略set_max_replica_count

小于等于fl_steady

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

  • 对于已删除表,将忽略过期表分片的GC
  • 对于健康表,将忽略“无用”(由collect_replica判断)分片的GC
    check_all_partitions时
  • (小于fl_steady直接不执行)等于fl_steady时只做report

等于fl_lively

做rebalance

@acelyc111
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant