Assume we have a pool of crush-failure-domain OSD, then the stack will look like:
[
"0":"8" // stack[0]
"0":"1" // stack[1]
]
The above stack is error-prone because when passed to _choose_type_stack(),
iterator **i** shall already point to orig.end() when stack[0] is done
and might still get incremented while we continues to handle stack[1], and
hence produce the following abnormal (**overflowed**) mapping results:
```
-36> 2018-04-06 23:06:35.041274
7f84692bd700 10 total_deviation 24.6667 overfull 4,5,6,7,8 underfull [2,0,3,9]
-35> 2018-04-06 23:06:35.041278
7f84692bd700 10 osd.7 move 3
-34> 2018-04-06 23:06:35.041280
7f84692bd700 10 trying 2.0
-33> 2018-04-06 23:06:35.041310
7f84692bd700 10 2.0 [3,5,6,4,9,0,7,10] -> [
1953720676,
1683976050,
1919120229,
1769238633,
838889071,
3224629,101,2]
-32> 2018-04-06 23:06:35.041317
7f84692bd700 10 2.0 pg_upmap_items [3,
1953720676,5,
1683976050,6,
1919120229,4,
1769238633,9,
838889071,0,
3224629,7,101,10,2]
```
See also:
http://pulpito.ceph.com/yuriw-2018-04-06_21:35:03-rados-wip-yuri2-testing-2018-04-06-1946-luminous-distro-basic-smithi/
2365151/
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
(cherry picked from commit
47155949856e50d03b50993423acedddd14546e2)
if (numrep <= 0)
numrep += maxout;
type_stack.push_back(make_pair(type, numrep));
- type_stack.push_back(make_pair(0, 1));
+ if (type > 0)
+ type_stack.push_back(make_pair(0, 1));
int r = _choose_type_stack(cct, type_stack, overfull, underfull, orig,
i, used, &w);
if (r < 0)