]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: break potentially large transaction into pieces
authorSage Weil <sage@inktank.com>
Wed, 25 Jul 2012 23:35:09 +0000 (16:35 -0700)
committerSage Weil <sage@inktank.com>
Wed, 25 Jul 2012 23:35:09 +0000 (16:35 -0700)
We do a similar trick elsewhere.  Control this via a tunable.  Eventually
we'll control the others (in a non-stable branch).

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/osd/OSD.cc

index bd6c39aedc62f7fce538db104e3d166008152874..5b879516b674b2bfd22908d4cbd6e48b04a9d410 100644 (file)
@@ -336,6 +336,7 @@ OPTION(osd_op_complaint_time, OPT_FLOAT, 30) // how many seconds old makes an op
 OPTION(osd_command_max_records, OPT_INT, 256)
 OPTION(osd_op_log_threshold, OPT_INT, 5) // how many op log messages to show in one go
 OPTION(osd_verify_sparse_read_holes, OPT_BOOL, false)  // read fiemap-reported holes and verify they are zeros
+OPTION(osd_target_transaction_size, OPT_INT, 300)     // to adjust various transactions that batch smaller items
 OPTION(filestore, OPT_BOOL, false)
 OPTION(filestore_debug_omap_check, OPT_BOOL, 0) // Expensive debugging check on sync
 // Use omap for xattrs for attrs over
index d93a98afd66ddce3d75393632476f43de8b5e468..ac771244cf5f62ef0feaa74f15180953017b55ff 100644 (file)
@@ -1440,11 +1440,20 @@ void OSD::build_past_intervals_parallel()
   // the previous past_intervals and rebuilding from scratch, or we
   // can just do this and commit all our work at the end.
   ObjectStore::Transaction t;
+  int num = 0;
   for (map<PG*,pistate>::iterator i = pis.begin(); i != pis.end(); ++i) {
     PG *pg = i->first;
     pg->write_info(t);
+
+    // don't let the transaction get too big
+    if (++num >= g_conf->osd_target_transaction_size) {
+      store->apply_transaction(t);
+      t = ObjectStore::Transaction();
+      num = 0;
+    }
   }
-  store->apply_transaction(t);
+  if (!t.empty())
+    store->apply_transaction(t);
 }