Changeset: 466ff66d21ef for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/466ff66d21ef
Modified Files:
gdk/gdk_bbp.c
sql/backends/monet5/sql.c
sql/test/sysmon/Tests/test_vacuum.SQL.py
Branch: strheapvacuum
Log Message:
hook into BBPmanager
diffs (93 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -118,6 +118,7 @@ static gdk_return BBPprepare(bool subcom
static BAT *getBBPdescriptor(bat i, bool lock);
static gdk_return BBPbackup(BAT *b, bool subcommit);
static gdk_return BBPdir_init(void);
+static void BBPcallbacks(void);
static lng BBPlogno; /* two lngs of extra info in BBP.dir */
static lng BBPtransid;
@@ -1392,6 +1393,7 @@ BBPmanager(void *dummy)
return;
}
BBPtrim(false);
+ BBPcallbacks();
if (GDKexiting())
return;
}
@@ -4303,3 +4305,21 @@ int gdk_remove_callback(char *cb_name) {
}
return callback_list.cnt;
}
+
+inline static gdk_return do_callback(gdk_callback *cb) {
+ // TODO check interval and other contstraints
+ return cb->func(cb->argc, cb->argv);
+}
+
+static void
+BBPcallbacks(void)
+{
+ gdk_callback *next = NULL;
+
+ MT_lock_set(&(callback_list.lock));
+ while ((next=callback_list.head)) {
+ do_callback(next);
+ next = next->next;
+ }
+ MT_lock_unset(&(callback_list.lock));
+}
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -5143,7 +5143,7 @@ SQLstr_column_auto_vacuum(Client cntxt,
char *sname = *getArgReference_str(stk, pci, 1);
char *tname = *getArgReference_str(stk, pci, 2);
char *cname = *getArgReference_str(stk, pci, 3);
- int interval = *getArgReference_int(stk, pci, 4);
+ int interval = *getArgReference_int(stk, pci, 4); // in sec
if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
return msg;
@@ -5170,16 +5170,16 @@ SQLstr_column_auto_vacuum(Client cntxt,
.func = str_column_vacuum_callback,
};
- if (!(*callback->argv = GDKmalloc(sizeof(char *[callback->argc]))))
+ if (!(*callback->argv = GDKmalloc(sizeof(void *[callback->argc]))))
return createException(SQL, "sql.str_column_auto_vacuum",
SQLSTATE(HY013) MAL_MALLOC_FAIL);
callback->argv[0] = m->store;
- callback->argv[1] = sname;
- callback->argv[2] = tname;
- callback->argv[3] = cname;
+ callback->argv[1] = strdup(sname);
+ callback->argv[2] = strdup(tname);
+ callback->argv[3] = strdup(cname);
gdk_add_callback(callback);
// TODO REMOVE test the callback
- callback->func(callback->argc, callback->argv);
+ // callback->func(callback->argc, callback->argv);
return MAL_SUCCEED;
}
diff --git a/sql/test/sysmon/Tests/test_vacuum.SQL.py
b/sql/test/sysmon/Tests/test_vacuum.SQL.py
--- a/sql/test/sysmon/Tests/test_vacuum.SQL.py
+++ b/sql/test/sysmon/Tests/test_vacuum.SQL.py
@@ -14,11 +14,11 @@ with SQLTestCase() as tc:
res = tc.execute("select heapsize from sys.storage('sys', 'foo',
'a');").assertSucceeded()
heap_large = int(res.data[0][0])
assert(heap_large > heap_init)
- tc.execute("call sys.vacuum('sys', 'foo', 'a', 3);").assertSucceeded()
+ tc.execute("call sys.vacuum('sys', 'foo', 'a');").assertSucceeded()
res = tc.execute("select heapsize from sys.storage('sys', 'foo',
'a');").assertSucceeded()
heap_small = int(res.data[0][0])
- print(f'{heap_init}', file=sys.stderr)
- print(f'{heap_small} < {heap_large}', file=sys.stderr)
+ #print(f'{heap_init}', file=sys.stderr)
+ #print(f'{heap_small} < {heap_large}', file=sys.stderr)
assert(heap_small < heap_large)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list