You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by zh...@apache.org on 2021/01/08 02:06:53 UTC
[incubator-pegasus] branch master updated: refactor: move func
ingestion_files to rocksdb_wrapper (#671)
This is an automated email from the ASF dual-hosted git repository.
zhaoliwei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new b041780 refactor: move func ingestion_files to rocksdb_wrapper (#671)
b041780 is described below
commit b0417806bd81400d8a28e73e260eb6e6c371c4b8
Author: zhao liwei <zl...@163.com>
AuthorDate: Fri Jan 8 10:06:43 2021 +0800
refactor: move func ingestion_files to rocksdb_wrapper (#671)
---
src/server/pegasus_write_service_impl.h | 9 ++-------
src/server/rocksdb_wrapper.cpp | 12 ++++++++++++
src/server/rocksdb_wrapper.h | 1 +
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/server/pegasus_write_service_impl.h b/src/server/pegasus_write_service_impl.h
index 39218b5..1c712dc 100644
--- a/src/server/pegasus_write_service_impl.h
+++ b/src/server/pegasus_write_service_impl.h
@@ -503,15 +503,10 @@ public:
}
// ingest external files
- rocksdb::IngestExternalFileOptions ifo;
- rocksdb::Status s = _db->IngestExternalFile(sst_file_list, ifo);
- if (!s.ok()) {
- derror_rocksdb("IngestExternalFile", s.ToString(), "decree = {}", decree);
+ if (dsn_unlikely(_rocksdb_wrapper->ingestion_files(decree, sst_file_list) != 0)) {
return dsn::ERR_INGESTION_FAILED;
- } else {
- ddebug_rocksdb("IngestExternalFile", "Ingest files succeed, decree = {}", decree);
- return dsn::ERR_OK;
}
+ return dsn::ERR_OK;
}
/// For batch write.
diff --git a/src/server/rocksdb_wrapper.cpp b/src/server/rocksdb_wrapper.cpp
index 662bb03..5620c85 100644
--- a/src/server/rocksdb_wrapper.cpp
+++ b/src/server/rocksdb_wrapper.cpp
@@ -181,6 +181,18 @@ int rocksdb_wrapper::write_batch_delete(int64_t decree, dsn::string_view raw_key
void rocksdb_wrapper::clear_up_write_batch() { _write_batch->Clear(); }
+int rocksdb_wrapper::ingestion_files(int64_t decree, const std::vector<std::string> &sst_file_list)
+{
+ rocksdb::IngestExternalFileOptions ifo;
+ rocksdb::Status s = _db->IngestExternalFile(sst_file_list, ifo);
+ if (dsn_unlikely(!s.ok())) {
+ derror_rocksdb("IngestExternalFile", s.ToString(), "decree = {}", decree);
+ } else {
+ ddebug_rocksdb("IngestExternalFile", "Ingest files succeed, decree = {}", decree);
+ }
+ return s.code();
+}
+
void rocksdb_wrapper::set_default_ttl(uint32_t ttl)
{
if (_default_ttl != ttl) {
diff --git a/src/server/rocksdb_wrapper.h b/src/server/rocksdb_wrapper.h
index 06e3878..b945382 100644
--- a/src/server/rocksdb_wrapper.h
+++ b/src/server/rocksdb_wrapper.h
@@ -64,6 +64,7 @@ public:
int write(int64_t decree);
int write_batch_delete(int64_t decree, dsn::string_view raw_key);
void clear_up_write_batch();
+ int ingestion_files(int64_t decree, const std::vector<std::string> &sst_file_list);
void set_default_ttl(uint32_t ttl);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org