]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
osd/OSDMap: allow bidirectional swap of pg-upmap-items
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 12 Jul 2017 03:15:13 +0000 (11:15 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 15 Jul 2017 04:29:57 +0000 (12:29 +0800)
commit09af9b8afb40cc8aa629501582a75e03edf0bf2e
tree0a2dc3e6318b6d1b5a1a70ecd369aceb8a382489
parent70e664b7c89619a0a4f90ba154c48920b70173b4
osd/OSDMap: allow bidirectional swap of pg-upmap-items

This is useful when we also want an even distribution of pg primaries across osds.
For example:
Was:
[0 1 2]

By applying bidirectional swap of pg-upmap-items mapping [[0,1],[1,0]], now:
[1 0 2]

Thus we successfully decrease the number of primaries of osd.0 by 1 without
affecting the current (even) distribution of global pgs.

Real exmaple:
./bin/ceph pg ls-by-pool rbd
PG_STAT OBJECTS MISSING_ON_PRIMARY DEGRADED MISPLACED UNFOUND BYTES LOG DISK_LOG STATE        STATE_STAMP                VERSION REPORTED UP      UP_PRIMARY ACTING  ACTING_PRIMARY LAST_SCRUB SCRUB_STAMP                LAST_DEEP_SCRUB DEEP_SCRUB_STAMP
3.0           0                  0        0         0       0     0   0        0 active+clean 2017-07-12 15:14:45.083441     0'0    29:13 [0,1,3]          0 [0,1,3]              0        0'0 2017-07-12 15:14:14.515989             0'0 2017-07-12 15:14:14.515989

./bin/ceph osd pg-upmap-items 3.0 0 1 1 0 3 5
set 3.0 pg_upmap_items mapping to [0->1,1->0,3->5]

./bin/ceph pg ls-by-pool rbd
PG_STAT OBJECTS MISSING_ON_PRIMARY DEGRADED MISPLACED UNFOUND BYTES LOG DISK_LOG STATE        STATE_STAMP                VERSION REPORTED UP      UP_PRIMARY ACTING  ACTING_PRIMARY LAST_SCRUB SCRUB_STAMP                LAST_DEEP_SCRUB DEEP_SCRUB_STAMP
3.0           0                  0        0         0       0     0   0        0 active+clean 2017-07-12 15:16:22.648424     0'0    33:13 [1,0,5]          1 [1,0,5]              1        0'0 2017-07-12 15:14:14.515989             0'0 2017-07-12 15:14:14.515989

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/OSDMap.cc