|
static void | main (String[] args) throws Exception |
|
|
static final Logger | logger = LoggerFactory.getLogger(ReductionConcurrencyTest.class) |
|
static final String[] | text_values |
|
|
void | runTest (String db, String dbaUser, String dbaPassword, String dbUser, String dbPassword, int numRows, int fragmentSize) throws Exception |
|
static void com.mapd.tests.ReductionConcurrencyTest.main |
( |
String[] |
args | ) |
throws Exception |
|
inlinestatic |
void com.mapd.tests.ReductionConcurrencyTest.runTest |
( |
String |
db, |
|
|
String |
dbaUser, |
|
|
String |
dbaPassword, |
|
|
String |
dbUser, |
|
|
String |
dbPassword, |
|
|
int |
numRows, |
|
|
int |
fragmentSize |
|
) |
| throws Exception |
|
inlineprivate |
Definition at line 53 of file ReductionConcurrencyTest.java.
References run, and com.mapd.tests.ReductionConcurrencyTest.text_values.
Referenced by com.mapd.tests.ReductionConcurrencyTest.testConcurrency().
62 Exception exceptions[] =
new Exception[num_threads];
64 ArrayList<Thread> threads =
new ArrayList<>();
65 for (
int i = 0; i < num_threads; i++) {
66 logger.info(
"Starting " + i);
67 final int threadId = i;
69 Thread t =
new Thread(
new Runnable() {
72 long tid = Thread.currentThread().getId();
73 String logPrefix =
"[" + tid +
"]";
76 for (
int runId = 0; runId < runs; runId++) {
77 final String tableName = dbaUser +
"_" + threadId +
"_" + runId;
80 HeavyDBTestClient user = HeavyDBTestClient.getClient(
81 "localhost", 6274, db, dbUser, dbPassword);
82 user.runSql(
"DROP TABLE IF EXISTS " + tableName +
";");
83 user.runSql(
"CREATE TABLE " + tableName
84 +
"(x BIGINT, y INTEGER, z SMALLINT, a TINYINT, f FLOAT, d DOUBLE, deci DECIMAL(18,6), str TEXT ENCODING NONE) WITH (FRAGMENT_SIZE = "
85 + fragmentSize +
")");
87 for (
int i = 0; i < numRows; i++) {
88 final String integer_val = Integer.toString(i);
89 final String small_val = Integer.toString(i % 128);
90 final String fp_val = Double.toString(i * 1.1);
91 final String deci_val = Double.toString(i + 0.01);
92 final String str_val =
"'" +
text_values[i % text_values.length] +
"'";
93 final String values_string = String.join(
" , ",
102 user.runSql(
"INSERT INTO " + tableName +
" VALUES "
103 +
"(" + values_string +
")");
106 Random rand =
new Random(tid);
108 sql =
"SELECT * FROM " + tableName +
" LIMIT 2;";
109 logger.info(logPrefix +
" " + sql);
112 sql =
"SELECT x, sum(1) FROM " + tableName +
" GROUP BY 1;";
113 logger.info(logPrefix +
" " + sql);
116 sql =
"SELECT x, y, sum(1) FROM " + tableName +
" GROUP BY 1, 2;";
117 logger.info(logPrefix +
" " + sql);
120 sql =
"SELECT x, y, z, sum(1) FROM " + tableName +
" GROUP BY 1, 2, 3;";
121 logger.info(logPrefix +
" " + sql);
124 sql =
"SELECT x, y, avg(z), sum(1) FROM " + tableName +
" GROUP BY 1, 2;";
125 logger.info(logPrefix +
" " + sql);
128 sql =
"SELECT x, y, max(z), sum(1) FROM " + tableName +
" GROUP BY 1, 2;";
129 logger.info(logPrefix +
" " + sql);
132 sql =
"SELECT x, y, min(z), sum(1) FROM " + tableName +
" GROUP BY 1, 2;";
133 logger.info(logPrefix +
" " + sql);
136 sql =
"SELECT * FROM " + tableName +
" WHERE str = '"
137 +
text_values[rand.nextInt(text_values.length)] +
"';";
138 logger.info(logPrefix +
" " + sql);
141 }
catch (Exception e) {
142 logger.error(logPrefix +
" Caught Exception: " + e.getMessage(), e);
143 exceptions[threadId] = e;
152 for (Thread t : threads) {
156 for (Exception e : exceptions) {
158 logger.error(
"Exception: " + e.getMessage(), e);
static final String[] text_values
void com.mapd.tests.ReductionConcurrencyTest.testConcurrency |
( |
| ) |
throws Exception |
|
inline |
Definition at line 164 of file ReductionConcurrencyTest.java.
References com.mapd.tests.ReductionConcurrencyTest.runTest().
165 logger.info(
"ReductionConcurrencyTest()");
167 HeavyDBTestClient su = HeavyDBTestClient.getClient(
168 "localhost", 6274,
"heavyai",
"admin",
"HyperInteractive");
169 su.runSql(
"DROP USER IF EXISTS dba;");
170 su.runSql(
"DROP USER IF EXISTS bob;");
171 su.runSql(
"CREATE USER dba (password = 'password', is_super = 'true');");
172 su.runSql(
"CREATE USER bob (password = 'password', is_super = 'false');");
174 su.runSql(
"GRANT CREATE on DATABASE heavyai TO bob;");
176 su.runSql(
"DROP DATABASE IF EXISTS db1;");
177 su.runSql(
"CREATE DATABASE db1;");
179 su.runSql(
"GRANT CREATE on DATABASE db1 TO bob;");
180 su.runSql(
"GRANT CREATE VIEW on DATABASE db1 TO bob;");
181 su.runSql(
"GRANT DROP on DATABASE db1 TO bob;");
182 su.runSql(
"GRANT DROP VIEW on DATABASE db1 TO bob;");
185 for (
int i = 0; i < 3; ++i) {
187 runTest(
"db1",
"admin",
"HyperInteractive",
"admin",
"HyperInteractive", 10, 3);
189 runTest(
"db1",
"admin",
"HyperInteractive",
"admin",
"HyperInteractive", 30, 3);
192 su.runSql(
"DROP DATABASE db1;");
193 su.runSql(
"DROP USER bob;");
194 su.runSql(
"DROP USER dba;");
196 logger.info(
"ReductionConcurrencyTest() done");
void runTest(String db, String dbaUser, String dbaPassword, String dbUser, String dbPassword, int numRows, int fragmentSize)
final Logger com.mapd.tests.ReductionConcurrencyTest.logger = LoggerFactory.getLogger(ReductionConcurrencyTest.class) |
|
staticpackage |
final String [] com.mapd.tests.ReductionConcurrencyTest.text_values |
|
staticpackage |
Initial value:= {"foo",
"bar",
"hello",
"world",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p"}
Definition at line 27 of file ReductionConcurrencyTest.java.
Referenced by com.mapd.tests.ReductionConcurrencyTest.runTest().
The documentation for this class was generated from the following file: