67 ArrayList<Exception> exceptions =
new ArrayList<Exception>();
69 Thread[] foreign_table_manual_refresh_threads =
70 new Thread[num_foreign_manual_refresh_threads];
71 Thread[] foreign_table_scheduled_refresh_threads =
72 new Thread[num_foreign_scheduled_refresh_threads];
73 Thread[] table_join_threads =
new Thread[num_table_join_threads];
75 for (
int i = 0; i < num_foreign_manual_refresh_threads; ++i) {
77 foreign_table_manual_refresh_threads[tid] =
new Thread(
new Runnable() {
80 final String thread_name =
"F[" + tid +
"]";
82 logger.info(
"Starting manual foreign table refresh thread " + thread_name);
83 HeavyDBTestClient user = HeavyDBTestClient.getClient(
84 "localhost", 6274, db, userName, userPassword);
85 for (
int irun = 0; irun < num_runs; ++irun) {
86 runSqlAsUser(
"SELECT * FROM test_foreign_table_manual_refresh_" + tid +
";",
89 runSqlAsUser(
"REFRESH FOREIGN TABLES test_foreign_table_manual_refresh_"
94 logger.info(
"Finished foreign table manual refresh " + thread_name);
95 }
catch (Exception e) {
96 logger.error(
"Foreign table refresh " + thread_name
97 +
" Caught Exception: " + e.getMessage(),
103 foreign_table_manual_refresh_threads[tid].start();
106 for (
int i = 0; i < num_foreign_scheduled_refresh_threads; ++i) {
108 foreign_table_scheduled_refresh_threads[tid] =
new Thread(
new Runnable() {
111 final String thread_name =
"S[" + tid +
"]";
113 logger.info(
"Starting scheduled foreign table refresh thread " + thread_name);
114 HeavyDBTestClient user = HeavyDBTestClient.getClient(
115 "localhost", 6274, db, userName, userPassword);
116 for (
int irun = 0; irun < num_runs; ++irun) {
118 "SELECT * FROM test_foreign_table_scheduled_refresh_" + tid +
";",
124 logger.info(
"Finished foreign table scheduled refresh " + thread_name);
125 }
catch (Exception e) {
126 logger.error(
"Foreign table scheduled refresh " + thread_name
127 +
" Caught Exception: " + e.getMessage(),
133 foreign_table_scheduled_refresh_threads[tid].start();
136 for (
int i = 0; i < num_table_join_threads; ++i) {
138 table_join_threads[tid] =
new Thread(
new Runnable() {
141 final String thread_name =
"T[" + tid +
"]";
143 logger.info(
"Starting table join " + thread_name);
144 HeavyDBTestClient user = HeavyDBTestClient.getClient(
145 "localhost", 6274, db, userName, userPassword);
146 for (
int irun = 0; irun < num_runs; ++irun) {
148 +
"_left AS l JOIN test_table_" + tid
149 +
"_right AS r ON l.id = r.id;",
156 logger.info(
"Finished table join thread T[" + tid +
"]");
157 }
catch (Exception e) {
160 "Table join " + thread_name +
" Caught Exception: " + e.getMessage(),
166 table_join_threads[tid].start();
169 for (Thread t : foreign_table_manual_refresh_threads) {
172 for (Thread t : foreign_table_scheduled_refresh_threads) {
175 for (Thread t : table_join_threads) {
179 for (Exception e : exceptions) {
181 logger.error(
"Exception: " + e.getMessage(), e);
void runSqlAsUser(String sql, HeavyDBTestClient user, String logPrefix)