public class DbNotificationListener extends TransactionalMetaStoreEventListener
MetaStoreEventListener
that
stores events in the database.
Design overview: This listener takes any event, builds a NotificationEventResponse,
and puts it on a queue. There is a dedicated thread that reads entries from the queue and
places them in the database. The reason for doing it in a separate thread is that we want to
avoid slowing down other metadata operations with the work of putting the notification into
the database. Also, occasionally the thread needs to clean the database of old records. We
definitely don't want to do that as part of another metadata operation.Constructor and Description |
---|
DbNotificationListener(org.apache.hadoop.conf.Configuration config) |
Modifier and Type | Method and Description |
---|---|
void |
onAbortTxn(AbortTxnEvent abortTxnEvent,
Connection dbConn,
SQLGenerator sqlGenerator)
This will be called to abort a transaction.
|
void |
onAddForeignKey(AddForeignKeyEvent addForeignKeyEvent) |
void |
onAddNotNullConstraint(AddNotNullConstraintEvent addNotNullConstraintEvent) |
void |
onAddPartition(AddPartitionEvent partitionEvent) |
void |
onAddPrimaryKey(AddPrimaryKeyEvent addPrimaryKeyEvent) |
void |
onAddUniqueConstraint(AddUniqueConstraintEvent addUniqueConstraintEvent) |
void |
onAllocWriteId(AllocWriteIdEvent allocWriteIdEvent,
Connection dbConn,
SQLGenerator sqlGenerator)
This will be called to alloc a new write id.
|
void |
onAlterDatabase(AlterDatabaseEvent dbEvent) |
void |
onAlterPartition(AlterPartitionEvent partitionEvent) |
void |
onAlterTable(AlterTableEvent tableEvent) |
void |
onCommitTxn(CommitTxnEvent commitTxnEvent,
Connection dbConn,
SQLGenerator sqlGenerator)
This will be called to commit a transaction.
|
void |
onConfigChange(ConfigChangeEvent tableEvent) |
void |
onCreateDatabase(CreateDatabaseEvent dbEvent) |
void |
onCreateFunction(CreateFunctionEvent fnEvent) |
void |
onCreateTable(CreateTableEvent tableEvent) |
void |
onDropConstraint(DropConstraintEvent dropConstraintEvent) |
void |
onDropDatabase(DropDatabaseEvent dbEvent) |
void |
onDropFunction(DropFunctionEvent fnEvent) |
void |
onDropPartition(DropPartitionEvent partitionEvent) |
void |
onDropTable(DropTableEvent tableEvent) |
void |
onInsert(InsertEvent insertEvent)
This will be called when an insert is executed that does not cause a partition to be added.
|
void |
onLoadPartitionDone(LoadPartitionDoneEvent partSetDoneEvent) |
void |
onOpenTxn(OpenTxnEvent openTxnEvent,
Connection dbConn,
SQLGenerator sqlGenerator)
This will be called when a new transaction is started.
|
getConf, onAddSchemaVersion, onAlterCatalog, onAlterISchema, onAlterSchemaVersion, onCreateCatalog, onCreateISchema, onDropCatalog, onDropISchema, onDropSchemaVersion, setConf
public DbNotificationListener(org.apache.hadoop.conf.Configuration config) throws MetaException
MetaException
public void onConfigChange(ConfigChangeEvent tableEvent) throws MetaException
onConfigChange
in class MetaStoreEventListener
tableEvent
- table event.MetaException
public void onCreateTable(CreateTableEvent tableEvent) throws MetaException
onCreateTable
in class MetaStoreEventListener
tableEvent
- table event.MetaException
public void onDropTable(DropTableEvent tableEvent) throws MetaException
onDropTable
in class MetaStoreEventListener
tableEvent
- table event.MetaException
public void onAlterTable(AlterTableEvent tableEvent) throws MetaException
onAlterTable
in class MetaStoreEventListener
tableEvent
- alter table eventMetaException
public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException
onAddPartition
in class MetaStoreEventListener
partitionEvent
- partition eventMetaException
public void onDropPartition(DropPartitionEvent partitionEvent) throws MetaException
onDropPartition
in class MetaStoreEventListener
partitionEvent
- partition eventMetaException
public void onAlterPartition(AlterPartitionEvent partitionEvent) throws MetaException
onAlterPartition
in class MetaStoreEventListener
partitionEvent
- partition eventMetaException
public void onCreateDatabase(CreateDatabaseEvent dbEvent) throws MetaException
onCreateDatabase
in class MetaStoreEventListener
dbEvent
- database eventMetaException
public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException
onDropDatabase
in class MetaStoreEventListener
dbEvent
- database eventMetaException
public void onAlterDatabase(AlterDatabaseEvent dbEvent) throws MetaException
onAlterDatabase
in class MetaStoreEventListener
dbEvent
- alter database eventMetaException
public void onCreateFunction(CreateFunctionEvent fnEvent) throws MetaException
onCreateFunction
in class MetaStoreEventListener
fnEvent
- function eventMetaException
public void onDropFunction(DropFunctionEvent fnEvent) throws MetaException
onDropFunction
in class MetaStoreEventListener
fnEvent
- function eventMetaException
public void onInsert(InsertEvent insertEvent) throws MetaException
MetaStoreEventListener
MetaStoreEventListener.onAddPartition(org.apache.hadoop.hive.metastore.events.AddPartitionEvent)
to be
called instead.onInsert
in class MetaStoreEventListener
MetaException
public void onOpenTxn(OpenTxnEvent openTxnEvent, Connection dbConn, SQLGenerator sqlGenerator) throws MetaException
MetaStoreEventListener
onOpenTxn
in class MetaStoreEventListener
openTxnEvent
- event to be processeddbConn
- jdbc connection to remote meta store db.sqlGenerator
- helper class to generate db specific sql string.MetaException
public void onCommitTxn(CommitTxnEvent commitTxnEvent, Connection dbConn, SQLGenerator sqlGenerator) throws MetaException
MetaStoreEventListener
onCommitTxn
in class MetaStoreEventListener
commitTxnEvent
- event to be processeddbConn
- jdbc connection to remote meta store db.sqlGenerator
- helper class to generate db specific sql string.MetaException
public void onAbortTxn(AbortTxnEvent abortTxnEvent, Connection dbConn, SQLGenerator sqlGenerator) throws MetaException
MetaStoreEventListener
onAbortTxn
in class MetaStoreEventListener
abortTxnEvent
- event to be processeddbConn
- jdbc connection to remote meta store db.sqlGenerator
- helper class to generate db specific sql string.MetaException
public void onLoadPartitionDone(LoadPartitionDoneEvent partSetDoneEvent) throws MetaException
onLoadPartitionDone
in class MetaStoreEventListener
partSetDoneEvent
- MetaException
public void onAddPrimaryKey(AddPrimaryKeyEvent addPrimaryKeyEvent) throws MetaException
onAddPrimaryKey
in class MetaStoreEventListener
addPrimaryKeyEvent
- add primary key eventMetaException
public void onAddForeignKey(AddForeignKeyEvent addForeignKeyEvent) throws MetaException
onAddForeignKey
in class MetaStoreEventListener
addForeignKeyEvent
- add foreign key eventMetaException
public void onAddUniqueConstraint(AddUniqueConstraintEvent addUniqueConstraintEvent) throws MetaException
onAddUniqueConstraint
in class MetaStoreEventListener
addUniqueConstraintEvent
- add unique constraint eventMetaException
public void onAddNotNullConstraint(AddNotNullConstraintEvent addNotNullConstraintEvent) throws MetaException
onAddNotNullConstraint
in class MetaStoreEventListener
addNotNullConstraintEvent
- add not null constraint eventMetaException
public void onDropConstraint(DropConstraintEvent dropConstraintEvent) throws MetaException
onDropConstraint
in class MetaStoreEventListener
dropConstraintEvent
- drop constraint eventMetaException
public void onAllocWriteId(AllocWriteIdEvent allocWriteIdEvent, Connection dbConn, SQLGenerator sqlGenerator) throws MetaException
MetaStoreEventListener
onAllocWriteId
in class MetaStoreEventListener
allocWriteIdEvent
- Alloc write id eventdbConn
- jdbc connection to remote meta store db.sqlGenerator
- helper class to generate db specific sql string.MetaException
Copyright © 2022 The Apache Software Foundation. All rights reserved.