Fix comp for FLUSH2==0
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 22 Mar 2011 13:44:35 +0000 (13:44 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 22 Mar 2011 13:44:35 +0000 (13:44 +0000)
index/extract.c

index e0047fc..f70d824 100644 (file)
@@ -1462,49 +1462,7 @@ void extract_rec_keys_adjust(ZebraHandle zh, int is_insert,
     }
 }
 
-static void extract_flush_record_keys(
-    ZebraHandle zh, zint sysno, int cmd,
-    zebra_rec_keys_t reckeys,
-    zint staticrank)
-{
-    ZebraExplainInfo zei = zh->reg->zei;
-
-    extract_rec_keys_adjust(zh, cmd, reckeys);
-
-    if (log_level_details)
-    {
-        yaz_log(log_level_details, "Keys for record " ZINT_FORMAT " %s",
-                sysno, cmd ? "insert" : "delete");
-        extract_rec_keys_log(zh, cmd, reckeys, log_level_details);
-    }
-
-    if (!zh->reg->key_block)
-    {
-        int mem = 1024*1024 * atoi( res_get_def( zh->res, "memmax", "8"));
-        const char *key_tmp_dir = res_get_def(zh->res, "keyTmpDir", ".");
-        int use_threads = atoi(res_get_def(zh->res, "threads", "1"));
-        zh->reg->key_block = key_block_create(mem, key_tmp_dir, use_threads);
-    }
-    zebraExplain_recordCountIncrement(zei, cmd ? 1 : -1);
-
-#if 0
-    yaz_log(YLOG_LOG, "sysno=" ZINT_FORMAT " cmd=%d", sysno, cmd);
-    print_rec_keys(zh, reckeys);
-#endif
-    if (zebra_rec_keys_rewind(reckeys))
-    {
-        size_t slen;
-        const char *str;
-        struct it_key key_in;
-        while(zebra_rec_keys_read(reckeys, &str, &slen, &key_in))
-        {
-            key_block_write(zh->reg->key_block, sysno, 
-                            &key_in, cmd, str, slen,
-                            staticrank, zh->m_staticrank);
-        }
-    }
-}
-
+#if FLUSH2
 static void extract_flush_record_keys2(
     ZebraHandle zh, zint sysno,
     zebra_rec_keys_t ins_keys, zint ins_rank,
@@ -1578,7 +1536,50 @@ static void extract_flush_record_keys2(
     }
     yaz_log(log_level_extract, "normal=%d optimized=%d", normal, optimized);
 }
+#else
+static void extract_flush_record_keys(
+    ZebraHandle zh, zint sysno, int cmd,
+    zebra_rec_keys_t reckeys,
+    zint staticrank)
+{
+    ZebraExplainInfo zei = zh->reg->zei;
+
+    extract_rec_keys_adjust(zh, cmd, reckeys);
+
+    if (log_level_details)
+    {
+        yaz_log(log_level_details, "Keys for record " ZINT_FORMAT " %s",
+                sysno, cmd ? "insert" : "delete");
+        extract_rec_keys_log(zh, cmd, reckeys, log_level_details);
+    }
 
+    if (!zh->reg->key_block)
+    {
+        int mem = 1024*1024 * atoi( res_get_def( zh->res, "memmax", "8"));
+        const char *key_tmp_dir = res_get_def(zh->res, "keyTmpDir", ".");
+        int use_threads = atoi(res_get_def(zh->res, "threads", "1"));
+        zh->reg->key_block = key_block_create(mem, key_tmp_dir, use_threads);
+    }
+    zebraExplain_recordCountIncrement(zei, cmd ? 1 : -1);
+
+#if 0
+    yaz_log(YLOG_LOG, "sysno=" ZINT_FORMAT " cmd=%d", sysno, cmd);
+    print_rec_keys(zh, reckeys);
+#endif
+    if (zebra_rec_keys_rewind(reckeys))
+    {
+        size_t slen;
+        const char *str;
+        struct it_key key_in;
+        while(zebra_rec_keys_read(reckeys, &str, &slen, &key_in))
+        {
+            key_block_write(zh->reg->key_block, sysno, 
+                            &key_in, cmd, str, slen,
+                            staticrank, zh->m_staticrank);
+        }
+    }
+}
+#endif
 
 ZEBRA_RES zebra_rec_keys_to_snippets1(ZebraHandle zh,
                                      zebra_rec_keys_t reckeys,