From ee15eeabba73b2156e9290e27b3564556f152c65 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Wed, 31 Mar 2010 17:30:17 -0700 Subject: [PATCH] Add warnings for failed storage operations. --- bluesky/file.c | 7 +++++++ bluesky/store-kv.cc | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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; } -- 2.20.1