Commit 1d1a95d5 authored by Matthieu Dorier's avatar Matthieu Dorier
Browse files

added sync mechanism

parent b9190a2f
...@@ -180,7 +180,11 @@ bool BerkeleyDBDataStore::erase(const ds_bulk_t &key) { ...@@ -180,7 +180,11 @@ bool BerkeleyDBDataStore::erase(const ds_bulk_t &key) {
Dbt db_key((void*)key.data(), key.size()); Dbt db_key((void*)key.data(), key.size());
int status = _dbm->del(NULL, &db_key, 0); int status = _dbm->del(NULL, &db_key, 0);
return status == 0; return status == 0;
} }
void BerkeleyDBDataStore::sync() {
_dbm->sync(0);
}
// In the case where Duplicates::ALLOW, this will return the first // In the case where Duplicates::ALLOW, this will return the first
// value found using key. // value found using key.
......
...@@ -39,6 +39,7 @@ class BerkeleyDBDataStore : public AbstractDataStore { ...@@ -39,6 +39,7 @@ class BerkeleyDBDataStore : public AbstractDataStore {
virtual void set_no_overwrite() { virtual void set_no_overwrite() {
_no_overwrite = true; _no_overwrite = true;
} }
virtual void sync();
remi_fileset_t create_and_populate_fileset() const; remi_fileset_t create_and_populate_fileset() const;
protected: protected:
virtual std::vector<ds_bulk_t> vlist_keys( virtual std::vector<ds_bulk_t> vlist_keys(
......
...@@ -28,6 +28,7 @@ class AbstractDataStore { ...@@ -28,6 +28,7 @@ class AbstractDataStore {
virtual void set_in_memory(bool enable)=0; // enable/disable in-memory mode (where supported) virtual void set_in_memory(bool enable)=0; // enable/disable in-memory mode (where supported)
virtual void set_comparison_function(const std::string& name, comparator_fn less)=0; virtual void set_comparison_function(const std::string& name, comparator_fn less)=0;
virtual void set_no_overwrite()=0; virtual void set_no_overwrite()=0;
virtual void sync() = 0;
virtual remi_fileset_t create_and_populate_fileset() const = 0; virtual remi_fileset_t create_and_populate_fileset() const = 0;
const std::string& get_path() const { const std::string& get_path() const {
......
...@@ -35,6 +35,10 @@ LevelDBDataStore::~LevelDBDataStore() { ...@@ -35,6 +35,10 @@ LevelDBDataStore::~LevelDBDataStore() {
//leveldb::Env::Shutdown(); // Riak version only //leveldb::Env::Shutdown(); // Riak version only
}; };
void LevelDBDataStore::sync() {
}
bool LevelDBDataStore::openDatabase(const std::string& db_name, const std::string& db_path) { bool LevelDBDataStore::openDatabase(const std::string& db_name, const std::string& db_path) {
_name = db_name; _name = db_name;
_path = db_path; _path = db_path;
......
...@@ -52,6 +52,7 @@ class LevelDBDataStore : public AbstractDataStore { ...@@ -52,6 +52,7 @@ class LevelDBDataStore : public AbstractDataStore {
virtual void set_no_overwrite() { virtual void set_no_overwrite() {
_no_overwrite = true; _no_overwrite = true;
} }
virtual void sync();
remi_fileset_t create_and_populate_fileset() const; remi_fileset_t create_and_populate_fileset() const;
protected: protected:
virtual std::vector<ds_bulk_t> vlist_keys( virtual std::vector<ds_bulk_t> vlist_keys(
......
...@@ -44,6 +44,8 @@ class MapDataStore : public AbstractDataStore { ...@@ -44,6 +44,8 @@ class MapDataStore : public AbstractDataStore {
return true; return true;
} }
virtual void sync() {}
virtual bool put(const ds_bulk_t &key, const ds_bulk_t &data) { virtual bool put(const ds_bulk_t &key, const ds_bulk_t &data) {
auto x = _map.count(key); auto x = _map.count(key);
if(_no_overwrite && (x != 0)) { if(_no_overwrite && (x != 0)) {
......
...@@ -2016,7 +2016,7 @@ static void sdskv_migrate_database_ult(hg_handle_t handle) ...@@ -2016,7 +2016,7 @@ static void sdskv_migrate_database_ult(hg_handle_t handle)
break; break;
} }
auto database = it->second; auto database = it->second;
database->sync();
/* lookup the address of the destination REMI provider */ /* lookup the address of the destination REMI provider */
hret = margo_addr_lookup(mid, in.dest_remi_addr, &dest_addr); hret = margo_addr_lookup(mid, in.dest_remi_addr, &dest_addr);
if(hret != HG_SUCCESS) { if(hret != HG_SUCCESS) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment