注意
本文档适用于 Ceph 的开发版本。
ON-DISK FORMAT
UPGRADE PATH
在升级过程中,on-disk格式,甚至是数据结构格式,都可能会发生变化。需要进行更改的服务可以通过 PaxosService::upgrade_format() 调用路径来实现。没有形式化的统一格式版本控制;PaxosService 类通过存储中的一个键来跟踪其 format_version,假定为一个 unsigned int,但服务有责任赋予这些版本以意义。
AUTH MONITOR
versions
版本由单个 unsigned int 表示。默认情况下,值零表示没有正式升级的格式。第一个格式版本是在 Dumpling 中引入的;升级到 Dumpling 的集群的格式版本从零增加到一
0 to 1 - introduced in v0.65, dev release for v0.67 dumpling
1 to 2 - introduced in v12.0.2, dev release for luminous
2 to 3 - introduced in mimic
0 - all clusters pre-dumpling
1 - all clusters dumpling+ and pre-luminous
2 - all clusters luminous+ and pre-mimic
3 - all clusters mimic+
version 1: introduces new-style monitor caps (i.e., profiles)
version 2: introduces mgr caps and bootstrap-mgr key
version 3: creates all bootstrap and admin keys if they don't yet exist
callstack
format_version 在 PaxosService::refresh() 上设置
- initially called from Monitor::refresh_from_paxos
- initially called from Monitor::init_paxos()
- initially called from Monitor::preinit()
AuthMonitor::upgrade_format() 由 PaxosService::_active() 调用
- called from C_Committed callback, from PaxosService::propose_pending()
- called from C_Active callback, from PaxosService::_active()
- called from PaxosService::election_finished()
- on a freshly deployed cluster, upgrade_format() will be first called
*after* create_initial().
- on an existing cluster, upgrade_format() will be called after the first
election.
- upgrade_format() is irrelevant on a freshly deployed cluster, as there is
no format to upgrade at this point.
boil down
if format_version >= current_version then format is up-to-date, return.
if features doesn’t contain LUMINOUS then current_version = 1
else if features doesn’t contain MIMIC then current_version = 2
else current_version = 3
if format_version == 0
- upgrade to format version 1
- move to new-style monitor caps (i.e., profiles):
- set daemon profiles for existing entities
- set profile for existing bootstrap keys
if format_version == 1
- upgrade to format version 2
- for existing entities:
- add new cap for mgr
- for existing 'mgr' entities, fix 'mon' caps due to bug from kraken
setting 'allow \*', and set 'allow profile mgr' instead.
- add bootstrap-mgr key.
if format_version == 2
- upgrade to format version 3
- create all bootstrap keys if they don't currently exist