Changeset: e1641975eaea for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e1641975eaea
Modified Files:
configure.ag
gdk/gdk_search.c
monetdb5/mal/mal_profiler.c
monetdb5/modules/atoms/str.c
monetdb5/modules/mal/Tests/All
monetdb5/modules/mal/mal_mapi.c
sql/backends/monet5/Makefile.ag
sql/server/rel_psm.c
sql/server/rel_select.c
sql/storage/store.c
testing/Mtest.py.in
Branch: mosaic
Log Message:
Merge with default
diffs (296 lines):
diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -316,6 +316,35 @@ BATcheckhash(BAT *b)
return ret;
}
+#ifdef PERSISTENTHASH
+static void
+BAThashsync(void *arg)
+{
+ Heap *hp = arg;
+ int fd;
+ lng t0 = GDKusec();
+
+ if (HEAPsave(hp, hp->filename, NULL) != GDK_SUCCEED)
+ return;
+ if ((fd = GDKfdlocate(hp->farmid, hp->filename, "rb+", NULL)) < 0)
+ return;
+ ((size_t *) hp->base)[0] |= 1 << 24;
+ if (write(fd, hp->base, SIZEOF_SIZE_T) < 0)
+ perror("write hash");
+ if (!(GDKdebug & FORCEMITOMASK)) {
+#if defined(NATIVE_WIN32)
+ _commit(fd);
+#elif defined(HAVE_FDATASYNC)
+ fdatasync(fd);
+#elif defined(HAVE_FSYNC)
+ fsync(fd);
+#endif
+ }
+ close(fd);
+ ALGODEBUG fprintf(stderr, "#BAThash: persisting hash %s (" LLFMT "
usec)\n", hp->filename, GDKusec() - t0);
+}
+#endif
+
/*
* The prime routine for the BAT layer is to create a new hash index.
* Its argument is the element type and the maximum number of BUNs be
@@ -340,9 +369,6 @@ BAThash(BAT *b, BUN masksize)
const char *nme = BBP_physical(b->batCacheid);
const char *ext = b->batCacheid > 0 ? "thash" : "hhash";
BATiter bi = bat_iterator(b);
-#ifdef PERSISTENTHASH
- int fd;
-#endif
ALGODEBUG fprintf(stderr, "#BAThash: create hash(%s#" BUNFMT
");\n", BATgetId(b), BATcount(b));
if ((hp = GDKzalloc(sizeof(*hp))) == NULL ||
@@ -516,24 +542,9 @@ BAThash(BAT *b, BUN masksize)
break;
}
#ifdef PERSISTENTHASH
- if ((BBP_status(b->batCacheid) & BBPEXISTING) &&
- b->batInserted == b->batCount &&
- HEAPsave(hp, nme, ext) == GDK_SUCCEED &&
- (fd = GDKfdlocate(hp->farmid, nme, "rb+", ext)) >= 0) {
- ALGODEBUG fprintf(stderr, "#BAThash: persisting hash
%d\n", b->batCacheid);
- ((size_t *) hp->base)[0] |= 1 << 24;
- if (write(fd, hp->base, SIZEOF_SIZE_T) < 0)
- perror("write hash");
- if (!(GDKdebug & FORCEMITOMASK)) {
-#if defined(NATIVE_WIN32)
- _commit(fd);
-#elif defined(HAVE_FDATASYNC)
- fdatasync(fd);
-#elif defined(HAVE_FSYNC)
- fsync(fd);
-#endif
- }
- close(fd);
+ if (BBP_status(b->batCacheid) & BBPEXISTING) {
+ MT_Id tid;
+ MT_create_thread(&tid, BAThashsync, hp,
MT_THR_DETACHED);
} else
ALGODEBUG fprintf(stderr, "#BAThash: NOT persisting
hash %d\n", b->batCacheid);
#endif
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -951,6 +951,7 @@ static volatile ATOMIC_TYPE hbrunning;
static void profilerHeartbeat(void *dummy)
{
int t;
+ const int timeout = GDKdebug & FORCEMITOMASK ? 10 : 25;
(void) dummy;
for (;;) {
@@ -958,12 +959,12 @@ static void profilerHeartbeat(void *dumm
while (ATOMIC_GET(hbdelay, mal_beatLock) == 0 || eventstream ==
NULL) {
if (GDKexiting() || !ATOMIC_GET(hbrunning,
mal_beatLock))
return;
- MT_sleep_ms(25);
+ MT_sleep_ms(timeout);
}
- for (t = (int) ATOMIC_GET(hbdelay, mal_beatLock); t > 0; t -=
25) {
+ for (t = (int) ATOMIC_GET(hbdelay, mal_beatLock); t > 0; t -=
timeout) {
if (GDKexiting() || !ATOMIC_GET(hbrunning,
mal_beatLock))
return;
- MT_sleep_ms(t > 25 ? 25 : t);
+ MT_sleep_ms(t > timeout ? timeout : t);
}
profilerHeartbeatEvent("ping");
}
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -1439,6 +1439,7 @@ convertCase(BAT *from, BAT *to, str *res
const unsigned char *src = (const unsigned char *) s;
const unsigned char *end = (const unsigned char *) (src + len);
BUN UTF8_CONV_r;
+ int lower_to_upper = from == UTF8_lowerBat;
if (strNil(s)) {
*res = GDKstrdup(str_nil);
@@ -1450,9 +1451,21 @@ convertCase(BAT *from, BAT *to, str *res
int c;
UTF8_GETCHAR(c, src);
- HASHfnd_int(UTF8_CONV_r, fromi, &c);
- if (UTF8_CONV_r != BUN_NONE)
- c = *(int*) BUNtloc(toi, UTF8_CONV_r);
+ if (c < 0x80) {
+ /* for ASCII characters we don't need
to do a hash
+ * lookup */
+ if (lower_to_upper) {
+ if ('a' <= c && c <= 'z')
+ c += 'A' - 'a';
+ } else {
+ if ('A' <= c && c <= 'Z')
+ c += 'a' - 'A';
+ }
+ } else {
+ HASHfnd_int(UTF8_CONV_r, fromi, &c);
+ if (UTF8_CONV_r != BUN_NONE)
+ c = *(int*) BUNtloc(toi,
UTF8_CONV_r);
+ }
if (dst + 6 > (unsigned char *) *res + len) {
/* not guaranteed to fit, so allocate
more space;
* also allocate enough for the rest of
the
diff --git a/monetdb5/modules/mal/Tests/All b/monetdb5/modules/mal/Tests/All
--- a/monetdb5/modules/mal/Tests/All
+++ b/monetdb5/modules/mal/Tests/All
@@ -31,26 +31,26 @@ mat
remoteInit
-remote01
-remote02
-HAVE_GEOM?remote03
-remote04
-remote06
-remote07
-remote08
-remote09
-remote11
-remote12
+!BAD_HOSTNAME?remote01
+!BAD_HOSTNAME?remote02
+!BAD_HOSTNAME&HAVE_GEOM?remote03
+!BAD_HOSTNAME?remote04
+!BAD_HOSTNAME?remote06
+!BAD_HOSTNAME?remote07
+!BAD_HOSTNAME?remote08
+!BAD_HOSTNAME?remote09
+!BAD_HOSTNAME?remote11
+!BAD_HOSTNAME?remote12
# needs Merovingian and aims at SQL
-#remote88
-#remote89
-remote99
+#!BAD_HOSTNAME?remote88
+#!BAD_HOSTNAME?remote89
+!BAD_HOSTNAME?remote99
-remote10
+!BAD_HOSTNAME?remote10
# this will always return something else
-#sabaoth00
-sabaoth01
+#!BAD_HOSTNAME?sabaoth00
+!BAD_HOSTNAME?sabaoth01
partition
batpartition
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -221,9 +221,9 @@ SERVERlistenThread(SOCKET *Sock)
if (usock != INVALID_SOCKET)
FD_SET(usock, &fds);
#endif
- /* Wait up to 0.5 seconds. */
+ /* Wait up to 0.025 seconds (0.01 if testing) */
tv.tv_sec = 0;
- tv.tv_usec = 500000;
+ tv.tv_usec = GDKdebug & FORCEMITOMASK ? 10000 : 25000;
/* temporarily use msgsock to record the larger of sock and
usock */
msgsock = sock;
diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -639,6 +639,8 @@ create_type_list(mvc *sql, dlist *params
if (param) {
an = n->data.lval->h;
par_subtype = &an->next->data.typeval;
+ if (par_subtype && !par_subtype->type) /* var
arg */
+ return type_list;
list_append(type_list, par_subtype);
} else {
par_subtype = &an->data.typeval;
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -1263,6 +1263,14 @@ rel_with_query(mvc *sql, symbol *q )
return NULL;
}
stack_push_rel_view(sql, name, nrel);
+ if (!is_project(nrel->op)) {
+ if (is_topn(nrel->op) || is_sample(nrel->op)) {
+ nrel = rel_project(sql->sa, nrel,
rel_projections(sql, nrel, NULL, 1, 1));
+ } else {
+ stack_pop_frame(sql);
+ return NULL;
+ }
+ }
assert(is_project(nrel->op));
if (is_project(nrel->op) && nrel->exps) {
node *ne = nrel->exps->h;
@@ -6147,6 +6155,10 @@ rel_selects(mvc *sql, symbol *s)
sql_rel *ret = NULL;
switch (s->token) {
+ case SQL_WITH:
+ ret = rel_with_query(sql, s);
+ sql->type = Q_TABLE;
+ break;
case SQL_SELECT: {
exp_kind ek = {type_value, card_relation, TRUE};
SelectNode *sn = (SelectNode *) s;
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -1658,13 +1658,15 @@ store_flush_log(void)
void
store_manager(void)
{
+ const int timeout = GDKdebug & FORCEMITOMASK ? 10 : 50;
+
while (!GDKexiting()) {
int res = LOG_OK;
int t;
lng shared_transactions_drift = -1;
- for (t = 30000; t > 0 && !need_flush; t -= 50) {
- MT_sleep_ms(50);
+ for (t = 30000; t > 0 && !need_flush; t -= timeout) {
+ MT_sleep_ms(timeout);
if (GDKexiting())
return;
}
@@ -1690,7 +1692,7 @@ store_manager(void)
MT_lock_unset(&bs_lock);
if (GDKexiting())
continue;
- MT_sleep_ms(50);
+ MT_sleep_ms(timeout);
MT_lock_set(&bs_lock);
}
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -331,6 +331,7 @@ CONDITIONALS = {
'HAVE_RUBY' : "",
'MERCURIAL' : "",
'RELEASERUN' : "",
+ 'BAD_HOSTNAME' : "",
}
# a bunch of classes to help with generating (X)HTML files
@@ -3785,6 +3786,12 @@ def main(argv) :
pass
os.chdir(BACK)
+ # check whether our hostname makes sense
+ try:
+ socket.getaddrinfo(socket.gethostname(), 50000)
+ except:
+ CONDITIONALS['BAD_HOSTNAME'] = '#' # True
+
# read '.Mapprove.rc'
if THISFILE == 'Mapprove.py':
f = os.path.join(TSTTRGBASE, TSTPREF, '.Mapprove.rc')
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list