提交 c4418a60 authored 作者: Thomas Mueller's avatar Thomas Mueller

Multi-threaded MVCC

上级 cad52357
...@@ -255,9 +255,9 @@ public abstract class Command implements CommandInterface { ...@@ -255,9 +255,9 @@ public abstract class Command implements CommandInterface {
try { try {
Database database = session.getDatabase(); Database database = session.getDatabase();
if (database.isMultiThreaded()) { if (database.isMultiThreaded()) {
Thread.sleep(10); Thread.sleep(1);
} else { } else {
database.wait(10); database.wait(1);
} }
} catch (InterruptedException e1) { } catch (InterruptedException e1) {
// ignore // ignore
......
...@@ -36,7 +36,7 @@ public class CopyOfTestMvccMultiThreaded extends TestBase { ...@@ -36,7 +36,7 @@ public class CopyOfTestMvccMultiThreaded extends TestBase {
int test; int test;
if (config.big && !config.networked) if (config.big && !config.networked)
for(int i=0; ; i++) { for(int i=0; ; i++) {
System.out.println("i: " + i); System.out.println("--------------- i: " + i);
testConcurrentMerge(); testConcurrentMerge();
} }
// testConcurrentUpdate(""); // testConcurrentUpdate("");
...@@ -49,13 +49,13 @@ public class CopyOfTestMvccMultiThreaded extends TestBase { ...@@ -49,13 +49,13 @@ public class CopyOfTestMvccMultiThreaded extends TestBase {
int len = 3; int len = 3;
final Connection[] connList = new Connection[len]; final Connection[] connList = new Connection[len];
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
Connection conn = getConnection("mvccMultiThreadedMerge;MVCC=TRUE;LOCK_TIMEOUT=1000"); Connection conn = getConnection("mvccMultiThreadedMerge;MVCC=TRUE;LOCK_TIMEOUT=1000;MAX_OPERATION_MEMORY=1000");
connList[i] = conn; connList[i] = conn;
} }
Connection conn = connList[0]; Connection conn = connList[0];
conn.createStatement().execute("create table test(id int primary key, name varchar)"); conn.createStatement().execute("create table test(id int primary key, name varchar)");
Task[] tasks = new Task[len]; Task[] tasks = new Task[len];
//final StringBuffer buff = new StringBuffer(); final StringBuffer buff = new StringBuffer();
final long startThread = System.currentTimeMillis(); final long startThread = System.currentTimeMillis();
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
final int x = i; final int x = i;
...@@ -66,7 +66,7 @@ final int x = i; ...@@ -66,7 +66,7 @@ final int x = i;
while (!stop) { while (!stop) {
c.createStatement().execute("merge into test values(1, 'x')"); c.createStatement().execute("merge into test values(1, 'x')");
c.commit(); c.commit();
// buff.append((System.currentTimeMillis() - startThread) + ": " + x + "\n"); buff.append((System.currentTimeMillis() - startThread) + ": " + x + "\n");
//if (System.currentTimeMillis() - startThread > 3000) { //if (System.currentTimeMillis() - startThread > 3000) {
// System.out.println(x); // System.out.println(x);
//} //}
...@@ -82,7 +82,7 @@ try{ ...@@ -82,7 +82,7 @@ try{
tasks[i].get(); tasks[i].get();
} }
}catch(Exception e) { }catch(Exception e) {
// System.out.println(buff); System.out.println(buff);
System.out.println(e.toString()); System.out.println(e.toString());
// e.printStackTrace(System.out); // e.printStackTrace(System.out);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论