]> 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>
Thu, 16 Aug 2012 20:33:29 +0000 (13:33 -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 421d5ef8a805f0daebc996911b7fbf86872dce08..61e9d0a99ccf958692325c9fb5f4f38003d071b0 100644 (file)
@@ -345,6 +345,7 @@ OPTION(osd_debug_drop_pg_create_probability, OPT_DOUBLE, 0)
 OPTION(osd_debug_drop_pg_create_duration, OPT_INT, 1)
 OPTION(osd_op_history_size, OPT_U32, 20)    // Max number of completed ops to track
 OPTION(osd_op_history_duration, OPT_U32, 600) // Oldest completed op to track
+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 ded5c6bf7a43cbd80a8fc955a3dbc3e7b8c69fdb..ed4e61f4c2b9db42063ec210db547cb57acedcf6 100644 (file)
@@ -1511,11 +1511,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);
 }