Hello Riza Suminto, Kurt Deschler, Jason Fehr, k.venureddy2...@gmail.com, Sai 
Hemanth Gantasala, Csaba Ringhofer, Impala Public Jenkins,

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

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

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

Change subject: IMPALA-13684: Improve waitForHmsEvent() to only wait for 
related events
......................................................................

IMPALA-13684: Improve waitForHmsEvent() to only wait for related events

waitForHmsEvent is a catalogd RPC for coordinators to send a requested
db/table names to catalogd and wait until it's safe (i.e. no stale
metadata) to start analyzing the statement. The wait time is configured
by query option sync_hms_events_wait_time_s. Currently, when this option
is enabled, catalogd waits until it syncs to the latest HMS event
regardless what the query is.

This patch reduces waiting by only checking related events and wait
until the last related event has been processed. In the ideal case, if
there are no pending events that are related, the query doesn't need to
wait.

Related pending events are determined as follows:
 - For queries that need the db list, i.e. SHOW DATABASES, check pending
   CREATE/ALTER/DROP_DATABASE events on all dbs. ALTER_DATABASE events
   are checked in case the ownership changes and impacts visibility.
 - For db statements like SHOW FUNCTIONS, CREATE/ALTER/DROP DATABASE,
   check pending CREATE/ALTER/DROP events on that db.
   - For db statements that require the table list, i.e. SHOW TABLES,
     also check CREATE_TABLE, DROP_TABLE events under that db.
 - For table statements,
   - check all database events on related db names.
   - If there are loaded transactional tables, check all the pending
     COMMIT_TXN, ABORT_TXN events. Note that these events might modify
     multiple transactional tables and we don't know their table names
     until they are processed. To be safe, wait for all transactional
     events.
   - For all the other table names,
     - if they are all missing/unloaded in the catalog, check all the
       pending CREATE_TABLE, DROP_TABLE events on them for their
       existence.
     - Otherwise, some of them are loaded, check all the table events on
       them. Note that we can fetch events on multiple tables under the
       same db in a single fetch.

If the statement has a SELECT part, views will be expanded so underlying
tables will be checked as well. For performance, this feature assumes
that views won't be changed to tables, and vice versa. This is a rare
use case in regular jobs. Users should use INVALIDATE for such case.

This patch leverages the HMS API to fetch events of several tables under
the same db in batch. MetastoreEventsProcessor.MetaDataFilter is
improved for this.

TODO: refactor some long methods

Tests:
 - Added test for multiple tables in a single query.
 - Added test with views.
 - Added test for transactional tables.
 - Ran CORE tests.

Change-Id: Ic033b7e197cd19505653c3ff80c4857cc474bcfc
---
M common/thrift/CatalogService.thrift
M fe/src/compat-apache-hive-3/java/org/apache/impala/compat/MetastoreShim.java
M fe/src/compat-hive-3/java/org/apache/impala/compat/MetastoreShim.java
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/events/MetastoreEvents.java
M 
fe/src/main/java/org/apache/impala/catalog/events/MetastoreEventsProcessor.java
M fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java
M fe/src/main/java/org/apache/impala/service/Frontend.java
M tests/custom_cluster/test_events_custom_configs.py
M tests/metadata/test_event_processing.py
10 files changed, 593 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/71/22571/11
--
To view, visit http://gerrit.cloudera.org:8080/22571
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic033b7e197cd19505653c3ff80c4857cc474bcfc
Gerrit-Change-Number: 22571
Gerrit-PatchSet: 11
Gerrit-Owner: Quanlong Huang <huangquanl...@gmail.com>
Gerrit-Reviewer: Anonymous Coward <k.venureddy2...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <csringho...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Gerrit-Reviewer: Jason Fehr <jf...@cloudera.com>
Gerrit-Reviewer: Kurt Deschler <kdesc...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <huangquanl...@gmail.com>
Gerrit-Reviewer: Riza Suminto <riza.sumi...@cloudera.com>
Gerrit-Reviewer: Sai Hemanth Gantasala <saihema...@cloudera.com>

Reply via email to