Changeset: e72e456bb40f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e72e456bb40f
Modified Files:
        sql/storage/store.c
        testing/sqllogictest.py
Branch: default
Log Message:

Merge with Sep2022 branch.


diffs (truncated from 367 to 300 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -315,20 +315,20 @@ SQLhelp sqlhelp1[] = {
        {"DROP AGGREGATE",
         "",
         "DROP ALL AGGREGATE [ FUNCTION ] qname [ RESTRICT | CASCADE ]\n"
-        "DROP AGGREGATE [ FUNCTION ] [ IF EXISTS ] qname [ '(' [ param [',' 
...]] ')' ] [ RESTRICT | CASCADE ]",
-        "param",
+        "DROP AGGREGATE [ FUNCTION ] [ IF EXISTS ] qname [ '(' [ data_type 
[',' ...]] ')' ] [ RESTRICT | CASCADE ]",
+        NULL,
         NULL},
        {"DROP FILTER FUNCTION",
         "",
         "DROP ALL FILTER [ FUNCTION ] qname [ RESTRICT | CASCADE ]\n"
-        "DROP FILTER [ FUNCTION ] [ IF EXISTS ] qname [ '(' [ param [',' ...]] 
')' ] [ RESTRICT | CASCADE ]",
-        "param",
+        "DROP FILTER [ FUNCTION ] [ IF EXISTS ] qname [ '(' [ data_type [',' 
...]] ')' ] [ RESTRICT | CASCADE ]",
+        NULL,
         NULL},
        {"DROP FUNCTION",
         "",
         "DROP ALL FUNCTION qname [ RESTRICT | CASCADE ]\n"
-        "DROP FUNCTION [ IF EXISTS ] qname [ '(' [ param [',' ...]] ')' ] [ 
RESTRICT | CASCADE ]",
-        "param",
+        "DROP FUNCTION [ IF EXISTS ] qname [ '(' [ data_type [',' ...]] ')' ] 
[ RESTRICT | CASCADE ]",
+        NULL,
         NULL},
        {"DROP INDEX",
         "",
@@ -338,14 +338,14 @@ SQLhelp sqlhelp1[] = {
        {"DROP LOADER",
         "",
         "DROP ALL LOADER [ FUNCTION ] qname [ RESTRICT | CASCADE ]\n"
-        "DROP LOADER [ FUNCTION ] [ IF EXISTS ] qname [ '(' [ param [',' ...]] 
')' ] [ RESTRICT | CASCADE ]",
-        "param",
+        "DROP LOADER [ FUNCTION ] [ IF EXISTS ] qname [ '(' [ data_type [',' 
...]] ')' ] [ RESTRICT | CASCADE ]",
+        NULL,
         NULL},
        {"DROP PROCEDURE",
         "",
         "DROP ALL PROCEDURE qname [ RESTRICT | CASCADE ]\n"
-        "DROP PROCEDURE [ IF EXISTS ] qname [ '(' [ param [',' ...]] ')' ] [ 
RESTRICT | CASCADE ]",
-        "param",
+        "DROP PROCEDURE [ IF EXISTS ] qname [ '(' [ data_type [',' ...]] ')' ] 
[ RESTRICT | CASCADE ]",
+        NULL,
         NULL},
        {"DROP ROLE",
         "",
@@ -354,7 +354,7 @@ SQLhelp sqlhelp1[] = {
         NULL},
        {"DROP SCHEMA",
         "",
-        "DROP SCHEMA [ IF EXISTS ] qname [ RESTRICT | CASCADE ]",
+        "DROP SCHEMA [ IF EXISTS ] ident [ RESTRICT | CASCADE ]",
         NULL,
         NULL},
        {"DROP SEQUENCE",
@@ -390,8 +390,8 @@ SQLhelp sqlhelp1[] = {
        {"DROP WINDOW",
         "",
         "DROP ALL WINDOW [ FUNCTION ] qname [ RESTRICT | CASCADE ]\n"
-        "DROP WINDOW [ FUNCTION ] [ IF EXISTS ] qname [ '(' [ param [',' ...]] 
')' ] [ RESTRICT | CASCADE ]",
-        "param",
+        "DROP WINDOW [ FUNCTION ] [ IF EXISTS ] qname [ '(' [ data_type [',' 
...]] ')' ] [ RESTRICT | CASCADE ]",
+        NULL,
         NULL},
        {"EXECUTE",
         "Execute a prepared SQL statement with supplied parameter values",
@@ -694,7 +694,7 @@ SQLhelp sqlhelp2[] = {
         NULL,
         NULL},
        {"ident",
-        "An identifier. Use double quote's around the identifier name to 
include\n"
+        "An identifier name. Use double quote's around the identifier name to 
include\n"
         "        mixed/upper case letters and/or special characters",
         NULL,
         NULL,
diff --git a/sql/ChangeLog.Sep2022 b/sql/ChangeLog.Sep2022
--- a/sql/ChangeLog.Sep2022
+++ b/sql/ChangeLog.Sep2022
@@ -1,6 +1,10 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Mon Jan 23 2023 Sjoerd Mullender <[email protected]>
+- Fixed a regression where when there are multiple concurrent
+  transactions, the dependencies weren't checked properly.
+
 * Fri Dec 16 2022 Sjoerd Mullender <[email protected]>
 - Added some error checking to prevent crashes.  Errors would mainly
   occur under memory pressure.
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3919,7 +3919,6 @@ sql_trans_commit(sql_trans *tr)
                }
 
                if (!tr->parent &&
-                       ATOMIC_GET(&store->nr_active) == 1 &&
                        (!list_empty(tr->dependencies) || 
!list_empty(tr->depchanges))) {
                        ok = transaction_check_dependencies_and_removals(tr);
                        if (ok != LOG_OK) {
diff --git a/sql/test/mergetables/Tests/All b/sql/test/mergetables/Tests/All
--- a/sql/test/mergetables/Tests/All
+++ b/sql/test/mergetables/Tests/All
@@ -35,3 +35,6 @@ concurrent_merge_tables
 mergetabledependencies
 replicatabledependencies
 merge-tables-limitations
+
+mergetable00
+mergetable01
diff --git a/sql/test/mergetables/Tests/mergetable00.test 
b/sql/test/mergetables/Tests/mergetable00.test
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/mergetable00.test
@@ -0,0 +1,99 @@
+@connection(id=1, username=monetdb, password=monetdb)
+statement ok
+CREATE MERGE TABLE parent(a int)
+
+@connection(id=2, username=monetdb, password=monetdb)
+statement ok
+CREATE TABLE child1(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child1 VALUES (1),(2)
+
+@connection(id=2)
+statement ok
+CREATE TABLE child2(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child2 VALUES (3),(4)
+
+@connection(id=2)
+statement ok
+CREATE TABLE child3(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child3 VALUES (5),(6)
+
+@connection(id=1)
+statement ok
+alter table parent add table child1
+
+@connection(id=1)
+statement ok
+alter table parent add table child3
+
+@connection(id=2)
+statement ok
+start transaction
+
+@connection(id=1)
+statement ok
+start transaction
+
+@connection(id=1)
+statement ok
+alter table parent add table child2
+
+@connection(id=2)
+statement ok
+drop table child2
+
+@connection(id=2)
+statement ok
+commit
+
+@connection(id=1)
+statement error
+commit
+
+@connection(id=1)
+query I nosort
+select * from parent
+----
+1
+2
+5
+6
+
+@connection(id=1)
+query I nosort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'parent')
+----
+2
+
+@connection(id=2)
+query I nosort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'parent')
+----
+2
+
+# cleanup
+
+@connection(id=1)
+statement ok
+drop table parent
+
+@connection(id=1)
+statement ok
+drop table child1
+
+#@connection(id=1)
+#statement ok
+#drop table child2;
+
+@connection(id=1)
+statement ok
+drop table child3
+
diff --git a/sql/test/mergetables/Tests/mergetable01.test 
b/sql/test/mergetables/Tests/mergetable01.test
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/mergetable01.test
@@ -0,0 +1,72 @@
+@connection(id=2, username=monetdb, password=monetdb)
+statement ok
+CREATE TABLE child1(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child1 VALUES (1),(2)
+
+@connection(id=2)
+statement ok
+CREATE TABLE child2(a int)
+
+@connection(id=2)
+statement ok rowcount 2
+INSERT INTO child2 VALUES (3),(4)
+
+@connection(id=3, username=monetdb, password=monetdb)
+statement ok
+start transaction
+
+@connection(id=2)
+statement ok
+start transaction
+
+@connection(id=1, username=monetdb, password=monetdb)
+statement ok
+start transaction
+
+@connection(id=1)
+statement ok
+CREATE MERGE TABLE parent(a int)
+
+@connection(id=1)
+statement ok
+alter table parent add table child1
+
+@connection(id=1)
+statement ok
+alter table parent add table child2
+
+@connection(id=2)
+statement ok
+drop table child2
+
+@connection(id=1)
+statement ok
+commit
+
+@connection(id=2)
+statement error 40001!COMMIT: transaction is aborted because of concurrency 
conflicts, will ROLLBACK instead
+commit
+
+@connection(id=1)
+query I nosort
+select count(*) from sys.objects where nr = ( select id from sys._tables where 
name = 'parent')
+----
+2
+
+# cleanup
+
+@connection(id=1)
+statement ok
+drop table parent
+
+@connection(id=1)
+statement ok
+drop table child1
+
+@connection(id=1)
+statement ok
+drop table child2
+
diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -667,10 +667,10 @@ class SQLLogic:
             if not line:
                 break
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to