From 1a6cd9659abcdad0169fe802ed47967467c448b3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 25 Jul 2012 16:35:09 -0700 Subject: [PATCH] osd: break potentially large transaction into pieces 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 --- src/common/config_opts.h | 1 + src/osd/OSD.cc | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index bd6c39aedc62f..5b879516b674b 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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 diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d93a98afd66dd..ac771244cf5f6 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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::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); } -- 2.39.5