If we don't specify the version up front, learn the version after the first
chunk and enforce it thereafter to ensure we do not get torn content.
Signed-off-by: Sage Weil <sage@inktank.com>
Block any request on an object (read or write) during the COPY_FROM
operation.
This could potentially be broken down into read vs write operations without
much difficulty, but blocking any op indescriminately is sufficient for
now, so let's keep it simple.
Signed-off-by: Sage Weil <sage@inktank.com>
Add an is_blocked() method for the obc, and add infrastructure to block
any operations if it returns true. Clean up on_change(), and add a helper
to kick an obc when whatever condition leading to it being blocked is no
longer true.
For now, is_blocked() is always false...
Signed-off-by: Sage Weil <sage@inktank.com>
As we get each chunk of data during the COPY_FROM operation, write it out
to a temporary object on the replicas. When we get all the pieces, move
it into place.
Signed-off-by: Sage Weil <sage@inktank.com>
If the repop has no version set, skip the updates to last_update and
last_update_{applied,ondisk} and last_complete_ondisk.
Signed-off-by: Sage Weil <sage@inktank.com>
Allow us to mark when we start and stop using a temporary object in a
sub_op. If we start to use it, make sure the collection exists on the
replica.
Signed-off-by: Sage Weil <sage@inktank.com>
This is similar to a collection_add + collection_move sequence in that we
apply the same replay guards. The difference is that we roll it up into
a single operation, change the filename, and make the omap content carry
over by calling DBObjectMap->clone (as there is no rename function or
collection awareness in the DBObjectMap).
Signed-off-by: Sage Weil <sage@inktank.com>
libec_example.la is a fully functional plugin based on
ErasureCodeExample to test the ErasureCodePlugin abstract
interface. It is dynamically loaded to test the
ErasureCodePluginRegistry implementation.
Although the plugin is built in the test directory, it will be
installed. noinst_LTLIBRARIES won't build the shared library, only the
static version which is not suitable for testing.
http://tracker.ceph.com/issues/5878 refs #5878
Signed-off-by: Loic Dachary <loic@dachary.org>
A ErasureCodePluginRegistry singleton holds all erasure plugin objects
derived from ErasureCodePlugin and dlopen(2) handles for the lifetime
of the OSD and is cleaned up by the destructor.
The registry has a single entry point ( method factory ) and should
be used as follows:
map<std::string,std::string> parameters;
parameters["directory"] = "/usr/lib/ceph/erasure-code";
ErasureCodeInterfaceRef erasure_code;
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
instance.factory("jerasure", parameters, &erasure_code));
If the plugin requested ( "jerasure" in the example above ) is not
found in the *plugins* data member, the load method is called and will:
* dlopen(parameters["erasure-code-directory"] + "jerasure")
* f = dlsym("__erasure_code_init")
* f("jerasure")
* check that it registered "jerasure"
The plugin is expected to do something like
instance.add(plugin_name, new ErasureCodePluginJerasure());
to register itself.
The factory method is protected with a Mutex to avoid race
conditions when using the same plugin from two threads.
The erasure_codelib_LTLIBRARIES variable is added to the Makefile
and the plugins are expected to add themselves and be installed
in the $(libdir)/erasure-code
http://tracker.ceph.com/issues/5878 refs #5878
Signed-off-by: Loic Dachary <loic@dachary.org>
When dynamically loaded, a plugin is expected to define
int __erasure_code_init(char *plugin_name);
When called, it is responsible for registering an ErasureCodePlugin
derived object that provides a factory method from which the concrete
implementation of the ErasureCodeInterface object can be generated:
virtual int factory(const map<std::string,std::string> ¶meters,
ErasureCodeInterfaceRef *erasure_code) {
*erasure_code = ErasureCodeInterfaceRef(new ErasureCodeExample(parameters));
return 0;
}
The plugin instance contains the library data member which is used to
store the handle of the shared library. It is opaque to the plugin.
http://tracker.ceph.com/issues/5878 refs #5878
Signed-off-by: Loic Dachary <loic@dachary.org>
An erasure code implementation designed for tests. Although it is fully
functional and could be used on actual data, it is mainly provided for
testing purposes. It splits data in two, computes an XOR parity and
can sustain the loss of one chunk.
The constructor will usleep(3) for parameters["usleep"] microseconds
so that the caller can create race conditions.
http://tracker.ceph.com/issues/5878 refs #5878
Signed-off-by: Loic Dachary <loic@dachary.org>
The erasure coded pool relies on this abstract interface to encode and
decode the chunks stored in the OSD. It has been designed to be
generic enough to accomodate the libraries and algorithms that are
most likely to be used. It does not claim to be universal.
http://tracker.ceph.com/issues/5878 refs #5878
Signed-off-by: Loic Dachary <loic@dachary.org>
cct is a member of the ObjBencher parent that we are trying to
initialize; need to pass in cct_ here.
Broken in 5dd0a83f91.
Fixes: #6256
Signed-off-by: Sage Weil <sage@inktank.com>
- Enabling subdir objects
- Created a Makefile-env.am with basic automake init
- Created .am files per subdir, included from src/Makefile.am
Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>
The previous name could cause confusion (it's not only used to test
build libcommon anymore).
Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>