Add warnings for failed storage operations.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Thu, 1 Apr 2010 00:30:17 +0000 (17:30 -0700)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Thu, 1 Apr 2010 00:30:17 +0000 (17:30 -0700)
bluesky/file.c
bluesky/store-kv.cc

index 35ed1dc..311afc3 100644 (file)
@@ -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;
 }
 
index 1318126..59ba530 100644 (file)
@@ -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;
     }