You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2021/01/05 23:40:27 UTC
[impala] 01/03: IMPALA-10422: EXPLAIN statements leak ACID
transactions and locks
This is an automated email from the ASF dual-hosted git repository.
tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 03af0b2c8c4d7a9db2fbcc63b93bcb0348e4d82f
Author: Zoltan Borok-Nagy <bo...@cloudera.com>
AuthorDate: Tue Jan 5 13:00:58 2021 +0100
IMPALA-10422: EXPLAIN statements leak ACID transactions and locks
Currently EXPLAIN statements might open ACID transactions and
create locks on ACID tables.
This is not necessary since we won't modify the table. But the
real problem is that these transactions and locks are leaked and
open forever. They are even getting heartbeated while the
coordinator is still running.
The solution is to not consume any ACID resources for EXPLAIN
statements.
Testing:
* Added EXPLAIN INSERT OVERWRITE in front of an actual INSERT OVERWRITE
in an e2e test
Change-Id: I05113b1fd9a3eb2d0dd6cf723df916457f3fbf39
Reviewed-on: http://gerrit.cloudera.org:8080/16923
Reviewed-by: Csaba Ringhofer <cs...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
fe/src/main/java/org/apache/impala/service/Frontend.java | 4 ++--
.../workloads/functional-query/queries/QueryTest/acid-insert.test | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fe/src/main/java/org/apache/impala/service/Frontend.java b/fe/src/main/java/org/apache/impala/service/Frontend.java
index 3a71fdf..046295d 100644
--- a/fe/src/main/java/org/apache/impala/service/Frontend.java
+++ b/fe/src/main/java/org/apache/impala/service/Frontend.java
@@ -1639,8 +1639,8 @@ public class Frontend {
return result;
}
}
- if (analysisResult.isInsertStmt() ||
- analysisResult.isCreateTableAsSelectStmt()) {
+ if (!analysisResult.isExplainStmt() &&
+ (analysisResult.isInsertStmt() || analysisResult.isCreateTableAsSelectStmt())) {
InsertStmt insertStmt = analysisResult.getInsertStmt();
FeTable targetTable = insertStmt.getTargetTable();
if (AcidUtils.isTransactionalTable(
diff --git a/testdata/workloads/functional-query/queries/QueryTest/acid-insert.test b/testdata/workloads/functional-query/queries/QueryTest/acid-insert.test
index 8665c56..ed9a741 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/acid-insert.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/acid-insert.test
@@ -25,6 +25,9 @@ select i from insertonly_nopart order by i;
INT
====
---- QUERY
+# IMPALA-10422: Run EXPLAIN before INSERT OVERWRITE to check that
+# EXPLAIN statements don't leak transactions and locks.
+explain insert overwrite insertonly_nopart values (10);
insert overwrite insertonly_nopart values (10);
====
---- QUERY