]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: ECRecPred must be true if all chunks can be recovered 1921/head
authorLoic Dachary <loic-201408@dachary.org>
Wed, 27 Aug 2014 15:05:02 +0000 (17:05 +0200)
committerLoic Dachary <loic-201408@dachary.org>
Fri, 29 Aug 2014 17:39:57 +0000 (19:39 +0200)
ECRecPred assumes recovering any number of chunk is possible as long as
at least K chunks are available. It builds the want() set accordingly in
the constructor and arbitrarily set the first K chunks. But it would be
the same if it set the last K chunks.

While this is correct for jerasure and isa plugins, it is not true in
general. The predicate should assume that all chunks are going to be
recovered and return true if they can all be recovered. Otherwise, the
following can happen:

  * a PG has chunks 0,1,2,3 for K=2, M=2
  * ECRecPred is initialized a set want to 0,1 because K=2
  * ECRecPred claims the plugin can recover when provided 0,1
  * the plugin is then required to recover 0,1 using 2,3 and fails

This can happen for the LRC plugin with k=4,m=2,l=3 which is

  01234567
  DDc_DDc_
  DDDc____
  ____DDDc

and if chunks 0,1,2,3 are missing there is no way to recover chunks
4,5,6,7.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
src/osd/ECBackend.h

index 0e964070e4993d95dcb96c207d80ee9a17bebe6f..f6199ff32125f7ddba4130adc7ab530e179a998b 100644 (file)
@@ -389,7 +389,7 @@ public:
     ErasureCodeInterfaceRef ec_impl;
   public:
     ECRecPred(ErasureCodeInterfaceRef ec_impl) : ec_impl(ec_impl) {
-      for (unsigned i = 0; i < ec_impl->get_data_chunk_count(); ++i) {
+      for (unsigned i = 0; i < ec_impl->get_chunk_count(); ++i) {
        want.insert(i);
       }
     }