]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
erasure-code: implement consistent error stream 4708/head
authorLoic Dachary <ldachary@redhat.com>
Sun, 17 May 2015 13:28:52 +0000 (15:28 +0200)
committerLoic Dachary <ldachary@redhat.com>
Mon, 25 May 2015 14:59:02 +0000 (16:59 +0200)
commitdb7936ae1c8ff0cb102460b820621eb0e56e7856
tree4426dec833c3d8309e77e0a5e630250339b56ddd
parent0822922566e0bc67741a59933d2c9fc150e75d31
erasure-code: implement consistent error stream

The error stream in the erasure code path is broken and the error
message is sometime not reported back to the user. For instance the
ErasureCodePlugin::factory method has no error stream: when an error
happens the user is left with a cryptic error code that needs lookup in
the sources to figure it out.

The error stream is made more systematic by:

  * always pass it as ostream *ss (instead of something passing it as
    a reference and sometime as a stringstream)

  * ostream *ss is added to ErasureCodePlugin::factory

  * define the ErasureCodeInterface::init pure virtual. It is
    already implemented by all plugins, only in slightly different
    ways. The ostream *ss is added so the init function has a way to
    report error in a human readable way to the caller, in addition to
    the error code.

The ErasureCodePluginJerasure::init return value was incorrectly ignored
when called from ErasureCodePluginJerasure::factory and now returns when
it fails.

The ErasureCodeLrc::layers_init method is given ostream *ss for error
messages instead of printing them via derr.

The ErasureCodePluginLrc::factory method no longer prints errors via
derr: this workaround is made unnecessary by the ostream *ss argument.

The ErasureCodeShec::init ostream *ss argument is ignored. The
ErasureCodeShec::parse method entirely relies on derr to report errors
and converting it goes beyond the scope of this cleanup. There is a
slight risk of getting it wrong and it deserves a separate commit and
careful and independent review.

The PGBackend, OSDMonitor.{cc,h} changes are only about prototype
changes.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
35 files changed:
src/ceph_mon.cc
src/ceph_osd.cc
src/erasure-code/ErasureCodeInterface.h
src/erasure-code/ErasureCodePlugin.cc
src/erasure-code/ErasureCodePlugin.h
src/erasure-code/isa/ErasureCodeIsa.cc
src/erasure-code/isa/ErasureCodeIsa.h
src/erasure-code/isa/ErasureCodePluginIsa.cc
src/erasure-code/jerasure/ErasureCodeJerasure.cc
src/erasure-code/jerasure/ErasureCodeJerasure.h
src/erasure-code/jerasure/ErasureCodePluginJerasure.cc
src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
src/erasure-code/lrc/ErasureCodeLrc.cc
src/erasure-code/lrc/ErasureCodeLrc.h
src/erasure-code/lrc/ErasureCodePluginLrc.cc
src/erasure-code/shec/ErasureCodePluginShec.cc
src/erasure-code/shec/ErasureCodeShec.cc
src/erasure-code/shec/ErasureCodeShec.h
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/osd/PGBackend.cc
src/test/erasure-code/ErasureCodeExample.h
src/test/erasure-code/ErasureCodePluginExample.cc
src/test/erasure-code/TestErasureCode.cc
src/test/erasure-code/TestErasureCodeIsa.cc
src/test/erasure-code/TestErasureCodeJerasure.cc
src/test/erasure-code/TestErasureCodeLrc.cc
src/test/erasure-code/TestErasureCodePlugin.cc
src/test/erasure-code/TestErasureCodePluginIsa.cc
src/test/erasure-code/TestErasureCodePluginJerasure.cc
src/test/erasure-code/TestErasureCodePluginLrc.cc
src/test/erasure-code/TestErasureCodeShec.cc
src/test/erasure-code/TestErasureCodeShec_all.cc
src/test/erasure-code/TestErasureCodeShec_thread.cc
src/test/erasure-code/ceph_erasure_code.cc