From f782ebd939e2d81808ad63da0a6ff36e88938da2 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Thu, 10 Mar 2011 11:36:44 -0800 Subject: [PATCH] Add runtime options to disable some of the log-structured optimizations --- bluesky/bluesky.h | 12 ++++++++++-- bluesky/cloudlog.c | 5 ++++- bluesky/init.c | 2 ++ bluesky/log.c | 3 ++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bluesky/bluesky.h b/bluesky/bluesky.h index 5ef2f28..874027f 100644 --- a/bluesky/bluesky.h +++ b/bluesky/bluesky.h @@ -20,10 +20,10 @@ extern "C" { /* Various options to tweak for performance benchmarking purposes. */ typedef struct { - /* Perform all get/put operations synchronously. */ + /* OBSOLETE: Perform all get/put operations synchronously. */ int synchronous_stores; - /* Write data in cache immediately after file is modified. */ + /* OBSOLETE: Write data in cache immediately after file is modified. */ int writethrough_cache; /* Can inodes be fetched asynchronously? (Inode object is initially @@ -37,6 +37,14 @@ typedef struct { /* Target size of the disk cache at the proxy, in kilobytes. */ int cache_size; + + /* Full segment fetches (1) or use range requests (0) for fetching segments + * from cloud? */ + int full_segment_fetches; + + /* Disable aggregating of data into log segments. Each object will be + * stored in a separate segment. */ + int disable_aggregation; } BlueSkyOptions; extern BlueSkyOptions bluesky_options; diff --git a/bluesky/cloudlog.c b/bluesky/cloudlog.c index 4b49397..3e30f02 100644 --- a/bluesky/cloudlog.c +++ b/bluesky/cloudlog.c @@ -449,8 +449,11 @@ BlueSkyCloudPointer bluesky_cloudlog_serialize(BlueSkyCloudLog *log, bluesky_cloudlog_ref(log); g_mutex_unlock(log->lock); - if (state->data->len > CLOUDLOG_SEGMENT_SIZE) + if (state->data->len > CLOUDLOG_SEGMENT_SIZE + || bluesky_options.disable_aggregation) + { bluesky_cloudlog_flush(fs); + } return log->location; } diff --git a/bluesky/init.c b/bluesky/init.c index e2b35c6..49ede3e 100644 --- a/bluesky/init.c +++ b/bluesky/init.c @@ -50,6 +50,8 @@ static struct { {"BLUESKY_OPT_SYNC_INODE_FETCH", &bluesky_options.sync_inode_fetches}, {"BLUESKY_OPT_SYNC_FRONTENDS", &bluesky_options.sync_frontends}, {"BLUESKY_CACHE_SIZE", &bluesky_options.cache_size}, + {"BLUESKY_OPT_FULL_SEGMENTS", &bluesky_options.full_segment_fetches}, + {"BLUESKY_OPT_NO_AGGREGATION", &bluesky_options.disable_aggregation}, {NULL, NULL} }; diff --git a/bluesky/log.c b/bluesky/log.c index 984cf16..6ac7508 100644 --- a/bluesky/log.c +++ b/bluesky/log.c @@ -651,7 +651,8 @@ BlueSkyRCStr *bluesky_log_map_object(BlueSkyCloudLog *item, gboolean map_data) BlueSkyRCStr *str = NULL; int location = 0; size_t file_offset = 0, file_size = 0; - gboolean range_request = TRUE; + gboolean range_request = bluesky_options.full_segment_fetches + ? FALSE : TRUE; if (page_size == 0) { page_size = getpagesize(); -- 2.20.1