The test uses a thread pool of 3 slots to run 3 concurrent CreateTable
statements. Each thread creates a client and closes it at the end of the
task(run_create_table_if_not_exists). The first 2 thread tasks start at
the same time. Then after one second, the 3rd thread task starts.
Ideally the 3 tasks should be executed in 3 different threads of the
thread pool. However, if any of the first 2 tasks finish in 1s, the 3rd
task could be executed by reusing the thread. Since the client in the
thread is closed, the task fails.
This patch removes the close operation at the end of the task.
Connection of the thread can be reused and will be closed when the
thread terminates.
Also fix the same problem in test_concurrent_ddls.py.
Tests:
- Run test_concurrent_ddls.py and test_concurrent_kudu_create.py. In
the logs of impalad, observe that connections are being reused and
closed at the end of the tests.
Change-Id: Idefba98ecd65efbd47b1618291330795ef13b910
Reviewed-on: http://gerrit.cloudera.org:8080/15151
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This patch fixes the race condition when using 'CREATE IF NOT EXISTS'
to create the same managed kudu table in parallel. Note that it won't
happend if Kudu-HMS integration is enable. The bug would cause the
table being deleted in Kudu but reserving in HMS.
The solution is adding check for HMS table existence before creating
it in HMS and after obtaining 'metastoreDdlLock_'. If the HMS table is
created by other concurrent threads, just return as
'Table already exists'. So we don't fail in creating the HMS table and
won't rollback the creation of kudu table.
Tests:
* Add custom cluster test test_concurrent_kudu_create.py
* Ran all front-end tests
Change-Id: I1a4047bcdaa6b346765b96e8c36bb747a2b0091d
Reviewed-on: http://gerrit.cloudera.org:8080/14319
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>