Skip to content

Commit

Permalink
1) fix some bugs introduced when we ported the code from v5.12.4 to v…
Browse files Browse the repository at this point in the history
…6.2.2. 2) update test script. 3) split dcpmm pool into 16 files to speed up pmemobj_free()
  • Loading branch information
peifengsi committed Sep 6, 2019
1 parent 2f1d051 commit 14a5b3e
Show file tree
Hide file tree
Showing 12 changed files with 261 additions and 233 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -74,3 +74,5 @@ tp2/
fbcode/
fbcode
buckifier/*.pyc

.vscode/*
5 changes: 1 addition & 4 deletions db/db_impl.cc
Expand Up @@ -567,10 +567,7 @@ Status DBImpl::CloseHelper() {
}

#ifdef KVS_ON_DCPMM
if (env_->pm_pool) {
pmemobj_close(env_->pm_pool);
env_->pm_pool = nullptr;
}
KVSClose();
#endif

ROCKS_LOG_INFO(immutable_db_options_.info_log, "Shutdown complete");
Expand Down
13 changes: 6 additions & 7 deletions db/db_impl_open.cc
Expand Up @@ -1203,21 +1203,20 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
}

#ifdef KVS_ON_DCPMM
if (impl->immutable_db_options_.dcpmm_kvs_mmapped_file_fullpath != "" &&
impl->env_->pm_pool == NULL) {
impl->env_->pm_pool = KVSOpen(
if (impl->immutable_db_options_.dcpmm_kvs_mmapped_file_fullpath != "") {
int err = KVSOpen(
impl->immutable_db_options_.dcpmm_kvs_mmapped_file_fullpath.data(),
impl->immutable_db_options_.dcpmm_kvs_mmapped_file_size);
if (impl->env_->pm_pool == NULL) {
exit(1);
if (err != 0) {
return Status::IOError(std::string("failed to open '")
.append(impl->immutable_db_options_.dcpmm_kvs_mmapped_file_fullpath)
.append("'"));
}
impl->env_->pool_uuid_lo = KVSGetUUID();
KVSSetKVSValueThres(impl->immutable_db_options_.dcpmm_kvs_value_thres);
KVSSetCompressKnob(impl->immutable_db_options_.dcpmm_compress_value);
}
#endif


s = impl->CreateArchivalDirectory();
if (!s.ok()) {
delete impl;
Expand Down
13 changes: 7 additions & 6 deletions db/write_batch.cc
Expand Up @@ -652,14 +652,15 @@ Status WriteBatchInternal::Put(WriteBatch* b, uint32_t column_family_id,
#ifdef KVS_ON_DCPMM
static size_t thres = KVSGetKVSValueThres();
static bool compress = KVSGetCompressKnob();
struct KVSHdr hdr;
struct KVSRef ref;
struct pobj_action* pact;
if (KVSEnabled() && (value.size() >= thres) &&
KVSEncodeValue(value, compress, &hdr)) {
b->act_.push_back(hdr.pact);
PutLengthPrefixedSlice(&b->rep_, Slice((char*)(&hdr), sizeof(hdr)));
KVSEncodeValue(value, compress, &ref, &pact)) {
b->act_.push_back(pact);
PutLengthPrefixedSlice(&b->rep_, Slice((char*)(&ref), sizeof(ref)));
} else {
hdr.base.encoding = kEncodingRawUncompressed;
PutLengthHdrPrefixedSlice(&b->rep_, &(hdr.base), value);
ref.hdr.encoding = kEncodingRawUncompressed;
PutLengthHdrPrefixedSlice(&b->rep_, &(ref.hdr), value);
}
#else
PutLengthPrefixedSlice(&b->rep_, value);
Expand Down
10 changes: 3 additions & 7 deletions db/write_batch_internal.h
Expand Up @@ -81,13 +81,9 @@ class WriteBatchInternal {

// Publish all the actions of a grouped batch
static void DCPMMPublishActions(const WriteBatch* batch) {
std::vector<pobj_action *> a = batch->act_;
std::vector<pobj_action *>::iterator it;
for (it = a.begin(); it != a.end(); ++it) {
KVSPublish((struct pobj_action *)*it, 1);
free((void *)*it);
}
batch->act_.clear();
auto& pacts = batch->act_;
KVSPublish(pacts.data(), pacts.size());
pacts.clear();
}
#endif

Expand Down

0 comments on commit 14a5b3e

Please sign in to comment.