* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: extract.c,v 1.116 2002-04-13 18:16:43 adam Exp $
+ * $Id: extract.c,v 1.117 2002-04-15 14:05:43 adam Exp $
*/
#include <stdio.h>
#include <assert.h>
#define PRINTF_OFF_T "%ld"
#endif
-static int records_inserted = 0;
-static int records_updated = 0;
-static int records_deleted = 0;
-static int records_processed = 0;
-
-static void logRecord (int showFlag)
+static void logRecord (ZebraHandle zh)
{
- if (!showFlag)
- ++records_processed;
- if (showFlag || !(records_processed % 1000))
+ ++zh->records_processed;
+ if (!(zh->records_processed % 1000))
{
logf (LOG_LOG, "Records: %7d i/u/d %d/%d/%d",
- records_processed, records_inserted, records_updated,
- records_deleted);
+ zh->records_processed, zh->records_inserted, zh->records_updated,
+ zh->records_deleted);
}
}
{
/* error occured during extraction ... */
if (rGroup->flagRw &&
- records_processed < rGroup->fileVerboseLimit)
+ zh->records_processed < rGroup->fileVerboseLimit)
{
logf (LOG_WARN, "fail %s %s " PRINTF_OFF_T, rGroup->recordType,
fname, recordOffset);
logf (LOG_WARN, "cannot delete record above (seems new)");
return 1;
}
- if (records_processed < rGroup->fileVerboseLimit)
+ if (zh->records_processed < rGroup->fileVerboseLimit)
logf (LOG_LOG, "add %s %s " PRINTF_OFF_T, rGroup->recordType,
fname, recordOffset);
rec = rec_new (zh->reg->records);
extract_flushRecordKeys (zh, *sysno, 1, &zh->reg->keys);
extract_flushSortKeys (zh, *sysno, 1, &zh->reg->sortKeys);
- records_inserted++;
+ zh->records_inserted++;
}
else
{
fname, recordOffset);
extract_flushSortKeys (zh, *sysno, -1, &zh->reg->sortKeys);
rec_rm (&rec);
- logRecord (0);
+ logRecord (zh);
return 1;
}
delkeys.buf_used = rec->size[recInfo_delKeys];
}
else
{
- if (records_processed < rGroup->fileVerboseLimit)
+ if (zh->records_processed < rGroup->fileVerboseLimit)
logf (LOG_LOG, "delete %s %s " PRINTF_OFF_T,
rGroup->recordType, fname, recordOffset);
- records_deleted++;
+ zh->records_deleted++;
if (matchStr)
dict_delete (zh->reg->matchDict, matchStr);
rec_del (zh->reg->records, &rec);
}
rec_rm (&rec);
- logRecord (0);
+ logRecord (zh);
return 1;
}
else
}
else
{
- if (records_processed < rGroup->fileVerboseLimit)
+ if (zh->records_processed < rGroup->fileVerboseLimit)
logf (LOG_LOG, "update %s %s " PRINTF_OFF_T,
rGroup->recordType, fname, recordOffset);
extract_flushRecordKeys (zh, *sysno, 1, &zh->reg->keys);
- records_updated++;
+ zh->records_updated++;
}
}
}
/* commit this record */
rec_put (zh->reg->records, &rec);
- logRecord (0);
+ logRecord (zh);
return 1;
}
}
if (!rGroup->recordType)
{
- if (records_processed < rGroup->fileVerboseLimit)
+ if (zh->records_processed < rGroup->fileVerboseLimit)
logf (LOG_LOG, "? %s", fname);
return 0;
}
yaz_log (LOG_WARN, "extract error");
#else
if (rGroup->flagRw &&
- records_processed < rGroup->fileVerboseLimit)
+ zh->records_processed < rGroup->fileVerboseLimit)
{
logf (LOG_WARN, "fail %s %s %ld", rGroup->recordType,
fname, (long) recordOffset);
* Copyright (C) 1995-2002, Index Data
* All rights reserved.
*
- * $Id: zebraapi.c,v 1.55 2002-04-15 13:48:11 adam Exp $
+ * $Id: zebraapi.c,v 1.56 2002-04-15 14:05:43 adam Exp $
*/
#include <assert.h>
zebra_mutex_cond_unlock (&zs->session_lock);
xfree (zh->reg_name);
xfree (zh);
- yaz_log (LOG_LOG, "zebra_close zh=%p end", zh);}
+}
struct map_baseinfo {
ZebraHandle zh;
}
yaz_log (LOG_LOG, "zebra_begin_trans");
+
+ zh->records_inserted = 0;
+ zh->records_updated = 0;
+ zh->records_deleted = 0;
+ zh->records_processed = 0;
+
#if HAVE_SYS_TIMES_H
times (&zh->tms1);
#endif
zebra_register_close (zh->service, zh->reg);
zh->reg = 0;
+
+ yaz_log (LOG_LOG, "Records: %7d i/u/d %d/%d/%d",
+ zh->records_processed, zh->records_inserted,
+ zh->records_updated, zh->records_deleted);
+
zebra_get_state (zh, &val, &seqno);
if (val != 'd')
{