From: Michael Vrable Date: Thu, 1 Apr 2010 00:30:17 +0000 (-0700) Subject: Add warnings for failed storage operations. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=ee15eeabba73b2156e9290e27b3564556f152c65;p=bluesky.git Add warnings for failed storage operations. --- diff --git a/bluesky/file.c b/bluesky/file.c index 35ed1dc..311afc3 100644 --- a/bluesky/file.c +++ b/bluesky/file.c @@ -225,6 +225,13 @@ static void block_fetch_completion(BlueSkyStoreAsync *async, gpointer data) bluesky_string_unref(block->data); block->data = async->data; bluesky_string_ref(block->data); + + if (block->data == NULL) { + g_warning("Failed to fetch data block from store!\n"); + block->data = bluesky_string_new(g_malloc0(BLUESKY_BLOCK_SIZE), + BLUESKY_BLOCK_SIZE); + } + block->type = BLUESKY_BLOCK_CACHED; } diff --git a/bluesky/store-kv.cc b/bluesky/store-kv.cc index 1318126..59ba530 100644 --- a/bluesky/store-kv.cc +++ b/bluesky/store-kv.cc @@ -39,6 +39,8 @@ static void kvstore_task(gpointer a, gpointer b) value.length()), value.length()); async->result = 0; + } else { + g_warning("Failed to fetch key %s from kvstore", async->key); } break; } @@ -46,7 +48,9 @@ static void kvstore_task(gpointer a, gpointer b) case STORE_OP_PUT: { string value(async->data->data, async->data->len); - client->Put(async->key, value); + if (!client->Put(async->key, value)) { + g_warning("Failed to store key %s to kvstore", async->key); + } break; }