|
static void | main (String[] args) throws Exception |
|
|
static final Logger | logger = LoggerFactory.getLogger(EagainConcurrencyTest.class) |
|
|
void | run_test (HeavyDBTestClient dba, String db, String dbUser, String dbPassword, String prefix, int max) throws Exception |
|
void | runTest (String db, String dbaUser, String dbaPassword, String dbUser, String dbPassword) throws Exception |
|
Definition at line 23 of file EagainConcurrencyTest.java.
static void com.mapd.tests.EagainConcurrencyTest.main |
( |
String[] |
args | ) |
throws Exception |
|
inlinestatic |
Definition at line 26 of file EagainConcurrencyTest.java.
27 EagainConcurrencyTest test =
new EagainConcurrencyTest();
28 test.testCatalogConcurrency();
void com.mapd.tests.EagainConcurrencyTest.run_test |
( |
HeavyDBTestClient |
dba, |
|
|
String |
db, |
|
|
String |
dbUser, |
|
|
String |
dbPassword, |
|
|
String |
prefix, |
|
|
int |
max |
|
) |
| throws Exception |
|
inlineprivate |
Definition at line 31 of file EagainConcurrencyTest.java.
Referenced by com.mapd.tests.EagainConcurrencyTest.runTest().
37 String tableName =
"table_" + prefix +
"_";
38 String viewName =
"view_" + prefix +
"_";
39 long tid = Thread.currentThread().getId();
41 logger.info(
"[" + tid +
"]"
42 +
"FIRST USER CONNECT");
43 HeavyDBTestClient first_user =
44 HeavyDBTestClient.getClient(
"localhost", 6274, db, dbUser, dbPassword);
46 logger.info(
"[" + tid +
"]"
47 +
"CREATE " + tableName);
48 first_user.runSql(
"CREATE TABLE " + tableName +
" (id integer);");
50 logger.info(
"[" + tid +
"]"
51 +
"CREATE VIEW " + viewName);
53 "CREATE VIEW " + viewName +
" AS (SELECT id * 2 FROM " + tableName +
");");
55 logger.info(
"[" + tid +
"]"
56 +
"FIRST USER DISCONNECT");
57 first_user.disconnect();
59 for (
int i = 0; i < max; i++) {
60 logger.info(
"[" + tid +
"]"
62 HeavyDBTestClient user =
63 HeavyDBTestClient.getClient(
"localhost", 6274, db, dbUser, dbPassword);
65 logger.info(
"[" + tid +
"]"
66 +
"INSERT INTO " + tableName);
67 user.runSql(
"INSERT INTO " + tableName +
" VALUES (" + i +
");");
70 user.get_server_status();
71 user.get_hardware_info();
73 logger.info(
"[" + tid +
"]"
74 +
"SELECT FROM " + tableName);
75 user.runSql(
"SELECT * FROM " + tableName +
";");
77 user.get_memory(
"cpu");
78 user.get_dashboards();
82 logger.info(
"[" + tid +
"]"
87 logger.info(
"[" + tid +
"]"
88 +
"DROP " + viewName);
89 dba.runSql(
"DROP VIEW " + viewName +
";");
91 logger.info(
"[" + tid +
"]"
92 +
"DROP " + tableName);
93 dba.runSql(
"DROP TABLE " + tableName +
";");
void com.mapd.tests.EagainConcurrencyTest.runTest |
( |
String |
db, |
|
|
String |
dbaUser, |
|
|
String |
dbaPassword, |
|
|
String |
dbUser, |
|
|
String |
dbPassword |
|
) |
| throws Exception |
|
inlineprivate |
Definition at line 96 of file EagainConcurrencyTest.java.
References run, and com.mapd.tests.EagainConcurrencyTest.run_test().
Referenced by com.mapd.tests.EagainConcurrencyTest.testCatalogConcurrency().
101 Exception exceptions[] =
new Exception[num_threads];
103 ArrayList<Thread> threads =
new ArrayList<>();
104 for (
int i = 0; i < num_threads; i++) {
105 logger.info(
"Starting " + i);
106 final String prefix =
"for_bob_" + i +
"_";
107 final int threadId = i;
108 Thread t =
new Thread(
new Runnable() {
112 HeavyDBTestClient dba = HeavyDBTestClient.getClient(
113 "localhost", 6274, db, dbaUser, dbaPassword);
114 run_test(dba, db, dbUser, dbPassword, prefix, runs);
115 }
catch (Exception e) {
116 logger.error(
"[" + Thread.currentThread().getId() +
"]"
117 +
"Caught Exception: " + e.getMessage(),
119 exceptions[threadId] = e;
127 for (Thread t : threads) {
131 for (Exception e : exceptions) {
133 logger.error(
"Exception: " + e.getMessage(), e);
134 throw new Exception(e.getMessage(), e);
void run_test(HeavyDBTestClient dba, String db, String dbUser, String dbPassword, String prefix, int max)
void com.mapd.tests.EagainConcurrencyTest.testCatalogConcurrency |
( |
| ) |
throws Exception |
|
inline |
Definition at line 139 of file EagainConcurrencyTest.java.
References com.mapd.tests.EagainConcurrencyTest.runTest().
140 logger.info(
"testCatalogConcurrency()");
142 HeavyDBTestClient su = HeavyDBTestClient.getClient(
143 "localhost", 6274,
"heavyai",
"admin",
"HyperInteractive");
144 su.runSql(
"CREATE USER dba (password = 'password', is_super = 'true');");
145 su.runSql(
"CREATE USER bob (password = 'password', is_super = 'false');");
147 su.runSql(
"GRANT CREATE on DATABASE heavyai TO bob;");
148 su.runSql(
"GRANT CREATE VIEW on DATABASE heavyai TO bob;");
149 su.runSql(
"GRANT CREATE DASHBOARD on DATABASE heavyai TO bob;");
151 su.runSql(
"GRANT DROP on DATABASE heavyai TO bob;");
152 su.runSql(
"GRANT DROP VIEW on DATABASE heavyai TO bob;");
153 su.runSql(
"GRANT DELETE DASHBOARD on DATABASE heavyai TO bob;");
155 su.runSql(
"CREATE DATABASE db1;");
157 su.runSql(
"GRANT CREATE on DATABASE db1 TO bob;");
158 su.runSql(
"GRANT CREATE VIEW on DATABASE db1 TO bob;");
159 su.runSql(
"GRANT CREATE DASHBOARD on DATABASE db1 TO bob;");
161 su.runSql(
"GRANT DROP on DATABASE db1 TO bob;");
162 su.runSql(
"GRANT DROP VIEW on DATABASE db1 TO bob;");
163 su.runSql(
"GRANT DELETE DASHBOARD on DATABASE db1 TO bob;");
165 su.runSql(
"GRANT ACCESS on database heavyai TO dba;");
166 su.runSql(
"GRANT ACCESS on database heavyai TO bob;");
167 su.runSql(
"GRANT ACCESS on database db1 TO dba;");
168 su.runSql(
"GRANT ACCESS on database db1 TO bob;");
170 runTest(
"db1",
"admin",
"HyperInteractive",
"admin",
"HyperInteractive");
171 runTest(
"db1",
"admin",
"HyperInteractive",
"dba",
"password");
172 runTest(
"db1",
"admin",
"HyperInteractive",
"bob",
"password");
173 runTest(
"db1",
"dba",
"password",
"admin",
"HyperInteractive");
174 runTest(
"db1",
"dba",
"password",
"bob",
"password");
176 runTest(
"heavyai",
"admin",
"HyperInteractive",
"admin",
"HyperInteractive");
177 runTest(
"heavyai",
"admin",
"HyperInteractive",
"dba",
"password");
178 runTest(
"heavyai",
"admin",
"HyperInteractive",
"bob",
"password");
179 runTest(
"heavyai",
"dba",
"password",
"admin",
"HyperInteractive");
180 runTest(
"heavyai",
"dba",
"password",
"bob",
"password");
182 su.runSql(
"DROP DATABASE db1;");
183 su.runSql(
"DROP USER bob;");
184 su.runSql(
"DROP USER dba;");
186 logger.info(
"testCatalogConcurrency() done");
void runTest(String db, String dbaUser, String dbaPassword, String dbUser, String dbPassword)
final Logger com.mapd.tests.EagainConcurrencyTest.logger = LoggerFactory.getLogger(EagainConcurrencyTest.class) |
|
staticpackage |
The documentation for this class was generated from the following file: