You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sentry.apache.org by "kalyan kumar kalvagadda (JIRA)" <ji...@apache.org> on 2017/04/28 15:08:04 UTC

[jira] [Comment Edited] (SENTRY-1726) sql changes to store last notification-id processed

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

kalyan kumar kalvagadda edited comment on SENTRY-1726 at 4/28/17 3:07 PM:
--------------------------------------------------------------------------

*Approach:*

Adding new table to store notification-id. HMS follower just needs the the latest notification-id that sentry has processed.
All HMS follower needs is the latest notification. As we need not store older notification-id's, I defined the table to hold only one record so that we can avoid inserting more records in the table and the application should just update the existing record. 

{noformat}
CREATE TABLE `SENTRY_LAST_NOTIFICATION_ID`
(
    `NOTIFICATION_ID` BIGINT NOT NULL,
    `RESTRICTION` VARCHAR(15) NOT NULL DEFAULT 'singleton',
    CONSTRAINT `SENTRY_NOTIFICATION_PK` PRIMARY KEY (`RESTRICTION`)
)ENGINE=INNODB;
{noformat}
Application just needs to insert/update the NOTIFICATION_ID. Once we insert for the fist time, it is update only.
On the other hand, If we have NOTIFICATION_ID as primary key and keep on inserting NOTIFICATION_ID's into
 the table. we have to use MAX(NOTIFICATION_ID) every time we need the notification id. Additionally, we need to build logic to cleanup older entries.



was (Author: kkalyan):
*Approach:*
Adding new table to store notification-id. HMS follower just needs the the latest notification-id that sentry has processed.
All HMS follower needs is the latest notification. As we need not store older notification-id's, I defined the table to hold only one record so that we can avoid inserting more records in the table and the application should just update the existing record. 

{noformat}
CREATE TABLE `SENTRY_LAST_NOTIFICATION_ID`
(
    `NOTIFICATION_ID` BIGINT NOT NULL,
    `RESTRICTION` VARCHAR(15) NOT NULL DEFAULT 'singleton',
    CONSTRAINT `SENTRY_NOTIFICATION_PK` PRIMARY KEY (`RESTRICTION`)
)ENGINE=INNODB;
{noformat}
Application just needs to insert/update the NOTIFICATION_ID. Once we insert for the fist time, it is update only.
On the other hand, If we have NOTIFICATION_ID as primary key and keep on inserting NOTIFICATION_ID's into
 the table. we have to use MAX(NOTIFICATION_ID) every time we need the notification id. Additionally, we need to build logic to cleanup older entries.


> sql changes to store last notification-id processed
> ---------------------------------------------------
>
>                 Key: SENTRY-1726
>                 URL: https://issues.apache.org/jira/browse/SENTRY-1726
>             Project: Sentry
>          Issue Type: Improvement
>          Components: Sentry
>    Affects Versions: sentry-ha-redesign
>            Reporter: kalyan kumar kalvagadda
>            Assignee: kalyan kumar kalvagadda
>             Fix For: sentry-ha-redesign
>
>         Attachments: SENTRY-1726.001-sentry-ha-redesign.patch, SENTRY-1726.002-sentry-ha-redesign.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)