Changeset: c59804363da3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c59804363da3
Modified Files:
sql/storage/store.c
Branch: userprofile
Log Message:
merge default
diffs (truncated from 1102 to 300 lines):
diff --git a/clients/Tests/All b/clients/Tests/All
--- a/clients/Tests/All
+++ b/clients/Tests/All
@@ -1,6 +1,6 @@
exports
HAVE_HGE&HAVE_FITS&HAVE_GEOM&HAVE_LIBR&HAVE_LIBPY3&HAVE_NETCDF&HAVE_SHP&NOT_WIN32?MAL-signatures-hge
!HAVE_HGE&HAVE_FITS&HAVE_GEOM&HAVE_LIBR&HAVE_LIBPY3&HAVE_NETCDF&HAVE_SHP&NOT_WIN32?MAL-signatures
-NOT_WIN32&MERCURIAL?melcheck
+NOT_WIN32&melcheck
mclient-uri
testcondvar
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -541,8 +541,10 @@ ssize_t lngToStr(str *dst, size_t *len,
const lng lng_nil;
struct tm *localtime_r(const time_t *restrict, struct tm *restrict);
gdk_return log_activate(logger *lg);
-gdk_return log_bat(logger *lg, BAT *b, log_id id, lng offset, lng cnt);
+gdk_return log_bat(logger *lg, BAT *b, log_id id, lng offset, lng cnt, lng
total_cnt);
gdk_return log_bat_clear(logger *lg, log_id id);
+gdk_return log_bat_group_end(logger *lg, log_id id);
+gdk_return log_bat_group_start(logger *lg, log_id id);
gdk_return log_bat_persists(logger *lg, BAT *b, log_id id);
gdk_return log_bat_transient(logger *lg, log_id id);
lng log_changes(logger *lg);
diff --git a/clients/Tests/melcheck.sh b/clients/Tests/melcheck.sh
--- a/clients/Tests/melcheck.sh
+++ b/clients/Tests/melcheck.sh
@@ -1,3 +1,12 @@
#!/bin/sh
cd $TSTSRCBASE
-hg -q files -I '{monetdb5,sql,geom}/**.[ch]' -X '**/Tests/**' | python3 -c
'import MonetDBtesting.melcheck'
+
+hg_root="$(hg root 2>/dev/null)"
+git_root="$(git rev-parse --show-toplevel 2>/dev/null)"
+
+if [ "$hg_root" = "$TSTSRCBASE" ]; then
+ hg -q files -I '{monetdb5,sql,geom}/**.[ch]' -X '**/Tests/**'
+elif [ "$git_root" = "$TSTSRCBASE" ]; then
+ git ls-files -- 'monetdb5/**.[ch]' 'sql/**.[ch]' 'geom/**.[ch]'
':!:**/Tests/*'
+fi \
+| python3 -c 'import MonetDBtesting.melcheck'
diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -316,7 +316,7 @@ macro(monetdb_configure_misc)
if(NOT DEFINED PYTHON3_LIBDIR)
# Used for installing testing python module (don't pass a location, else
we need to strip this again)
- execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import sysconfig;
print(sysconfig.get_path('purelib', vars={'base': ''})[1:])"
+ execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import sysconfig;
print((sysconfig.get_path('purelib', vars={'base':''}, scheme='rpm_prefix') if
'rpm_prefix' in sysconfig.get_scheme_names() else sysconfig.get_path('purelib',
vars={'base':''}))[1:])"
RESULT_VARIABLE PY3_LIBDIR_CODE
OUTPUT_VARIABLE PYTHON3_SITEDIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2306,17 +2306,18 @@ gdk_export BAT *BATsample_with_seed(BAT
#define CHECK_QRY_TIMEOUT_MASK (CHECK_QRY_TIMEOUT_STEP - 1)
#define TIMEOUT_MSG "Timeout was reached!"
+#define EXITING_MSG "Server is exiting!"
-#define TIMEOUT_HANDLER(rtpe) \
- do { \
- GDKerror(TIMEOUT_MSG); \
- return rtpe; \
+#define TIMEOUT_HANDLER(rtpe) \
+ do { \
+ GDKerror("%s\n", GDKexiting() ? EXITING_MSG : TIMEOUT_MSG); \
+ return rtpe; \
} while(0)
-#define GOTO_LABEL_TIMEOUT_HANDLER(label) \
- do { \
- GDKerror(TIMEOUT_MSG); \
- goto label; \
+#define GOTO_LABEL_TIMEOUT_HANDLER(label) \
+ do { \
+ GDKerror("%s\n", GDKexiting() ? EXITING_MSG : TIMEOUT_MSG); \
+ goto label; \
} while(0)
#define GDK_CHECK_TIMEOUT_BODY(timeoffset, callback) \
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2527,17 +2527,7 @@ BBPcacheit(BAT *bn, bool lock)
if (lock)
lock = locked_by == 0 || locked_by != MT_getpid();
- if (i) {
- assert(i > 0);
- } else {
- i = BBPinsert(bn); /* bat was not previously entered */
- if (i == 0)
- return GDK_FAIL;
- if (bn->theap)
- bn->theap->parentid = i;
- if (bn->tvheap)
- bn->tvheap->parentid = i;
- }
+ assert(i > 0);
if (lock)
MT_lock_set(&GDKswapLock(i));
@@ -2778,7 +2768,7 @@ static inline int
incref(bat i, bool logical, bool lock)
{
int refs;
- BAT *b, *pb = NULL, *pvb = NULL;
+ BAT *b;
if (!BBPcheck(i))
return 0;
@@ -2815,14 +2805,6 @@ incref(bat i, bool logical, bool lock)
if (lock)
MT_lock_unset(&GDKswapLock(i));
- if (!logical && refs > 1) {
- /* this wasn't the first physical reference, so undo
- * the fixes on the parent bats */
- if (pb)
- BBPunfix(pb->batCacheid);
- if (pvb)
- BBPunfix(pvb->batCacheid);
- }
return refs;
}
@@ -2833,16 +2815,7 @@ incref(bat i, bool logical, bool lock)
int
BBPfix(bat i)
{
- bool lock = locked_by == 0 || locked_by != MT_getpid();
-
- BAT *b = BBP_desc(i);
- if (b) {
- if (b->theap->parentid != b->batCacheid)
- (void) BBPfix(b->theap->parentid);
- if (b->tvheap && b->tvheap->parentid != b->batCacheid)
- (void) BBPfix(b->tvheap->parentid);
- }
- return incref(i, false, lock);
+ return BATdescriptor(i) ? 1 : 0;
}
/* increment the logical reference count for the given bat
@@ -2868,7 +2841,7 @@ BBPshare(bat parent)
assert(BBP_refs(parent) > 0);
if (lock)
MT_lock_unset(&GDKswapLock(parent));
- BBPfix(parent);
+ (void) BATdescriptor(parent);
}
static inline int
@@ -3075,39 +3048,54 @@ BATdescriptor(bat i)
BAT *b = NULL;
if (BBPcheck(i)) {
- for (;;) {
- MT_lock_set(&GDKswapLock(i));
- if (!(BBP_status(i) & (BBPUNSTABLE|BBPLOADING)))
- break;
- /* the BATs is "unstable", try again */
- MT_lock_unset(&GDKswapLock(i));
- BBPspin(i, __func__, BBPUNSTABLE|BBPLOADING);
+ bool lock = locked_by == 0 || locked_by != MT_getpid();
+ /* parent bats get a single fix for all physical
+ * references of a view and in order to do that
+ * properly, we must incref the parent bats always
+ * before our own incref, then after that decref them if
+ * we were not the first */
+ int tp = 0, tvp = 0;
+ if ((b = BBP_desc(i)) != NULL) {
+ MT_lock_set(&b->theaplock);
+ tp = b->theap->parentid;
+ tvp = b->tvheap ? b->tvheap->parentid : 0;
+ MT_lock_unset(&b->theaplock);
+ if (tp != i) {
+ if (BATdescriptor(tp) == NULL) {
+ return NULL;
+ }
+ }
+ if (tvp != 0 && tvp != i) {
+ if (BATdescriptor(tvp) == NULL) {
+ if (tp != i)
+ BBPunfix(tp);
+ return NULL;
+ }
+ }
}
- if (incref(i, false, false) <= 0)
+ if (lock) {
+ for (;;) {
+ MT_lock_set(&GDKswapLock(i));
+ if (!(BBP_status(i) & (BBPUNSTABLE|BBPLOADING)))
+ break;
+ /* the BATs is "unstable", try again */
+ MT_lock_unset(&GDKswapLock(i));
+ BBPspin(i, __func__, BBPUNSTABLE|BBPLOADING);
+ }
+ }
+ int refs;
+ if ((refs = incref(i, false, false)) <= 0)
return NULL;
b = BBP_cache(i);
if (b == NULL)
b = getBBPdescriptor(i);
- MT_lock_unset(&GDKswapLock(i));
- if (b != NULL) {
- MT_lock_set(&b->theaplock);
- int tp = b->theap->parentid;
- int tvp = b->tvheap ? b->tvheap->parentid : 0;
- MT_lock_unset(&b->theaplock);
- if (tp != b->batCacheid &&
- BATdescriptor(tp) == NULL) {
- decref(i, false, false, false, false, __func__);
- return NULL;
- }
- if (tvp != 0 &&
- tvp != b->batCacheid &&
- BATdescriptor(tvp) == NULL) {
- if (tp != b->batCacheid)
- decref(tp, false, false, true, true,
__func__);
-
- decref(i, false, false, false, false, __func__);
- return NULL;
- }
+ if (lock)
+ MT_lock_unset(&GDKswapLock(i));
+ if (refs > 1) {
+ if (tp != 0 && tp != i)
+ BBPunfix(tp);
+ if (tvp != 0 && tvp != i)
+ BBPunfix(tvp);
}
}
return b;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -34,7 +34,8 @@ static gdk_return log_del_bat(logger *lg
#define LOG_DESTROY 6
#define LOG_SEQ 7
#define LOG_CLEAR 8
-#define LOG_ROW 9 /* per row relative small log entry */
+#define LOG_BAT_GROUP 9
+#define LOG_COMMIT 10
#ifdef NATIVE_WIN32
#define getfilepos _ftelli64
@@ -60,7 +61,7 @@ static const char *log_commands[] = {
"LOG_DESTROY",
"LOG_SEQ",
"LOG_CLEAR",
- "LOG_ROW",
+ "LOG_BAT_GROUP",
};
typedef struct logaction {
@@ -375,8 +376,15 @@ string_reader(logger *lg, BAT *b, lng nr
return res;
}
+
+struct offset {
+ lng os /*offset within source BAT in logfile */;
+ lng nr /*number of values to be copied*/;
+ lng od /*offset within destination BAT in database*/;
+};
+
static log_return
-log_read_updates(logger *lg, trans *tr, logformat *l, log_id id)
+log_read_updates(logger *lg, trans *tr, logformat *l, log_id id, BAT** cands)
{
log_return res = LOG_OK;
lng nr, pnr;
@@ -406,6 +414,53 @@ log_read_updates(logger *lg, trans *tr,
return LOG_ERR;
}
}
+
+ if (l->flag == LOG_UPDATE_CONST) {
+ if (mnstr_readLng(lg->input_log, &offset) != 1)
+ return LOG_ERR;
+ if (cands) {
+ // This const range actually represents a
segment of candidates corresponding to updated bat entries
+
+ if (BATcount(*cands) == 0 || lg->flushing) {
+ // when flushing, we only need the
offset and count of the last segment of inserts.
+ assert((*cands)->ttype == TYPE_void);
+ BATtseqbase(*cands, (oid) offset);
+ BATsetcount(*cands, (BUN) nr);
+ }
+ else if (!lg->flushing) {
+ assert(BATcount(*cands) > 0);
+ BAT* dense = BATdense(0, (oid) offset,
(BUN) nr);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]