Rework the checkpoint record format to include a version vector.
[bluesky.git] / bluesky / log.c
index 4cef5fd..89d4258 100644 (file)
@@ -402,7 +402,8 @@ BlueSkyCacheFile *bluesky_cachefile_lookup(BlueSkyFS *fs,
         /* A stale reference to a journal file which doesn't exist any longer
          * because it was reclaimed.  Return NULL. */
     } else if (map == NULL) {
-        g_print("Adding cache file %s\n", logname);
+        if (bluesky_verbose)
+            g_print("Adding cache file %s\n", logname);
 
         map = g_new0(BlueSkyCacheFile, 1);
         map->fs = fs;
@@ -468,6 +469,7 @@ static void cloudlog_partial_fetch_start(BlueSkyCacheFile *cachefile,
     async->key = g_strdup(cachefile->filename);
     async->start = offset;
     async->len = length;
+    async->profile = bluesky_profile_get();
     bluesky_store_async_add_notifier(async,
                                      (GFunc)cloudlog_partial_fetch_complete,
                                      cachefile);
@@ -500,8 +502,10 @@ static void cloudlog_partial_fetch_complete(BlueSkyStoreAsync *async,
                 item = bluesky_rangeset_lookup_next(items, item_offset);
                 if (item == NULL)
                     break;
-                g_print("  item offset from range request: %d\n",
-                        (int)(item->start + async->start));
+                if (bluesky_verbose) {
+                    g_print("  item offset from range request: %d\n",
+                            (int)(item->start + async->start));
+                }
                 if (bluesky_rangeset_insert(cachefile->items,
                                             async->start + item->start,
                                             item->length, item->data))
@@ -547,6 +551,7 @@ static void cloudlog_fetch_start(BlueSkyCacheFile *cachefile)
     BlueSkyStoreAsync *async = bluesky_store_async_new(cachefile->fs->store);
     async->op = STORE_OP_GET;
     async->key = g_strdup(cachefile->filename);
+    async->profile = bluesky_profile_get();
     bluesky_store_async_add_notifier(async,
                                      (GFunc)cloudlog_partial_fetch_complete,
                                      cachefile);
@@ -614,8 +619,10 @@ BlueSkyRCStr *bluesky_log_map_object(BlueSkyCloudLog *item, gboolean map_data)
                 goto exit2;
             }
             if (rangeitem == NULL) {
-                g_print("Item at offset 0x%zx not available, need to fetch.\n",
-                        file_offset);
+                if (bluesky_verbose) {
+                    g_print("Item at offset 0x%zx not available, need to fetch.\n",
+                            file_offset);
+                }
                 if (range_request) {
                     uint64_t start = 0, length = 0, end;
                     if (map->prefetches != NULL)
@@ -633,7 +640,8 @@ BlueSkyRCStr *bluesky_log_map_object(BlueSkyCloudLog *item, gboolean map_data)
                 g_cond_wait(map->cond, map->lock);
             } else if (rangeitem->start == file_offset
                        && rangeitem->length == file_size) {
-                g_print("Item now available.\n");
+                if (bluesky_verbose)
+                    g_print("Item now available.\n");
                 break;
             }
         }
@@ -684,7 +692,8 @@ void bluesky_mmap_unref(BlueSkyCacheFile *mmap)
     if (g_atomic_int_dec_and_test(&mmap->mapcount)) {
         g_mutex_lock(mmap->lock);
         if (g_atomic_int_get(&mmap->mapcount) == 0) {
-            g_print("Unmapped log segment %d...\n", mmap->log_seq);
+            if (bluesky_verbose)
+                g_print("Unmapped log segment %d...\n", mmap->log_seq);
             munmap((void *)mmap->addr, mmap->len);
             mmap->addr = NULL;
             g_atomic_int_add(&mmap->refcount, -1);