]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: erasure-code-profile incremental rm before set 4296/head 4383/head
authorLoic Dachary <ldachary@redhat.com>
Wed, 18 Mar 2015 13:17:00 +0000 (14:17 +0100)
committerxinxin shu <xinxin.shu@intel.com>
Thu, 9 Apr 2015 06:42:44 +0000 (14:42 +0800)
It is possible for an incremental change to have both a rm and a set for
a given erasure code profile. It only happens when a rm is followed by a
set. When a set is followed by a rm, the rm will remove the pending set
in the incremental change.

The logic is the same for pool create and pool delete.

We must apply the incremental erasure-code-profile removal before the
creation otherwise rm and set in the same proposal will ignore the set.

This fix is minimal. A better change would be that erasure-code-profile
set checks if there is a pending removal and wait_for_finished_proposal
before creating.

http://tracker.ceph.com/issues/11144 Fixes: #11144

Signed-off-by: Loic Dachary <ldachary@redhat.com>
(cherry picked from commit 0d52aca0d0c302983d03b0f5213ffed187e4ed63)

Conflicts:
src/osd/OSDMap.cc
        resolved by replacing i++ with ++i

src/osd/OSDMap.cc

index 645a6f70d17b0e7bed3cbd2bd4bcfcb7ab54b3fa..63dc1da5640e0a816606b6dccb0231d82a110b22 100644 (file)
@@ -1222,6 +1222,11 @@ int OSDMap::apply_incremental(const Incremental &inc)
   }
 
   // erasure_code_profiles
+  for (vector<string>::const_iterator i = inc.old_erasure_code_profiles.begin();
+       i != inc.old_erasure_code_profiles.end();
+       ++i)
+    erasure_code_profiles.erase(*i);
+  
   for (map<string,map<string,string> >::const_iterator i =
         inc.new_erasure_code_profiles.begin();
        i != inc.new_erasure_code_profiles.end();
@@ -1229,11 +1234,6 @@ int OSDMap::apply_incremental(const Incremental &inc)
     set_erasure_code_profile(i->first, i->second);
   }
   
-  for (vector<string>::const_iterator i = inc.old_erasure_code_profiles.begin();
-       i != inc.old_erasure_code_profiles.end();
-       i++)
-    erasure_code_profiles.erase(*i);
-  
   // up/down
   for (map<int32_t,uint8_t>::const_iterator i = inc.new_state.begin();
        i != inc.new_state.end();