[prev in list] [next in list] [prev in thread] [next in thread]
List: monetdb-checkins
Subject: MonetDB: default - no logging with 128
From: Niels Nes <commits+niels=cwi.nl () monetdb ! org>
Date: 2019-09-30 19:22:07
Message-ID: hg.3cc5c652975e.1569871327.6315528441665844383 () monetdb-vm0 ! spin-off ! cwi ! nl
[Download RAW message or body]
Changeset: 3cc5c652975e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3cc5c652975e
Modified Files:
gdk/gdk_logger.c
Branch: default
Log Message:
no logging with 128
diffs (213 lines):
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -97,6 +97,8 @@
#define NAME(name,tpe,id) (name?name:"tpe id")
+#define LOG_DISABLED(lg) ((lg)->debug&128)
+
static const char *log_commands[] = {
NULL,
"LOG_START",
@@ -1047,8 +1049,10 @@ logger_open(logger *lg)
char id[BUFSIZ];
char *filename;
- if (lg->inmemory) {
+ if (lg->inmemory || LOG_DISABLED(lg)) {
lg->end = 0;
+ if (lg->id) /* go back too last used id */
+ lg->id--;
return GDK_SUCCEED;
}
len = snprintf(id, sizeof(id), LLFMT, lg->id);
@@ -1666,7 +1670,7 @@ logger_load(int debug, const char *fn, c
bool needcommit = false;
int dbg = GDKdebug;
- if (!lg->inmemory) {
+ if (!lg->inmemory && !LOG_DISABLED(lg)) {
if ((filenamestr = GDKfilepath(farmid, lg->dir, LOGFILE, NULL)) == NULL)
goto error;
len = snprintf(filename, FILENAME_MAX, "%s", filenamestr);
@@ -1696,7 +1700,7 @@ logger_load(int debug, const char *fn, c
lg->seqs_val = NULL;
lg->dseqs = NULL;
- if (!lg->inmemory) {
+ if (!lg->inmemory && !LOG_DISABLED(lg)) {
/* try to open logfile backup, or failing that, the file
* itself. we need to know whether this file exists when
* checking the database consistency later on */
@@ -1776,7 +1780,7 @@ logger_load(int debug, const char *fn, c
goto error;
}
- if (!lg->inmemory) {
+ if (!lg->inmemory && !LOG_DISABLED(lg)) {
if (GDKcreatedir(filename) != GDK_SUCCEED) {
GDKerror("logger_load: cannot create directory for log file %s\n",
filename);
@@ -1924,7 +1928,7 @@ logger_load(int debug, const char *fn, c
}
/* the catalog exists, and so should the log file */
- if (fp == NULL) {
+ if (fp == NULL && !LOG_DISABLED(lg)) {
GDKerror("logger_load: there is a logger catalog, but no log file.\n"
"Are you sure you are using the correct combination of database\n"
"(--dbpath) and log directory (--set %s_logdir)?\n"
@@ -2558,7 +2562,7 @@ logger_exit(logger *lg)
char filename[FILENAME_MAX];
int len, farmid;
- if (lg->inmemory) {
+ if (lg->inmemory || LOG_DISABLED(lg)) {
logger_close(lg);
return GDK_SUCCEED;
}
@@ -2664,7 +2668,7 @@ logger_cleanup(logger *lg)
char buf[BUFSIZ];
FILE *fp = NULL;
- if (lg->inmemory)
+ if (lg->inmemory || LOG_DISABLED(lg))
return GDK_SUCCEED;
farmid = BBPselectfarm(PERSISTENT, 0, offheap);
@@ -2778,7 +2782,7 @@ log_bat_persists(logger *lg, BAT *b, con
l.flag = (l.flag == LOG_USE)?LOG_USE_ID:LOG_CREATE_ID;
l.tid = lg->tid;
lg->changes++;
- if (!lg->inmemory) {
+ if (!lg->inmemory && !LOG_DISABLED(lg)) {
if (log_write_format(lg, &l) != GDK_SUCCEED ||
log_write_string(lg, name) != GDK_SUCCEED ||
(tpe && log_write_id(lg, tpe, id) != GDK_SUCCEED))
@@ -2811,7 +2815,7 @@ log_bat_persists(logger *lg, BAT *b, con
}
return GDK_SUCCEED;
}
- if (lg->inmemory)
+ if (lg->inmemory || LOG_DISABLED(lg))
return GDK_SUCCEED;
ha = "vid";
@@ -2870,7 +2874,7 @@ log_bat_transient(logger *lg, const char
// assert(lg->tid == tid);
}
- if (lg->inmemory)
+ if (lg->inmemory || LOG_DISABLED(lg))
return GDK_SUCCEED;
if (log_write_format(lg, &l) != GDK_SUCCEED ||
@@ -2892,15 +2896,16 @@ log_delta(logger *lg, BAT *uid, BAT *uva
BUN p;
assert(uid->ttype == TYPE_oid || uid->ttype == TYPE_void);
- if (lg->debug & 128 || lg->inmemory) {
- /* logging is switched off */
- return GDK_SUCCEED;
- }
l.tid = lg->tid;
l.nr = (BUNlast(uval));
lg->changes += l.nr;
+ if (LOG_DISABLED(lg) || lg->inmemory) {
+ /* logging is switched off */
+ return GDK_SUCCEED;
+ }
+
if (l.nr) {
BATiter vi = bat_iterator(uval);
gdk_return (*wh) (const void *, stream *, size_t) = BATatoms[TYPE_oid].atomWrite;
@@ -2935,15 +2940,15 @@ log_bat(logger *lg, BAT *b, const char *
logformat l;
BUN p;
- if (lg->debug & 128 || lg->inmemory) {
+ l.tid = lg->tid;
+ l.nr = (BUNlast(b) - b->batInserted);
+ lg->changes += l.nr;
+
+ if (LOG_DISABLED(lg) || lg->inmemory) {
/* logging is switched off */
return GDK_SUCCEED;
}
- l.tid = lg->tid;
- l.nr = (BUNlast(b) - b->batInserted);
- lg->changes += l.nr;
-
if (l.nr) {
BATiter bi = bat_iterator(b);
gdk_return (*wt) (const void *, stream *, size_t) = BATatoms[b->ttype].atomWrite;
@@ -2981,15 +2986,15 @@ log_bat_clear(logger *lg, const char *na
{
logformat l;
- if (lg->debug & 128 || lg->inmemory) {
+ l.nr = 1;
+ l.tid = lg->tid;
+ lg->changes += l.nr;
+
+ if (LOG_DISABLED(lg) || lg->inmemory) {
/* logging is switched off */
return GDK_SUCCEED;
}
- l.nr = 1;
- l.tid = lg->tid;
- lg->changes += l.nr;
-
l.flag = (tpe)?LOG_CLEAR_ID:LOG_CLEAR;
if (log_write_format(lg, &l) != GDK_SUCCEED ||
(tpe ? log_write_id(lg, tpe, id) : log_write_string(lg, name)) != GDK_SUCCEED)
@@ -3006,7 +3011,7 @@ log_tstart(logger *lg)
{
logformat l;
- if (lg->inmemory)
+ if (LOG_DISABLED(lg) || lg->inmemory)
return GDK_SUCCEED;
l.flag = LOG_START;
@@ -3028,7 +3033,7 @@ static gdk_return
pre_allocate(logger *lg)
{
// FIXME: this causes serious issues on Windows at least with MinGW
- assert(!lg->inmemory);
+ assert(!lg->inmemory && !LOG_DISABLED(lg));
#ifndef WIN32
lng p;
p = (lng) getfilepos(getFile(lg->log));
@@ -3086,7 +3091,7 @@ log_tend(logger *lg)
lg->snapshots_tid, NULL, NULL, lg->dsnapshots, NULL, lg->debug);
BBPunfix(bids->batCacheid);
}
- if (lg->inmemory)
+ if (LOG_DISABLED(lg) || lg->inmemory)
return GDK_SUCCEED;
l.flag = LOG_END;
l.tid = lg->tid;
@@ -3108,7 +3113,7 @@ log_abort(logger *lg)
{
logformat l;
- if (lg->inmemory)
+ if (LOG_DISABLED(lg) || lg->inmemory)
return GDK_SUCCEED;
if (lg->debug & 1)
fprintf(stderr, "#log_abort %d\n", lg->tid);
@@ -3128,7 +3133,7 @@ log_sequence_(logger *lg, int seq, lng v
{
logformat l;
- if (lg->inmemory)
+ if (LOG_DISABLED(lg) || lg->inmemory)
return GDK_SUCCEED;
l.flag = LOG_SEQ;
l.tid = lg->tid;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic