mirror of
https://github.com/apache/impala.git
synced 2026-01-28 18:00:14 -05:00
Kudu added multi-row transaction so Impala could run query that inserts multiple rows into Kudu's table in the context of a single transaction. Kudu provides new Java/C++ client APIs to open/commit/rollback transaction, create session with transaction, serialize/deserialize metadata of transaction object. Kudu transaction object has built-in heartbeater. This patch added Impala support to use Kudu's multiple-row transaction. - Added a new query option to enable Kudu's transaction. - When the query option is set, a new Kudu transaction should be started for "insert", "CTAS" and "UPDATE/UPSERT/DELETE" statements by Impala's frontend of coordinator. - The Kudu transaction objects are kept in KuduTransactionManager until the transactions are going to be aborted or committed. - Frontend serialize the transaction metadata into a transaction token and pass to executors. - Executors deserialize the transaction token and ingest via that transaction handle. For Kudu session in the context of a transaction, return the first error if there are any pending errors for the Kudu session so that the Kudu transaction will be aborted. Since Kudu does not support transaction for "UPDATE/UPSERT/DELETE" statements now, Kudu returns error which causes transaction to be aborted. - Coordinator commits the transaction if everything goes well. Otherwise, aborts the transaction. Also changed code to store KuduClient as shared pointer since KuduClient has to be passed as a shared pointer when KuduTransaction::Deserialize() is called. Testing: - Added new e-to-e tests for Kudu transaction. - Passed core test. Change-Id: I876ada48991afdff5d61b5d6a0417571aba7cb34 Reviewed-on: http://gerrit.cloudera.org:8080/17553 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>