Changeset: a3e764eb89e1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a3e764eb89e1
Added Files:
        sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.SQL.py
        sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.stable.err
        sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.stable.out
Branch: Jul2015
Log Message:

Added test for bug 3826.
Not enabled yet, since it usually causes the server to crash.


diffs (97 lines):

diff --git a/sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.SQL.py 
b/sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.SQL.py
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.SQL.py
@@ -0,0 +1,80 @@
+import monetdb.sql, time, threading, os
+
+def monetSchema(tbl, host = os.getenv('MAPIHOST', 'localhost'),
+                port = int(os.getenv('MAPIPORT', '50000')),
+                database = os.getenv('TSTDB', 'demo'),
+                username = 'monetdb', password = 'monetdb'):
+    dbh = monetdb.sql.Connection(hostname = host, port = port,
+                                 database = database, username = username,
+                                 password = password, autocommit = True)
+    cursor = dbh.cursor();
+    drop = 'drop table %s' % tbl
+    create = 'create table %s (' \
+             'p01000 char(4) not null, ' \
+             'p01001 CHAR(2) NOT NULL, ' \
+             'p01002 CHAR(2) NOT NULL, ' \
+             'p01003 CHAR(2) NOT NULL, ' \
+             'p01004 CHAR(8) NOT NULL, ' \
+             'p01005 CHAR(8) NOT NULL, ' \
+             'p01006 CHAR(1) NOT NULL, ' \
+             'p01007 CHAR(1) NOT NULL, ' \
+             'p01008 CHAR(8) NOT NULL, ' \
+             'p01009 CHAR(8) NOT NULL, ' \
+             'p01010 CHAR(8) NOT NULL, ' \
+             'p01011 CHAR(8) NOT NULL, ' \
+             'p01012 CHAR(6) NOT NULL, ' \
+             'p01013 CHAR(7) NOT NULL, ' \
+             'p01014 CHAR(2) NOT NULL, ' \
+             'p01015 CHAR(3) NOT NULL, ' \
+             'p01016 CHAR(8) NOT NULL, ' \
+             'p01017 CHAR(10) NOT NULL, ' \
+             'p01018 CHAR(3) NOT NULL, ' \
+             'p01019 DECIMAL(11,3) NOT NULL)' % tbl
+    for i in range(1000):
+        for j in range(100):
+            try:
+                cursor.execute(drop)
+            except monetdb.exceptions.OperationalError as e1:
+                if 'no such table' in e1.args[0]:
+                    break
+            except monetdb.exceptions.ProgrammingError as e2:
+                pass
+            else:
+                break
+            time.sleep(0.5)
+        for j in range(100):
+            try:
+                cursor.execute(create)
+            except monetdb.exceptions.OperationalError as e1:
+                if 'already in use' in e1.args[0]:
+                    break
+            except monetdb.exceptions.ProgrammingError as e2:
+                pass
+            else:
+                break
+            time.sleep(0.5)
+
+class Client(threading.Thread):
+    def __init__(self, tbl, host = os.getenv('MAPIHOST', 'localhost'),
+                 port = int(os.getenv('MAPIPORT', '50000')),
+                 database = os.getenv('TSTDB', 'demo'),
+                 username = 'monetdb', password = 'monetdb'):
+        self.__tbl = tbl
+        self.__host = host
+        self.__port = port
+        self.__database = database
+        self.__username = username
+        self.__password = password
+        threading.Thread.__init__(self)
+
+    def run(self):
+        monetSchema(self.__tbl, host = self.__host, port = self.__port,
+                    database = self.__database, username = self.__username,
+                    password = self.__password)
+
+c1 = Client('sys.table301')
+c2 = Client('sys.table302')
+c1.start()
+c2.start()
+c1.join()
+c2.join()
diff --git 
a/sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.stable.err 
b/sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.stable.err
@@ -0,0 +1,1 @@
+should not crash
diff --git 
a/sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.stable.out 
b/sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2015/Tests/concurrent-schema.Bug-3826.stable.out
@@ -0,0 +1,1 @@
+should not crash
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to