Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9B691200C5B for ; Thu, 27 Apr 2017 19:31:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9A00D160BA7; Thu, 27 Apr 2017 17:31:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E0190160B9E for ; Thu, 27 Apr 2017 19:31:11 +0200 (CEST) Received: (qmail 23725 invoked by uid 500); 27 Apr 2017 17:31:11 -0000 Mailing-List: contact issues-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list issues@hive.apache.org Received: (qmail 23710 invoked by uid 99); 27 Apr 2017 17:31:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Apr 2017 17:31:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B77C0188BED for ; Thu, 27 Apr 2017 17:31:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id sYVi-XaXbUwa for ; Thu, 27 Apr 2017 17:31:09 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 5C7715FDF5 for ; Thu, 27 Apr 2017 17:31:07 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 30736E0DBC for ; Thu, 27 Apr 2017 17:31:06 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id E2B3321E05 for ; Thu, 27 Apr 2017 17:31:04 +0000 (UTC) Date: Thu, 27 Apr 2017 17:31:04 +0000 (UTC) From: =?utf-8?Q?Sergio_Pe=C3=B1a_=28JIRA=29?= To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-16164) Provide mechanism for passing HMS notification ID between transactional and non-transactional listeners. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 27 Apr 2017 17:31:12 -0000 [ https://issues.apache.org/jira/browse/HIVE-16164?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Sergio Pe=C3=B1a updated HIVE-16164: ------------------------------- Fix Version/s: 2.4.0 > Provide mechanism for passing HMS notification ID between transactional a= nd non-transactional listeners. > -------------------------------------------------------------------------= ------------------------------- > > Key: HIVE-16164 > URL: https://issues.apache.org/jira/browse/HIVE-16164 > Project: Hive > Issue Type: Improvement > Components: Metastore > Reporter: Sergio Pe=C3=B1a > Assignee: Sergio Pe=C3=B1a > Fix For: 2.3.0, 3.0.0, 2.4.0 > > Attachments: HIVE-16164.1.patch, HIVE-16164.2.patch, HIVE-16164.3= .patch, HIVE-16164.6.patch, HIVE-16164.7.patch, HIVE-16164.8.patch > > > The HMS DB notification listener currently stores an event ID on the HMS = backend DB so that external applications (such as backup apps) can request = incremental notifications based on the last event ID requested. > The HMS DB notification and backup applications are asynchronous. However= , there are sometimes that applications may be required to be in sync with = the latest HMS event in order to process an action. These applications will= provide a listener implementation that is called by the HMS after an HMS t= ransaction happened. > The problem is that the listener running after the transaction (or during= the non-transactional context) may need the DB event ID in order to sync a= ll events happened previous to that event ID, but this ID is never passed t= o the non-transactional listeners. > We can pass this event information through the EnvironmentContext found o= n each ListenerEvent implementations (such as CreateTableEvent), and send t= he EnvironmentContext to the non-transactional listeners to get the event I= D. > The DbNotificactionListener already knows the event ID after calling the = ObjectStore.addNotificationEvent(). We just need to set this event ID to th= e EnvironmentContext from each of the event notifications and make sure tha= t this EnvironmentContext is sent to the non-transactional listeners. > Here's the code example when creating a table on {{create_table_core}}: > {noformat} > ms.createTable(tbl); > if (transactionalListeners.size() > 0) { > CreateTableEvent createTableEvent =3D new CreateTableEvent(tbl, true,= this); > createTableEvent.setEnvironmentContext(envContext); > for (MetaStoreEventListener transactionalListener : transactionalList= eners) { > transactionalListener.onCreateTable(createTableEvent); // <= - Here the notification ID is generated > } > } > success =3D ms.commitTransaction(); > } finally { > if (!success) { > ms.rollbackTransaction(); > if (madeDir) { > wh.deleteDir(tblPath, true); > } > } > for (MetaStoreEventListener listener : listeners) { > CreateTableEvent createTableEvent =3D > new CreateTableEvent(tbl, success, this); > createTableEvent.setEnvironmentContext(envContext); > listener.onCreateTable(createTableEvent); // <= - Here we would like to consume notification ID > } > {noformat} > We could use a specific key name that will be used on the EnvironmentCont= ext, such as DB_NOTIFICATION_EVENT_ID. -- This message was sent by Atlassian JIRA (v6.3.15#6346)