[ 
https://issues.apache.org/jira/browse/IMPALA-8266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16785008#comment-16785008
 ] 

ASF subversion and git services commented on IMPALA-8266:
---------------------------------------------------------

Commit 60ca5f22eb0f880a1ade3a3888231ce9b2c04b1c in impala's branch 
refs/heads/master from Vihang Karajgaonkar
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=60ca5f2 ]

IMPALA-8266 : Event filtering logic may not filter all the events

This patch fixes a bug in event filtering logic. The bug shows up when
atleast one event is filtered out and then a inverse event immediately
shows up after a create_table or create_database event. For example,
consider a event stream has following sequence create_database, create_table,
drop_table, drop_database. In such a case only the first create_database
gets filtered out instead of both the create_database and create_table
event. This leads to a exception while processing create_table since the
database creation is skipped.

Testing done:
1. Adds additional cases in the existing test which generates such
sequence of events.

Change-Id: Iaeaa26017ee223cca18344e5e1d6ace87200fd9c
Reviewed-on: http://gerrit.cloudera.org:8080/12641
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Event filtering logic may not filter all the events
> ---------------------------------------------------
>
>                 Key: IMPALA-8266
>                 URL: https://issues.apache.org/jira/browse/IMPALA-8266
>             Project: IMPALA
>          Issue Type: Sub-task
>            Reporter: Vihang Karajgaonkar
>            Assignee: Vihang Karajgaonkar
>            Priority: Major
>
> Here is a the logic to filter out create events from a given batch of events. 
> {code}
> Iterator<MetastoreEvent> it = metastoreEvents.iterator();
>       // filter out the create events which has a corresponding drop event 
> later
>       int fromIndex = 0;
>       int numFilteredEvents = 0;
>       int inputSize = metastoreEvents.size();
>       while (it.hasNext()) {
>         MetastoreEvent current = it.next();
>         if (fromIndex < metastoreEvents.size() && current.isRemovedAfter(
>             metastoreEvents.subList(fromIndex + 1, metastoreEvents.size()))) {
>           LOG.info(current.debugString("Filtering out this event since the 
> object is "
>               + "either removed or renamed later in the event stream"));
>           it.remove();
>           numFilteredEvents++;
>         }
>         fromIndex++;
>       }
> {code}
> If the event list contains CREATE_DATABASE, CREATE_TABLE, DROP_TABLE, 
> DROP_DATABASE events, it is possible that we only filter out CREATE_DATABASE 
> event and not CREATE_TABLE event. This is because the {{fromIndex}} above 
> gets incremented event iteration of the {{while}} loop and hence when it is 
> evaluating if there is a inverse event later on in the stream, it starts to 
> look from DROP_DATABASE event onwards.
> The fix is simple, the fromIndex needs to be incremented only when the item 
> from the list is not removed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to