OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mapd.tests.CalciteViewsConcurrencyTest Class Reference
+ Collaboration diagram for com.mapd.tests.CalciteViewsConcurrencyTest:

Public Member Functions

void testViewsResolutionConcurrency () throws Exception
 

Static Public Member Functions

static void main (String[] args) throws Exception
 

Static Package Attributes

static final Logger logger = LoggerFactory.getLogger(CalciteViewsConcurrencyTest.class)
 

Detailed Description

Definition at line 26 of file CalciteViewsConcurrencyTest.java.

Member Function Documentation

static void com.mapd.tests.CalciteViewsConcurrencyTest.main ( String[]  args) throws Exception
inlinestatic

Definition at line 29 of file CalciteViewsConcurrencyTest.java.

29  {
30  CalciteViewsConcurrencyTest test = new CalciteViewsConcurrencyTest();
31  test.testViewsResolutionConcurrency();
32  }
void com.mapd.tests.CalciteViewsConcurrencyTest.testViewsResolutionConcurrency ( ) throws Exception
inline

Definition at line 34 of file CalciteViewsConcurrencyTest.java.

References run.

34  {
35  logger.info("testViewsResolutionConcurrency()");
36 
37  HeavyDBTestClient su = HeavyDBTestClient.getClient(
38  "localhost", 6274, "heavyai", "admin", "HyperInteractive");
39 
40  su.runSql("CREATE DATABASE db1;");
41  su.runSql("CREATE DATABASE db2;");
42 
43  HeavyDBTestClient db1 = HeavyDBTestClient.getClient(
44  "localhost", 6274, "db1", "admin", "HyperInteractive");
45  db1.runSql("create table table1 (id integer, description varchar(30));");
46  db1.runSql("create table table2 (id integer, description varchar(30));");
47  db1.runSql("insert into table1 values (1, 'hello');");
48  db1.runSql("insert into table2 values (1, 'db1');");
49  db1.runSql(
50  "create view v_goodview as select t1.id, t1.description, t2.description as tbl2Desc from db1.table1 t1, db1.table2 t2;");
51 
52  HeavyDBTestClient db2 = HeavyDBTestClient.getClient(
53  "localhost", 6274, "db2", "admin", "HyperInteractive");
54  db2.runSql("create table table1 (id integer, description varchar(30));");
55  db2.runSql("create table table2 (id integer, description varchar(30));");
56  db2.runSql("insert into table1 values (1, 'hello');");
57  db2.runSql("insert into table2 values (1, 'db2');");
58  db2.runSql(
59  "create view v_goodview as select t1.id, t1.description, t2.description as tbl2Desc from db2.table1 t1, db2.table2 t2;");
60 
61  int num_threads = 10;
62  Exception exceptions[] = new Exception[num_threads];
63  List<Thread> threads = new ArrayList<>();
64  for (int i = 0; i < num_threads; i++) {
65  final int threadId = i;
66  HeavyDBTestClient con1 = HeavyDBTestClient.getClient(
67  "localhost", 6274, "db1", "admin", "HyperInteractive");
68  HeavyDBTestClient con2 = HeavyDBTestClient.getClient(
69  "localhost", 6274, "db2", "admin", "HyperInteractive");
70  Thread t = new Thread(new Runnable() {
71  @Override
72  public void run() {
73  try {
74  for (int i = 0; i < 25; i++) {
75  con1.runSql("SELECT * FROM v_goodview;");
76  con2.runSql("SELECT * FROM v_goodview;");
77  }
78  } catch (Exception e) {
79  e.printStackTrace();
80  exceptions[threadId] = e;
81  }
82  }
83  });
84 
85  t.start();
86  threads.add(t);
87  }
88 
89  for (Thread t : threads) {
90  t.join();
91  }
92 
93  su.runSql("DROP DATABASE db1;");
94  su.runSql("DROP DATABASE db2;");
95 
96  for (Exception e : exceptions) {
97  if (null != e) {
98  throw e;
99  }
100  }
101  }
static bool run

Member Data Documentation

final Logger com.mapd.tests.CalciteViewsConcurrencyTest.logger = LoggerFactory.getLogger(CalciteViewsConcurrencyTest.class)
staticpackage

Definition at line 27 of file CalciteViewsConcurrencyTest.java.


The documentation for this class was generated from the following file: