]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: refactor bluestore_sync_submit_transaction
authorSage Weil <sage@redhat.com>
Tue, 18 Oct 2016 18:52:58 +0000 (14:52 -0400)
committerSage Weil <sage@redhat.com>
Tue, 1 Nov 2016 14:30:03 +0000 (10:30 -0400)
And drop bluestore_sync_transaction, at least for now.

The key change here is to make a per-txc flag indicating
whether the txn was already submitted.  This allows us
to make a choice between sync and not-sync on a per-txn
basis.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index a1d8e379baf5e51861aebe4a20b9dc03ba3bb77b..d3ea410cb8ccd744f5a769fb83d62fcb0a26c10c 100644 (file)
@@ -1011,8 +1011,7 @@ OPTION(bluestore_rocksdb_options, OPT_STR, "compression=kNoCompression,max_write
 OPTION(bluestore_fsck_on_mount, OPT_BOOL, false)
 OPTION(bluestore_fsck_on_umount, OPT_BOOL, false)
 OPTION(bluestore_fsck_on_mkfs, OPT_BOOL, true)
-OPTION(bluestore_sync_transaction, OPT_BOOL, false)  // perform kv txn synchronously
-OPTION(bluestore_sync_submit_transaction, OPT_BOOL, false)
+OPTION(bluestore_sync_submit_transaction, OPT_BOOL, false) // submit kv txn in queueing thread (not kv_sync_thread)
 OPTION(bluestore_sync_wal_apply, OPT_BOOL, true)     // perform initial wal work synchronously (possibly in combination with aio so we only *queue* ios)
 OPTION(bluestore_wal_threads, OPT_INT, 4)
 OPTION(bluestore_wal_thread_timeout, OPT_INT, 30)
index b437135be5e8095aa72b276d110208b9f525c7aa..2ed115b9178c830355d0402ab9011c510e8f55a5 100644 (file)
@@ -6162,15 +6162,10 @@ void BlueStore::_txc_state_proc(TransContext *txc)
         sb->bc.finish_write(txc->seq);
       }
       txc->shared_blobs_written.clear();
-      if (!g_conf->bluestore_sync_transaction) {
-       if (g_conf->bluestore_sync_submit_transaction) {
-         _txc_finalize_kv(txc, txc->t);
-         int r = db->submit_transaction(txc->t);
-         assert(r == 0);
-       }
-      } else {
+      if (g_conf->bluestore_sync_submit_transaction) {
        _txc_finalize_kv(txc, txc->t);
-       int r = db->submit_transaction_sync(txc->t);
+       txc->kv_submitted = true;
+       int r = db->submit_transaction(txc->t);
        assert(r == 0);
       }
       {
@@ -6529,9 +6524,9 @@ void BlueStore::_kv_sync_thread()
       bdev->flush();
 
       uint64_t high_nid = 0, high_blobid = 0;
-      if (!g_conf->bluestore_sync_transaction &&
-         !g_conf->bluestore_sync_submit_transaction) {
-       for (auto txc : kv_committing) {
+      bool any_to_submit = false;
+      for (auto txc : kv_committing) {
+       if (!txc->kv_submitted) {
          _txc_finalize_kv(txc, txc->t);
          if (txc->last_nid > high_nid) {
            high_nid = txc->last_nid;
@@ -6540,8 +6535,11 @@ void BlueStore::_kv_sync_thread()
            high_blobid = txc->last_blobid;
          }
           txc->log_state_latency(logger, l_bluestore_state_kv_queued_lat);
+         any_to_submit = true;
        }
-       if (!kv_committing.empty()) {
+      }
+      if (any_to_submit) {
+       if (high_nid || high_blobid) {
          TransContext *first_txc = kv_committing.front();
          std::lock_guard<std::mutex> l(id_lock);
          if (high_nid + g_conf->bluestore_nid_prealloc/2 > nid_max) {
@@ -6560,8 +6558,11 @@ void BlueStore::_kv_sync_thread()
          }
        }
        for (auto txc : kv_committing) {
-         int r = db->submit_transaction(txc->t);
-         assert(r == 0);
+         if (!txc->kv_submitted) {
+           txc->kv_submitted = true;
+           int r = db->submit_transaction(txc->t);
+           assert(r == 0);
+         }
        }
       }
 
index 4afffd760d2cadba55076ff030a8de478e25b0ff..a10f35495cd175b04be368b5354752e28cafe5fa 100644 (file)
@@ -1160,6 +1160,8 @@ public:
     bluestore_wal_transaction_t *wal_txn; ///< wal transaction (if any)
     vector<OnodeRef> wal_op_onodes;
 
+    bool kv_submitted = false; ///< true when we've been submitted to kv db
+
     interval_set<uint64_t> allocated, released;
     struct volatile_statfs{
       enum {