65 List<ThreadDbDumpRestoreQueries> queriesPerThread =
66 new ArrayList<ThreadDbDumpRestoreQueries>(Arrays.asList(
67 new ThreadDbDumpRestoreQueries(
69 new ThreadDbDumpRestoreQueries(
71 new ThreadDbDumpRestoreQueries(
73 new ThreadDbDumpRestoreQueries(
75 new ThreadDbDumpRestoreQueries(
78 final int num_threads = queriesPerThread.size();
79 Exception[] exceptions =
new Exception[num_threads];
80 Thread[] threads =
new Thread[num_threads];
85 final CyclicBarrier barrier =
new CyclicBarrier(
86 num_threads, () -> { logger.info(
"Barrier acquired. Starting queries..."); });
88 for (
int i = 0; i < queriesPerThread.size(); i++) {
89 final ThreadDbDumpRestoreQueries threadQueries = queriesPerThread.get(i);
90 final int threadId = i;
91 threads[threadId] =
new Thread(() -> {
93 logger.info(
"Starting thread[" + threadId +
"]");
94 HeavyDBTestClient user = HeavyDBTestClient.getClient(
95 "localhost", 6274,
"heavyai",
"admin",
"HyperInteractive");
98 for (
final String query : threadQueries.queries) {
101 logger.info(
"Finished thread[" + threadId +
"]");
102 }
catch (Exception e) {
103 logger.error(
"Thread[" + threadId +
"] Caught Exception: " + e.getMessage(), e);
104 exceptions[threadId] = e;
107 threads[threadId].start();
110 for (Thread t : threads) {
115 for (
int i = 0; i < queriesPerThread.size(); i++) {
116 final ThreadDbDumpRestoreQueries threadQueries = queriesPerThread.get(i);
120 for (Exception e : exceptions) {
122 logger.error(
"Exception: " + e.getMessage(), e);
List< String > getDumpRestoreQueries(String table_identifier)
static String tar_ball_path_prefix
void runSqlAsUser(String sql, HeavyDBTestClient user, int threadId)
void deleteFileIfExist(String file)