Changeset: 9ccafc0fe00b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9ccafc0fe00b
Modified Files:
gdk/gdk_logger.c
sql/storage/store.c
Branch: transaction-replication
Log Message:
Improve log statements
- Use LLFMT marco when printing lng numbers
- Use more consistent log messegaes
- Read last stored transaction id as lng
diffs (111 lines):
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -955,8 +955,7 @@ logger_readlogs(logger *lg, FILE *fp, ch
char id[BUFSIZ];
if (lg->debug & 1) {
- fprintf(stderr, "#logger_readlogs %s\n", filename);
- fprintf(stderr, "#logger_readlogs logger id=%lld\n", lg->id);
+ fprintf(stderr, "#logger_readlogs logger id is " LLFMT "\n",
lg->id);
}
while (fgets(id, BUFSIZ, fp) != NULL) {
@@ -964,7 +963,7 @@ logger_readlogs(logger *lg, FILE *fp, ch
lng lid = strtoll(id, NULL, 10);
if (lg->debug & 1) {
- fprintf(stderr, "#logger_readlogs lid=%lld\n", lid);
+ fprintf(stderr, "#logger_readlogs last logger id
written in %s is " LLFMT "\n", filename, lid);
}
while(lid > lg->id) {
@@ -1309,7 +1308,7 @@ logger_set_logdir_path(char *filename, c
}
/* Load data from the logger logdir
- * Initialize new directories and catalog files if none are present, unless
running in read-only mode
+ * Initialize new directories and catalog files if none are present, unless
running in read-only mode
* Load data and persist it in the BATs
* Convert 32bit data to 64bit, unless running in read-only mode */
static int
@@ -1402,7 +1401,7 @@ logger_load(int debug, char* fn, char fi
BUN p = BUNfndT(lg->seqs_id, &id);
lg->id = *(lng *) Tloc(lg->seqs_val, p);
if (lg->debug & 1) {
- fprintf(stderr, "#logger_load setting new
logger id=%lld\n", lg->id);
+ fprintf(stderr, "#logger_load setting new
logger id to " LLFMT "\n", lg->id);
}
} else {
BUNappend(lg->seqs_id, &id, FALSE);
@@ -1610,7 +1609,7 @@ logger_new(int debug, char *fn, char *lo
lg->id = res;
if (lg->debug & 1) {
- fprintf(stderr, "#logger_new last shared
transactions is read form %s is %lld\n", shared_log_filename, lg->id);
+ fprintf(stderr, "#logger_new last shared
transactions is read form %s is " LLFMT "\n", shared_log_filename, lg->id);
}
} else {
if (lg->debug & 1) {
@@ -1843,31 +1842,29 @@ logger_read_last_transaction_id(logger *
{
char filename[BUFSIZ];
FILE *fp;
- int id;
+ char id[BUFSIZ];
+ lng lid = LOG_ERR;
snprintf(filename, BUFSIZ, "%s%s", dir, logger_file);
if ((fp = fopen(filename, "r")) == NULL) {
fprintf(stderr, "!ERROR: logger_read_last_transaction_id:
unable to open file %s\n", filename);
goto error;
}
- if (lg->debug & 1) {
- fprintf(stderr, "#logger_read_last_transaction_id reading file
%s\n", filename);
- }
+
if (check_version(lg, fp)) {
fprintf(stderr, "!ERROR: logger_read_last_transaction_id:
inconsistent log version for file %s\n", filename);
goto error;
}
/* read the last id */
- if(fscanf(fp, "%d", &id) != 1) {
- fprintf(stderr, "!ERROR: logger_read_last_transaction_id:
unable to read last transaction from file %s\n", filename);
- goto error;
- }
- if (lg->debug & 1) {
- fprintf(stderr, "#logger_read_last_transaction_id %d\n", id);
+ while (fgets(id, BUFSIZ, fp) != NULL) {
+ lid = strtoll(id, NULL, 10);
+ if (lg->debug & 1) {
+ fprintf(stderr, "#logger_read_last_transaction_id last
logger id written in %s is " LLFMT "\n", filename, lid);
+ }
}
- return id;
+ return lid;
error:
if (fp)
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -1343,7 +1343,7 @@ store_init(int debug, store_type store,
if (create_shared_logger) {
/* create a read-only logger for the shared directory */
#ifdef STORE_DEBUG
- fprintf(stderr, "#store_init creating read-only logger\n");
+ fprintf(stderr, "#store_init creating shared logger\n");
#endif
if (!shared_logger_funcs.create_shared ||
shared_logger_funcs.create_shared(debug, log_settings->shared_logdir,
CATALOG_VERSION*v, log_settings->logdir) == LOG_ERR) {
MT_lock_unset(&bs_lock, "store_init");
@@ -1616,7 +1616,7 @@ store_manager(void)
/* get the shared transactions drift */
shared_transactions_drift =
shared_logger_funcs.get_transaction_drift();
#ifdef STORE_DEBUG
- fprintf(stderr, "#store_manager shared_transactions_drift=%d\n",
shared_transactions_drift);
+ fprintf(stderr, "#store_manager shared_transactions_drift is " LLFMT
"\n", shared_transactions_drift);
#endif
if (shared_transactions_drift == LOG_ERR) {
GDKfatal("shared write-ahead log last
transaction read failure");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list