Changeset: e7c1f604cb2c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e7c1f604cb2c
Added Files:
        sql/test/concurrent/Tests/segments-corruption.py
Branch: Jan2022
Log Message:

Add initial reproduction script for segment corruption.


diffs (48 lines):

diff --git a/sql/test/concurrent/Tests/segments-corruption.py 
b/sql/test/concurrent/Tests/segments-corruption.py
new file mode 100644
--- /dev/null
+++ b/sql/test/concurrent/Tests/segments-corruption.py
@@ -0,0 +1,43 @@
+import pyodbc
+import time
+from multiprocessing import Pool
+import random
+
+CONN_STR = 
'DRIVER={/libMonetODBC.so};HOST=localhost;PORT=50000;DATABASE=devdb;UID=monetdb;PWD=monetdb'
+QUERIES = [
+    "select * from test limit 1",
+    "insert into test values (0, 0, 0, 0, 0)",
+]
+DURATION = 30
+CLIENTS = 16
+
+def run(_):
+    commits = 0
+    errors = 0
+    conn = pyodbc.connect(CONN_STR)
+    conn.autocommit = True
+    cursor = conn.cursor()
+    cursor.execute("set optimizer = 'default_fast'")
+
+    begin = time.time()
+    while time.time() - begin < DURATION:
+        try:
+            cursor.execute(QUERIES[random.randint(0, len(QUERIES)-1)])
+        except:
+            print('error')
+            errors += 1
+        commits += 1
+
+    return commits, errors
+
+conn = pyodbc.connect(CONN_STR)
+conn.autocommit = True
+cursor = conn.cursor()
+cursor.execute('create table if not exists test (c1 int, c2 int, c3 int, c4 
int, c5 int)')
+
+pool = Pool(CLIENTS)
+results = pool.map(run, [None for _ in range(CLIENTS)])
+total = sum([x[0] for x in results])
+errors = sum([x[1] for x in results])
+print(f'{round(total / DURATION, 2)} tx/s')
+print(errors)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to