Hello Quanlong Huang, Impala Public Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/17604

to look at the new patch set (#8).

Change subject: IMPALA-9763: builtin functions throw unknown exception
......................................................................

IMPALA-9763: builtin functions throw unknown exception

There is a read-write contention in FunctionName#analyze()
when a FunctionName object is shared to two threads: check if there
is a builtin function in wrong database, when 'db_' is temporarily
modified by the other thread.

This problem is caused by shallow copies. In the function
FromClause::analyze(Analyzer analyzer), if the table is FeView,
the analyzer will clone SelectStmt from the view's MetaData,
which should be a deep copy. But in the copy constructor of
FunctionCallExpr, fnName_ = other.fnName_, this is a shallow copy,
which makes the fnName_ of multiple queries refer to the same block of
memory. When the query is analyzed, the database of fnName_ will be set.
But this will change the fnName_ of other queries.

For example:

create view1 as select coalesce(col1, 2) from table1;

User A and User B check the same view1 at the same time. When
user A’s query is analyzed, it runs to db_ = analyzer.getDefaultDb() of
FunctionName::analyze. User B’s query is also analyzed and runs to
FunctionCallExpr::analyzeImpl, and just completed FunctionName::analyze;
at this time, the step of user A's db_ = analyzer.getDefaultDb() will
change the db_ attribute of user B's fnName_ to defaultDb, and then
user B will continue to check whether the function is defaultDb,
Throw an exception: coalesce() unknown for database .......

Change-Id: Ifd77f5a7cd9a674340770233fe26eb5dc26e666a
---
M fe/src/main/java/org/apache/impala/analysis/FunctionName.java
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/04/17604/8
--
To view, visit http://gerrit.cloudera.org:8080/17604
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ifd77f5a7cd9a674340770233fe26eb5dc26e666a
Gerrit-Change-Number: 17604
Gerrit-PatchSet: 8
Gerrit-Owner: liuyao <liu...@sensorsdata.cn>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <huangquanl...@gmail.com>
Gerrit-Reviewer: liuyao <liu...@sensorsdata.cn>

Reply via email to