Changeset: 409742201704 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=409742201704
Modified Files:
gdk/gdk_bbp.c
gdk/gdk_bbp.h
gdk/gdk_group.c
gdk/gdk_heap.c
gdk/gdk_posix.c
gdk/gdk_private.h
gdk/gdk_utils.c
monetdb5/mal/mal_interpreter.c
sql/backends/monet5/datacell/Tests/scenario01.sql
sql/backends/monet5/datacell/Tests/scenario02.sql
sql/backends/monet5/datacell/datacell.c
tools/merovingian/daemon/client.c
Branch: default
Log Message:
Merge with Feb2013 branch.
diffs (truncated from 335 to 300 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -236,7 +236,25 @@ BBP_getpid(void)
return x;
}
+#define BBP_unload_inc(bid, nme) \
+ do { \
+ MT_lock_set(&GDKunloadLock, nme); \
+ BBPunloadCnt++; \
+ MT_lock_unset(&GDKunloadLock, nme); \
+ } while (0)
+
+#define BBP_unload_dec(bid, nme) \
+ do { \
+ MT_lock_set(&GDKunloadLock, nme); \
+ if (--BBPunloadCnt == 0) \
+ MT_cond_signal(&GDKunloadCond, nme); \
+ assert(BBPunloadCnt >= 0); \
+ MT_lock_unset(&GDKunloadLock, nme); \
+ } while (0)
+
static int BBPunloadCnt = 0;
+static MT_Lock GDKunloadLock;
+static MT_Cond GDKunloadCond;
void
BBPlock(const char *nme)
@@ -972,6 +990,9 @@ BBPinit(void)
int oidsize;
oid BBPoid;
+ MT_lock_init(&GDKunloadLock, "GDKunloadLock");
+ MT_cond_init(&GDKunloadCond, "GDKunloadCond");
+
/* first move everything from SUBDIR to BAKDIR (its parent) */
if (BBPrecover_subdir() < 0)
GDKfatal("BBPinit: cannot properly process %s.", SUBDIR);
diff --git a/gdk/gdk_bbp.h b/gdk/gdk_bbp.h
--- a/gdk/gdk_bbp.h
+++ b/gdk/gdk_bbp.h
@@ -80,21 +80,6 @@ gdk_export void BBPshare(bat b);
#define BBP_status_off(bid, flags, nme)
\
BBP_status_set(bid, BBP_status(bid) & ~(flags), nme);
-#define BBP_unload_inc(bid, nme) \
- do { \
- MT_lock_set(&GDKunloadLock, nme); \
- BBPunloadCnt++; \
- MT_lock_unset(&GDKunloadLock, nme); \
- } while (0)
-
-#define BBP_unload_dec(bid, nme) \
- do { \
- MT_lock_set(&GDKunloadLock, nme); \
- if (--BBPunloadCnt == 0) \
- MT_cond_signal(&GDKunloadCond, nme); \
- assert(BBPunloadCnt >= 0); \
- MT_lock_unset(&GDKunloadLock, nme); \
- } while (0)
#define BBPswappable(b) ((b) && (b)->batCacheid && BBP_refs((b)->batCacheid)
== 0)
#define BBPtrimmable(b) (BBPswappable(b) && isVIEW(b) == 0 &&
(BBP_status((b)->batCacheid)&BBPWAITING) == 0)
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -119,11 +119,12 @@
break; \
} \
} \
- if (grps[hb - r] != grps[p - r]) \
+ if (hb != BUN_NONE && \
+ grps[hb - r] != grps[p - r]) \
hb = BUN_NONE; \
} else if (grps) { \
BUN hv = hash_##TYPE(hs, &w[p]); \
- BUN hg = hash_oid(hs, &grps[p-r]); \
+ BUN hg = (BUN) grps[p-r]; \
prb = ((hv << bits) ^ hg) & hs->mask; \
for (hb = hs->hash[prb]; \
hb != BUN_NONE; \
@@ -500,7 +501,8 @@ BATgroup_internal(BAT **groups, BAT **ex
break;
}
}
- if (grps[hb - r] != grps[p - r])
+ if (hb != BUN_NONE &&
+ grps[hb - r] != grps[p - r])
hb = BUN_NONE;
} else if (grps) {
for (;
@@ -633,11 +635,12 @@ BATgroup_internal(BAT **groups, BAT **ex
break;
}
}
- if (grps[hb - r] != grps[p - r])
+ if (hb != BUN_NONE &&
+ grps[hb - r] != grps[p - r])
hb = BUN_NONE;
} else if (grps) {
BUN hv = hash_any(hs, v);
- BUN hg = hash_oid(hs, &grps[p-r]);
+ BUN hg = (BUN) grps[p-r];
prb = ((hv << bits) ^ hg) & hs->mask;
for (hb = hs->hash[prb];
hb != BUN_NONE;
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -89,13 +89,13 @@ HEAPcacheInit(void)
MT_lock_init(&HEAPcacheLock, "HEAPcache_init");
MT_lock_set(&HEAPcacheLock, "HEAPcache_init");
- hc = (heap_cache*)GDKmalloc(sizeof(heap_cache));
+ hc = (heap_cache *) GDKmalloc(sizeof(heap_cache));
hc->used = 0;
hc->sz = HEAP_CACHE_SIZE;
- hc->hc = (heap_cache_e*)GDKmalloc(sizeof(heap_cache_e)*hc->sz);
+ hc->hc = (heap_cache_e *) GDKmalloc(sizeof(heap_cache_e) *
hc->sz);
GDKcreatedir(HCDIR DIR_SEP_STR);
/* clean old leftovers */
- for(i=0;i<HEAP_CACHE_SIZE;i++){
+ for (i = 0; i < HEAP_CACHE_SIZE; i++) {
char fn[PATHLENGTH];
snprintf(fn, PATHLENGTH, "%d", i);
@@ -113,7 +113,7 @@ HEAPcacheAdd(void *base, size_t maxsz, c
MT_lock_set(&HEAPcacheLock, "HEAPcache_init");
if (hc && free_file && fn && storage == STORE_MMAP && hc->used <
hc->sz) {
- heap_cache_e *e = hc->hc+hc->used;
+ heap_cache_e *e = hc->hc + hc->used;
e->base = base;
e->maxsz = maxsz;
@@ -177,12 +177,12 @@ HEAPcacheFind(size_t *maxsz, char *fn, s
if ((fp = fopen(fn, "rb+")) != NULL &&
#ifdef _WIN64
- _fseeki64(fp, (ssize_t) *maxsz-1, SEEK_SET)
>= 0 &&
+ _fseeki64(fp, (ssize_t) *maxsz - 1,
SEEK_SET) >= 0 &&
#else
#ifdef HAVE_FSEEKO
- fseeko(fp, (off_t) *maxsz-1, SEEK_SET) >= 0
&&
+ fseeko(fp, (off_t) *maxsz - 1, SEEK_SET) >=
0 &&
#else
- fseek(fp, (long) *maxsz-1, SEEK_SET) >= 0 &&
+ fseek(fp, (long) *maxsz - 1, SEEK_SET) >= 0
&&
#endif
#endif
fputc('\n', fp) >= 0 &&
@@ -214,7 +214,7 @@ HEAPcacheFind(size_t *maxsz, char *fn, s
/* move cached heap to its new location */
base = e->base;
*maxsz = e->maxsz;
- if (GDKmove(HCDIR, e->fn, NULL, BATDIR, fn,
NULL)<0) {
+ if (GDKmove(HCDIR, e->fn, NULL, BATDIR, fn,
NULL) < 0) {
/* try to create the directory, if
* that was the problem */
char path[PATHLENGTH];
@@ -1351,4 +1351,3 @@ HEAP_mmappable(Heap *heap)
}
return FALSE;
}
-
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -1007,37 +1007,4 @@ MT_sleep_ms(unsigned int ms)
Sleep(ms);
}
-
-/*
- * cygnus1.1.X has a bug in the semaphore routines. we work around it
- * by directly using the WIN32 primitives.
- */
-#ifndef NATIVE_WIN32
-
-int
-sem_init(sem_t * sem, int pshared, unsigned int value)
-{
- (void) pshared;
- *sem = (sem_t) CreateSemaphore(NULL, value, 128, NULL);
- return (*sem) ? 0 : -1;
-}
-
-int
-sem_destroy(sem_t * sem)
-{
- return CloseHandle((HANDLE) *sem) ? 0 : -1;
-}
-
-int
-sem_wait(sem_t * sem)
-{
- return (WaitForSingleObject((HANDLE) *sem, (unsigned int) INFINITE) !=
WAIT_FAILED) ? 0 : -1;
-}
-
-int
-sem_post(sem_t * sem)
-{
- return (ReleaseSemaphore((HANDLE) *sem, 1, NULL) == 0) ? -1 : 0;
-}
#endif
-#endif
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -135,8 +135,6 @@ extern int GDKrecovery;
extern int GDKsilent; /* should GDK shut up? */
extern MT_Lock GDKthreadLock;
extern MT_Lock GDKtmLock;
-extern MT_Cond GDKunloadCond;
-extern MT_Lock GDKunloadLock;
extern MT_Lock MT_system_lock;
#define ATOMappendpriv(t, h) \
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1016,8 +1016,6 @@ GDKinit(opt *set, int setlen)
}
MT_lock_init(&GDKnameLock, "GDKnameLock");
MT_lock_init(&GDKthreadLock, "GDKthreadLock");
- MT_lock_init(&GDKunloadLock, "GDKunloadLock");
- MT_cond_init(&GDKunloadCond, "GDKunloadCond");
MT_lock_init(&GDKtmLock, "GDKtmLock");
ATOMIC_INIT(mbyteslock, "mbyteslock");
errno = 0;
@@ -1216,9 +1214,7 @@ batlock_t GDKbatLock[BBP_BATMASK + 1];
bbplock_t GDKbbpLock[BBP_THREADMASK + 1];
MT_Lock GDKnameLock;
MT_Lock GDKthreadLock;
-MT_Lock GDKunloadLock;
MT_Lock GDKtmLock;
-MT_Cond GDKunloadCond;
/*
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -785,20 +785,22 @@ str runMALsequence(Client cntxt, MalBlkP
}
stkpc = mb->stop;
continue;
- default:
+ default: {
+ str w;
if (pci->token < 0) {
/* temporary NOOP instruction */
break;
}
- ret = createScriptException(mb, stkpc, MAL,
- NULL, "unkown operation");
+ w= instruction2str(mb, 0, pci, FALSE);
+ ret = createScriptException(mb, stkpc, MAL,
NULL, "unkown operation:%s",w);
+ GDKfree(w);
if (cntxt->qtimeout && time(NULL) -
stk->clock.tv_usec > cntxt->qtimeout){
ret= createException(MAL,
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
break;
}
stkpc= mb->stop;
continue;
- }
+ } }
/* monitoring information should reflect the input
arguments,
which may be removed by garbage collection */
diff --git a/sql/backends/monet5/datacell/Tests/scenario01.sql
b/sql/backends/monet5/datacell/Tests/scenario01.sql
--- a/sql/backends/monet5/datacell/Tests/scenario01.sql
+++ b/sql/backends/monet5/datacell/Tests/scenario01.sql
@@ -21,3 +21,4 @@ select * from datacell.receptors(); sele
drop table datacell.bsktin;
drop table datacell.bsktout;
+-- sensor --host=localhost --port=50500 --events=100 --columns=3 --delay=1
--protocol=udp
diff --git a/sql/backends/monet5/datacell/Tests/scenario02.sql
b/sql/backends/monet5/datacell/Tests/scenario02.sql
--- a/sql/backends/monet5/datacell/Tests/scenario02.sql
+++ b/sql/backends/monet5/datacell/Tests/scenario02.sql
@@ -16,8 +16,9 @@ call datacell.receptor('datacell.potin',
call datacell.emitter('datacell.potout','localhost',50602);
call datacell.query('datacell.putter', 'insert into datacell.potout select
now(), count(*) from datacell.potin;');
-call datacell.pause('potout'); -- hold the events
+call datacell.pause('datacell.potout'); -- hold up the events
+select * from datacell.receptors(); select * from datacell.emitters(); select
* from datacell.queries(); select * from datacell.baskets();
call datacell.resume();
select * from datacell.receptors(); select * from datacell.emitters(); select
* from datacell.queries(); select * from datacell.baskets();
diff --git a/sql/backends/monet5/datacell/datacell.c
b/sql/backends/monet5/datacell/datacell.c
--- a/sql/backends/monet5/datacell/datacell.c
+++ b/sql/backends/monet5/datacell/datacell.c
@@ -233,6 +233,7 @@ DCpauseObject(Client cntxt, MalBlkPtr mb
{
int idx, ret = 0;
str tbl = *(str *) getArgReference(stk, pci, 1);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list