Changeset: b0446abccacf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b0446abccacf
Branch: unlock
Log Message:
merged
diffs (truncated from 903 to 300 lines):
diff --git a/monetdb5/optimizer/opt_postfix.c b/monetdb5/optimizer/opt_postfix.c
--- a/monetdb5/optimizer/opt_postfix.c
+++ b/monetdb5/optimizer/opt_postfix.c
@@ -76,16 +76,16 @@ OPTpostfixImplementation(Client cntxt, M
ValRecord *x =
&getVarConstant(mb, getArg(p, 6)), cst = {.vtype = TYPE_int};
switch (x->val.ival) {
case JOIN_LT:
- cst.val.ival =
JOIN_GE;
- break;
- case JOIN_LE:
cst.val.ival =
JOIN_GT;
break;
+ case JOIN_LE:
+ cst.val.ival =
JOIN_GE;
+ break;
case JOIN_GT:
- cst.val.ival =
JOIN_LE;
+ cst.val.ival =
JOIN_LT;
break;
case JOIN_GE:
- cst.val.ival =
JOIN_LT;
+ cst.val.ival =
JOIN_LE;
break;
default:
cst.val.ival =
x->val.ival;
diff --git a/sql/backends/monet5/Tests/Mbeddedsql5--help.bat
b/sql/backends/monet5/Tests/Mbeddedsql5--help.bat
--- a/sql/backends/monet5/Tests/Mbeddedsql5--help.bat
+++ b/sql/backends/monet5/Tests/Mbeddedsql5--help.bat
@@ -1,4 +1,3 @@
-@echo on
@prompt # $t $g
Mbeddedsql5 --help
diff --git a/sql/benchmarks/arno_flt/Tests/doAll.SQL.bat
b/sql/benchmarks/arno_flt/Tests/doAll.SQL.bat
--- a/sql/benchmarks/arno_flt/Tests/doAll.SQL.bat
+++ b/sql/benchmarks/arno_flt/Tests/doAll.SQL.bat
@@ -1,5 +1,4 @@
@prompt # $t $g
-@echo on
%SQL_CLIENT% < "%TSTSRCDIR%\check0.sql"
diff --git a/sql/benchmarks/arno_flt/Tests/doAll_sorted.SQL.bat
b/sql/benchmarks/arno_flt/Tests/doAll_sorted.SQL.bat
--- a/sql/benchmarks/arno_flt/Tests/doAll_sorted.SQL.bat
+++ b/sql/benchmarks/arno_flt/Tests/doAll_sorted.SQL.bat
@@ -1,5 +1,4 @@
@prompt # $t $g
-@echo on
%SQL_CLIENT% < "%TSTSRCDIR%\check0.sql"
diff --git a/sql/benchmarks/arno_flt/Tests/init.SQL.bat
b/sql/benchmarks/arno_flt/Tests/init.SQL.bat
--- a/sql/benchmarks/arno_flt/Tests/init.SQL.bat
+++ b/sql/benchmarks/arno_flt/Tests/init.SQL.bat
@@ -1,5 +1,4 @@
@prompt # $t $g
-@echo on
%SQL_CLIENT% < "%TSTSRCBASE%\%TSTDIR%\create_tables.flt.sql"
diff --git a/sql/jdbc/tests/Tests/Test.SQL.bat
b/sql/jdbc/tests/Tests/Test.SQL.bat
--- a/sql/jdbc/tests/Tests/Test.SQL.bat
+++ b/sql/jdbc/tests/Tests/Test.SQL.bat
@@ -3,6 +3,5 @@
set
URL=jdbc:monetdb://%HOST%:%MAPIPORT%/%TSTDB%?user=monetdb^&password=monetdb%JDBC_EXTRA_ARGS%
prompt # $t $g
-echo on
java %TST% "%URL%"
diff --git a/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.bat
b/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.bat
--- a/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.bat
+++ b/sql/jdbc/tests/Tests/Test_JdbcClient.SQL.bat
@@ -4,7 +4,6 @@ echo user=monetdb> .monetdb
echo password=monetdb>> .monetdb
prompt # $t $g
-echo on
java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d "%TSTDB%"
--help
diff --git a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.bat
b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.bat
--- a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.bat
+++ b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.bat
@@ -4,7 +4,6 @@ echo user=monetdb> .monetdb
echo password=monetdb>> .monetdb
prompt # $t $g
-echo on
call java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d %TSTDB%
-e -f "%TSTSRCBASE%\%TSTDIR%\Tests\ValidateSystemCatalogTables.sql"
diff --git a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.bat
b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.bat
--- a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.bat
+++ b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.bat
@@ -4,7 +4,6 @@ echo user=monetdb> .monetdb
echo password=monetdb>> .monetdb
prompt # $t $g
-echo on
call java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d %TSTDB%
-e -f "%TSTSRCBASE%\%TSTDIR%\Tests\bogus-auto-generated-keys.sql"
diff --git a/sql/odbc/samples/Tests/odbcsample1.SQL.bat
b/sql/odbc/samples/Tests/odbcsample1.SQL.bat
--- a/sql/odbc/samples/Tests/odbcsample1.SQL.bat
+++ b/sql/odbc/samples/Tests/odbcsample1.SQL.bat
@@ -1,6 +1,5 @@
@echo off
prompt # $t $g
-echo on
odbcsample1.exe
diff --git a/sql/odbc/samples/Tests/testgetinfo.SQL.bat
b/sql/odbc/samples/Tests/testgetinfo.SQL.bat
--- a/sql/odbc/samples/Tests/testgetinfo.SQL.bat
+++ b/sql/odbc/samples/Tests/testgetinfo.SQL.bat
@@ -1,6 +1,5 @@
@echo off
prompt # $t $g
-echo on
testgetinfo.exe
diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -14,11 +14,17 @@
struct versionhead ;
-#define active (0)
-#define under_destruction (1<<1)
-#define block_destruction (1<<2)
-#define deleted (1<<3)
-#define rollbacked (1<<4)
+#define active (0)
+#define under_destruction (1<<1)
+#define block_destruction (1<<2)
+#define deleted (1<<3)
+#define rollbacked (1<<4)
+
+/* This objectversion owns its associated versionhead.
+ * When this objectversion gets destroyed,
+ * the cleanup procedure should also destroy the associated (name|id) based
versionhead.*/
+#define name_based_versionhead_owner (1<<5)
+#define id_based_versionhead_owner (1<<6)
typedef struct objectversion {
ulng ts;
@@ -40,7 +46,6 @@ typedef struct versionhead {
objectversion* ov;
} versionhead ;
-// TODO: this might be moved to the objectversion struct itself.
typedef struct RW_lock { //readers-writer lock
int reader_cnt;
MT_Lock readers_lock;
@@ -102,28 +107,20 @@ unlock_writer(objectset* os)
MT_lock_unset(&os->rw_lock.general_lock);
}
+static bte os_atmc_get_state(objectversion *ov) {
+ bte state = (bte) ATOMIC_GET(&ov->state);
+ return state;
+}
+
+static void os_atmc_set_state(objectversion *ov, bte state) {
+ ATOMIC_SET(&ov->state, state);
+}
+
static versionhead *
find_id(objectset *os, sqlid id)
{
if (os) {
- lock_writer(os);
- if ((!os->id_map || os->id_map->size*16 < os->id_based_cnt) &&
os->id_based_cnt > HASH_MIN_SIZE && os->sa) {
- hash_destroy(os->id_map);
- os->id_map = hash_new(os->sa, os->id_based_cnt,
(fkeyvalue)&os_id_key);
- if (os->id_map == NULL) {
- unlock_writer(os);
- return NULL;
- }
-
- for (versionhead *n = os->id_based_h; n; n = n->next )
{
- int key = os_id_key(n);
-
- if (hash_add(os->id_map, key, n) == NULL) {
- unlock_writer(os);
- return NULL;
- }
- }
- }
+ lock_reader(os);
if (os->id_map) {
int key = (int) BATatoms[TYPE_int].atomHash(&id);
sql_hash_e *he =
os->id_map->buckets[key&(os->id_map->size-1)];
@@ -132,23 +129,26 @@ find_id(objectset *os, sqlid id)
versionhead *n = he->value;
if (n && n->ov->b->id == id) {
- unlock_writer(os);
+ unlock_reader(os);
return n;
}
}
- unlock_writer(os);
+ unlock_reader(os);
return NULL;
}
- unlock_writer(os);
+
for (versionhead *n = os->id_based_h; n; n = n->next) {
objectversion *ov = n->ov;
/* check if ids match */
if (id == ov->b->id) {
+ unlock_reader(os);
return n;
}
}
}
+
+ unlock_reader(os);
return NULL;
}
@@ -179,11 +179,11 @@ node_destroy(objectset *os, sqlstore *st
}
static versionhead *
-os_remove_name_based_chain(objectset *os, sqlstore *store, versionhead *n)
+os_remove_name_based_chain(objectset *os, objectversion* ov)
{
- assert(n);
+ lock_writer(os);
+ versionhead *n = ov->name_based_head;
versionhead *p = os->name_based_h;
-
if (p != n)
while (p && p->next != n)
p = p->next;
@@ -201,19 +201,23 @@ os_remove_name_based_chain(objectset *os
if (n == os->name_based_t)
os->name_based_t = p;
- lock_writer(os);
if (os->name_map && n)
hash_delete(os->name_map, n);
+
+ os->name_based_cnt--;
unlock_writer(os);
- node_destroy(os, store, n);
+ bte state = os_atmc_get_state(ov);
+ state |= name_based_versionhead_owner;
+ os_atmc_set_state(ov, state);
return p;
}
static versionhead *
-os_remove_id_based_chain(objectset *os, sqlstore *store, versionhead *n)
+os_remove_id_based_chain(objectset *os, objectversion* ov)
{
- assert(n);
+ lock_writer(os);
+ versionhead *n = ov->id_based_head;
versionhead *p = os->id_based_h;
if (p != n)
@@ -233,12 +237,15 @@ os_remove_id_based_chain(objectset *os,
if (n == os->id_based_t)
os->id_based_t = p;
- lock_writer(os);
if (os->id_map && n)
hash_delete(os->id_map, n);
+
+ os->name_based_cnt--;
unlock_writer(os);
- node_destroy(os, store, n);
+ bte state = os_atmc_get_state(ov);
+ state |= id_based_versionhead_owner;
+ os_atmc_set_state(ov, state);
return p;
}
@@ -255,11 +262,34 @@ node_create(sql_allocator *sa, objectver
return n;
}
+static int
+os_name_key(versionhead *n)
+{
+ return hash_key(n->ov->b->name);
+}
+
static objectset *
-
os_append_node_name(objectset *os, versionhead *n)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list