Changeset: 4462862344a4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4462862344a4 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_storage.c monetdb5/modules/kernel/bat5.c monetdb5/modules/mal/tablet.c Branch: default Log Message:
Removed BATmsync. It wasn't actually used. diffs (222 lines): 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 @@ -166,7 +166,6 @@ BAT *BATmergecand(BAT *a, BAT *b); void *BATmin(BAT *b, void *aggr); void *BATmin_skipnil(BAT *b, void *aggr, bit skipnil); gdk_return BATmode(BAT *b, bool transient); -void BATmsync(BAT *b); BAT *BATnegcands(BUN nr, BAT *odels); BAT *BATnil_grp(BAT *l, BAT *g, BAT *e, BAT *s); bool BATordered(BAT *b); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -1306,7 +1306,6 @@ gdk_export gdk_return BATgroup(BAT **gro gdk_export gdk_return BATsave(BAT *b) __attribute__((__warn_unused_result__)); -gdk_export void BATmsync(BAT *b); #define NOFARM (-1) /* indicate to GDKfilepath to create relative path */ diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c --- a/gdk/gdk_storage.c +++ b/gdk/gdk_storage.c @@ -666,103 +666,6 @@ DESCload(int i) return b; } -/* spawning the background msync should be done carefully - * because there is a (small) chance that the BAT has been - * deleted by the time you issue the msync. - * This leaves you with possibly deadbeef BAT descriptors. - */ - -/* #define DISABLE_MSYNC */ -#define MSYNC_BACKGROUND - -#ifndef DISABLE_MSYNC -#ifndef MS_ASYNC -struct msync { - bat id; - Heap *h; -}; - -static void -BATmsyncImplementation(void *arg) -{ - Heap *h = ((struct msync *) arg)->h; - - (void) MT_msync(h->base, h->size); - BBPunfix(((struct msync *) arg)->id); - GDKfree(arg); -} -#endif -#endif - -void -BATmsync(BAT *b) -{ - /* we don't sync views or if we're told not to */ - if (isVIEW(b) || GDKinmemory(b->theap->farmid) || (GDKdebug & NOSYNCMASK)) - return; - /* we don't sync transients */ - if (b->theap->farmid != 0 || - (b->tvheap != NULL && b->tvheap->farmid != 0)) - return; -#ifndef DISABLE_MSYNC -#ifdef MS_ASYNC - if (b->theap->storage == STORE_MMAP && - msync(b->theap->base, b->theap->free, MS_ASYNC) < 0) - GDKsyserror("msync heap of bat %d failed\n", b->batCacheid); - if (b->tvheap && b->tvheap->storage == STORE_MMAP && - msync(b->tvheap->base, b->tvheap->free, MS_ASYNC) < 0) - GDKsyserror("msync vheap of bat %d failed\n", b->batCacheid); -#else - { - struct msync *arg; - - assert(!b->batTransient); - if (b->theap->storage == STORE_MMAP && - (arg = GDKmalloc(sizeof(*arg))) != NULL) { - arg->id = b->batCacheid; - arg->h = b->theap; - BBPfix(b->batCacheid); -#ifdef MSYNC_BACKGROUND - char name[MT_NAME_LEN]; - MT_Id tid; - snprintf(name, sizeof(name), "msync%d", b->batCacheid); - if (MT_create_thread(&tid, BATmsyncImplementation, arg, - MT_THR_DETACHED, name) < 0) { - /* don't bother if we can't create a thread */ - BBPunfix(b->batCacheid); - GDKfree(arg); - } -#else - BATmsyncImplementation(arg); -#endif - } - - if (b->tvheap && b->tvheap->storage == STORE_MMAP && - (arg = GDKmalloc(sizeof(*arg))) != NULL) { - arg->id = b->batCacheid; - arg->h = b->tvheap; - BBPfix(b->batCacheid); -#ifdef MSYNC_BACKGROUND - char name[MT_NAME_LEN]; - MT_Id tid; - snprintf(name, sizeof(name), "msync%d", b->batCacheid); - if (MT_create_thread(&tid, BATmsyncImplementation, arg, - MT_THR_DETACHED, name) < 0) { - /* don't bother if we can't create a thread */ - BBPunfix(b->batCacheid); - GDKfree(arg); - } -#else - BATmsyncImplementation(arg); -#endif - } - } -#endif -#else - (void) b; -#endif /* DISABLE_MSYNC */ -} - gdk_return BATsave_locked(BAT *b, BATiter *bi, BUN size) { diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c --- a/monetdb5/modules/kernel/bat5.c +++ b/monetdb5/modules/kernel/bat5.c @@ -78,8 +78,6 @@ BKCattach(bat *ret, const int *tt, const bn = BATattach(*tt, *heapfile, TRANSIENT); if (bn == NULL) throw(MAL, "bat.attach", GDK_EXCEPTION); - if( !bn->batTransient) - BATmsync(bn); *ret = bn->batCacheid; BBPkeepref(*ret); return MAL_SUCCEED; @@ -171,8 +169,6 @@ BKCdelete_all(bat *r, const bat *bid) BBPunfix(b->batCacheid); throw(MAL, "bat.delete", GDK_EXCEPTION); } - if( !b->batTransient) - BATmsync(b); *r = b->batCacheid; BATsettrivprop(b); BBPretain(b->batCacheid); @@ -221,8 +217,6 @@ BKCappend_cand_force_wrap(bat *r, const BBPunfix(b->batCacheid); throw(MAL, "bat.append", GDK_EXCEPTION); } - if( !b->batTransient) - BATmsync(b); *r = b->batCacheid; BATsettrivprop(b); BBPretain(b->batCacheid); diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c --- a/monetdb5/modules/mal/tablet.c +++ b/monetdb5/modules/mal/tablet.c @@ -593,8 +593,7 @@ TABLEToutput_file(Tablet *as, BAT *order #define BREAKROW 1 #define UPDATEBAT 2 -#define SYNCBAT 3 -#define ENDOFCOPY 4 +#define ENDOFCOPY 3 typedef struct { Client cntxt; @@ -1118,23 +1117,6 @@ SQLworker(void *arg) task->wtime += t0; } break; - case SYNCBAT: - if (!task->besteffort && task->errorcnt) - break; - for (i = 0; i < task->as->nr_attrs; i++) - if (task->cols[i]) { - BAT *b = task->as->format[task->cols[i] - 1].c; - if (b == NULL) - continue; - t0 = GDKusec(); - if (b->batTransient) - continue; - BATmsync(b); - t0 = GDKusec() - t0; - task->time[i] += t0; - task->wtime += t0; - } - break; case ENDOFCOPY: MT_sema_up(&task->reply); goto do_return; @@ -1872,25 +1854,11 @@ SQLload_file(Client cntxt, Tablet *as, b task.state = ENDOFCOPY; /* TRC_DEBUG(MAL_SERVER, "Activate sync on disk\n");*/ - // activate the workers to sync the BATs to disk - if (res == 0) { - for (j = 0; j < threads; j++) { - // stage three, update the BATs - ptask[j].state = SYNCBAT; - MT_sema_up(&ptask[j].sema); - } - } - if (!task.ateof || cnt < task.maxrow) { /* TRC_DEBUG(MAL_SERVER, "Shut down reader\n");*/ MT_sema_up(&task.producer); } MT_join_thread(task.tid); - if (res == 0) { - // await completion of the BAT syncs - for (j = 0; j < threads; j++) - MT_sema_down(&ptask[j].reply); - } /* TRC_DEBUG(MAL_SERVER, "Activate endofcopy\n");*/ _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org