diff --git a/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java b/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java index 8d29bfc..1ccacad 100644 --- a/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java +++ b/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java @@ -130,6 +130,7 @@ public void onCreateTable(CreateTableEvent tableEvent) throws MetaException { .buildCreateTableMessage(t).toString()); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -145,6 +146,7 @@ public void onDropTable(DropTableEvent tableEvent) throws MetaException { .buildDropTableMessage(t).toString()); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -161,6 +163,7 @@ public void onAlterTable(AlterTableEvent tableEvent) throws MetaException { .buildAlterTableMessage(before, after).toString()); event.setDbName(after.getDbName()); event.setTableName(after.getTableName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -177,6 +180,7 @@ public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaExceptio new NotificationEvent(0, now(), EventType.ADD_PARTITION.toString(), msg); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -192,6 +196,7 @@ public void onDropPartition(DropPartitionEvent partitionEvent) throws MetaExcept .buildDropPartitionMessage(t, partitionEvent.getPartitionIterator()).toString()); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -208,6 +213,7 @@ public void onAlterPartition(AlterPartitionEvent partitionEvent) throws MetaExce .buildAlterPartitionMessage(partitionEvent.getTable(), before, after).toString()); event.setDbName(before.getDbName()); event.setTableName(before.getTableName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -222,6 +228,7 @@ public void onCreateDatabase(CreateDatabaseEvent dbEvent) throws MetaException { new NotificationEvent(0, now(), EventType.CREATE_DATABASE.toString(), msgFactory .buildCreateDatabaseMessage(db).toString()); event.setDbName(db.getName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -236,6 +243,7 @@ public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException { new NotificationEvent(0, now(), EventType.DROP_DATABASE.toString(), msgFactory .buildDropDatabaseMessage(db).toString()); event.setDbName(db.getName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -250,6 +258,7 @@ public void onCreateFunction(CreateFunctionEvent fnEvent) throws MetaException { new NotificationEvent(0, now(), EventType.CREATE_FUNCTION.toString(), msgFactory .buildCreateFunctionMessage(fn).toString()); event.setDbName(fn.getDbName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -264,6 +273,7 @@ public void onDropFunction(DropFunctionEvent fnEvent) throws MetaException { new NotificationEvent(0, now(), EventType.DROP_FUNCTION.toString(), msgFactory .buildDropFunctionMessage(fn).toString()); event.setDbName(fn.getDbName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -278,6 +288,7 @@ public void onAddIndex(AddIndexEvent indexEvent) throws MetaException { new NotificationEvent(0, now(), EventType.CREATE_INDEX.toString(), msgFactory .buildCreateIndexMessage(index).toString()); event.setDbName(index.getDbName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -292,6 +303,7 @@ public void onDropIndex(DropIndexEvent indexEvent) throws MetaException { new NotificationEvent(0, now(), EventType.DROP_INDEX.toString(), msgFactory .buildDropIndexMessage(index).toString()); event.setDbName(index.getDbName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -307,6 +319,7 @@ public void onAlterIndex(AlterIndexEvent indexEvent) throws MetaException { new NotificationEvent(0, now(), EventType.ALTER_INDEX.toString(), msgFactory .buildAlterIndexMessage(before, after).toString()); event.setDbName(before.getDbName()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } @@ -318,6 +331,7 @@ public void onInsert(InsertEvent insertEvent) throws MetaException { insertEvent.getFiles(), insertEvent.getFileChecksums()).toString()); event.setDbName(insertEvent.getDb()); event.setTableName(insertEvent.getTable()); + event.setFmt(msgFactory.getMessageFormat()); process(event); } diff --git a/metastore/if/hive_metastore.thrift b/metastore/if/hive_metastore.thrift index bf80455..35aa4ce 100755 --- a/metastore/if/hive_metastore.thrift +++ b/metastore/if/hive_metastore.thrift @@ -800,6 +800,7 @@ struct NotificationEvent { 4: optional string dbName, 5: optional string tableName, 6: required string message, + 7: optional string fmt, } struct NotificationEventResponse { diff --git a/metastore/scripts/upgrade/derby/038-HIVE-10562.derby.sql b/metastore/scripts/upgrade/derby/038-HIVE-10562.derby.sql new file mode 100644 index 0000000..d3aff8c --- /dev/null +++ b/metastore/scripts/upgrade/derby/038-HIVE-10562.derby.sql @@ -0,0 +1,6 @@ +-- Step 1: Add the column for format +ALTER TABLE "APP"."NOTIFICATION_LOG" ADD `FMT` varchar(16); + +-- Step 2 : Change the type of the MESSAGE field from long varchar to clob +ALTER TABLE "APP"."NOTIFICATION_LOG" ALTER COLUMN "MESSAGE" SET DATA TYPE CLOB; + diff --git a/metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql b/metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql index fe18089..8b801b1 100644 --- a/metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql +++ b/metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql @@ -102,7 +102,7 @@ CREATE TABLE "APP"."FUNCS" ("FUNC_ID" BIGINT NOT NULL, "CLASS_NAME" VARCHAR(4000 CREATE TABLE "APP"."FUNC_RU" ("FUNC_ID" BIGINT NOT NULL, "RESOURCE_TYPE" INTEGER NOT NULL, "RESOURCE_URI" VARCHAR(4000), "INTEGER_IDX" INTEGER NOT NULL); -CREATE TABLE "APP"."NOTIFICATION_LOG" ("NL_ID" BIGINT NOT NULL, "DB_NAME" VARCHAR(128), "EVENT_ID" BIGINT NOT NULL, "EVENT_TIME" INTEGER NOT NULL, "EVENT_TYPE" VARCHAR(32) NOT NULL, "MESSAGE" LONG VARCHAR, "TBL_NAME" VARCHAR(128)); +CREATE TABLE "APP"."NOTIFICATION_LOG" ("NL_ID" BIGINT NOT NULL, "DB_NAME" VARCHAR(128), "EVENT_ID" BIGINT NOT NULL, "EVENT_TIME" INTEGER NOT NULL, "EVENT_TYPE" VARCHAR(32) NOT NULL, "MESSAGE" CLOB, "TBL_NAME" VARCHAR(128), "FMT" VARCHAR(16)); CREATE TABLE "APP"."NOTIFICATION_SEQUENCE" ("NNI_ID" BIGINT NOT NULL, "NEXT_EVENT_ID" BIGINT NOT NULL); diff --git a/metastore/scripts/upgrade/derby/upgrade-2.1.0-to-2.2.0.derby.sql b/metastore/scripts/upgrade/derby/upgrade-2.1.0-to-2.2.0.derby.sql index 699a619..e5a144c 100644 --- a/metastore/scripts/upgrade/derby/upgrade-2.1.0-to-2.2.0.derby.sql +++ b/metastore/scripts/upgrade/derby/upgrade-2.1.0-to-2.2.0.derby.sql @@ -1,4 +1,5 @@ -- Upgrade MetaStore schema from 2.1.0 to 2.2.0 RUN '037-HIVE-14496.derby.sql'; +RUN '038-HIVE-10562.derby.sql'; UPDATE "APP".VERSION SET SCHEMA_VERSION='2.2.0', VERSION_COMMENT='Hive release version 2.2.0' where VER_ID=1; diff --git a/metastore/scripts/upgrade/mssql/023-HIVE-10562.mssql.sql b/metastore/scripts/upgrade/mssql/023-HIVE-10562.mssql.sql new file mode 100644 index 0000000..8e6c011 --- /dev/null +++ b/metastore/scripts/upgrade/mssql/023-HIVE-10562.mssql.sql @@ -0,0 +1 @@ +ALTER TABLE NOTIFICATION_LOG ADD FMT nvarchar(16); diff --git a/metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql b/metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql index 7ff881c..f54a7d7 100644 --- a/metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql +++ b/metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql @@ -579,6 +579,7 @@ CREATE TABLE NOTIFICATION_LOG EVENT_TYPE nvarchar(32) NOT NULL, DB_NAME nvarchar(128) NULL, TBL_NAME nvarchar(128) NULL, + FMT nvarchar(16) MESSAGE text NULL ); diff --git a/metastore/scripts/upgrade/mssql/upgrade-2.1.0-to-2.2.0.mssql.sql b/metastore/scripts/upgrade/mssql/upgrade-2.1.0-to-2.2.0.mssql.sql index 55d8e9b..a4b8fda 100644 --- a/metastore/scripts/upgrade/mssql/upgrade-2.1.0-to-2.2.0.mssql.sql +++ b/metastore/scripts/upgrade/mssql/upgrade-2.1.0-to-2.2.0.mssql.sql @@ -1,6 +1,7 @@ SELECT 'Upgrading MetaStore schema from 2.1.0 to 2.2.0' AS MESSAGE; :r 022-HIVE-14496.mssql.sql +:r 023-HIVE-10562.mssql.sql UPDATE VERSION SET SCHEMA_VERSION='2.2.0', VERSION_COMMENT='Hive release version 2.2.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 2.1.0 to 2.2.0' AS MESSAGE; diff --git a/metastore/scripts/upgrade/mysql/038-HIVE-10562.mysql.sql b/metastore/scripts/upgrade/mysql/038-HIVE-10562.mysql.sql new file mode 100644 index 0000000..e5bf556 --- /dev/null +++ b/metastore/scripts/upgrade/mysql/038-HIVE-10562.mysql.sql @@ -0,0 +1,6 @@ +-- Step 1: Add the column for format +ALTER TABLE `NOTIFICATION_LOG` ADD `FMT` varchar(16); +-- if FMT is null, then it is the legacy hcat JSONMessageFactory that created this message + +-- Step 2 : Change the type of the MESSAGE field from mediumtext to longtext +ALTER TABLE `NOTIFICATION_LOG` MODIFY `MESSAGE` longtext; diff --git a/metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql b/metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql index 2009f1f..18d9d33 100644 --- a/metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql +++ b/metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql @@ -798,7 +798,8 @@ CREATE TABLE IF NOT EXISTS `NOTIFICATION_LOG` `EVENT_TYPE` varchar(32) NOT NULL, `DB_NAME` varchar(128), `TBL_NAME` varchar(128), - `MESSAGE` mediumtext, + `MESSAGE` longtext, + `FMT` varchar(16) PRIMARY KEY (`NL_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git a/metastore/scripts/upgrade/mysql/upgrade-2.1.0-to-2.2.0.mysql.sql b/metastore/scripts/upgrade/mysql/upgrade-2.1.0-to-2.2.0.mysql.sql index 07a002f..509c532 100644 --- a/metastore/scripts/upgrade/mysql/upgrade-2.1.0-to-2.2.0.mysql.sql +++ b/metastore/scripts/upgrade/mysql/upgrade-2.1.0-to-2.2.0.mysql.sql @@ -1,6 +1,7 @@ SELECT 'Upgrading MetaStore schema from 2.1.0 to 2.2.0' AS ' '; SOURCE 037-HIVE-14496.mysql.sql; +SOURCE 038-HIVE-10562.mysql.sql; UPDATE VERSION SET SCHEMA_VERSION='2.2.0', VERSION_COMMENT='Hive release version 2.2.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 2.1.0 to 2.2.0' AS ' '; diff --git a/metastore/scripts/upgrade/oracle/038-HIVE-10562.oracle.sql b/metastore/scripts/upgrade/oracle/038-HIVE-10562.oracle.sql new file mode 100644 index 0000000..bf23d82 --- /dev/null +++ b/metastore/scripts/upgrade/oracle/038-HIVE-10562.oracle.sql @@ -0,0 +1,2 @@ +ALTER TABLE NOTIFICATION_LOG ADD FMT VARCHAR(16) NULL; + diff --git a/metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql b/metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql index bb5a934..fdaaecd 100644 --- a/metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql +++ b/metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql @@ -560,7 +560,8 @@ CREATE TABLE NOTIFICATION_LOG EVENT_TYPE VARCHAR2(32) NOT NULL, DB_NAME VARCHAR2(128), TBL_NAME VARCHAR2(128), - MESSAGE CLOB NULL + MESSAGE CLOB NULL, + FMT VARCHAR(16) NULL ); ALTER TABLE NOTIFICATION_LOG ADD CONSTRAINT NOTIFICATION_LOG_PK PRIMARY KEY (NL_ID); diff --git a/metastore/scripts/upgrade/oracle/upgrade-2.1.0-to-2.2.0.oracle.sql b/metastore/scripts/upgrade/oracle/upgrade-2.1.0-to-2.2.0.oracle.sql index b5e65b9..f31fda9 100644 --- a/metastore/scripts/upgrade/oracle/upgrade-2.1.0-to-2.2.0.oracle.sql +++ b/metastore/scripts/upgrade/oracle/upgrade-2.1.0-to-2.2.0.oracle.sql @@ -1,6 +1,7 @@ SELECT 'Upgrading MetaStore schema from 2.1.0 to 2.2.0' AS Status from dual; @037-HIVE-14496.oracle.sql; +@038-HIVE-10562.oracle.sql; UPDATE VERSION SET SCHEMA_VERSION='2.2.0', VERSION_COMMENT='Hive release version 2.2.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 2.1.0 to 2.2.0' AS Status from dual; diff --git a/metastore/scripts/upgrade/postgres/037-HIVE-10562.postgres.sql b/metastore/scripts/upgrade/postgres/037-HIVE-10562.postgres.sql new file mode 100644 index 0000000..180fe88 --- /dev/null +++ b/metastore/scripts/upgrade/postgres/037-HIVE-10562.postgres.sql @@ -0,0 +1 @@ +ALTER TABLE "NOTIFICATION_LOG" ADD COLUMN "FMT" VARCHAR(16) NULL; diff --git a/metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql b/metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql index 0021df0..64d4106 100644 --- a/metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql +++ b/metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql @@ -576,6 +576,7 @@ CREATE TABLE "NOTIFICATION_LOG" "DB_NAME" VARCHAR(128), "TBL_NAME" VARCHAR(128), "MESSAGE" text, + "FMT" VARCHAR(16), PRIMARY KEY ("NL_ID") ); diff --git a/metastore/scripts/upgrade/postgres/upgrade-2.1.0-to-2.2.0.postgres.sql b/metastore/scripts/upgrade/postgres/upgrade-2.1.0-to-2.2.0.postgres.sql index 0f7139a..0f64a90 100644 --- a/metastore/scripts/upgrade/postgres/upgrade-2.1.0-to-2.2.0.postgres.sql +++ b/metastore/scripts/upgrade/postgres/upgrade-2.1.0-to-2.2.0.postgres.sql @@ -1,6 +1,7 @@ SELECT 'Upgrading MetaStore schema from 2.1.0 to 2.2.0'; \i 036-HIVE-14496.postgres.sql; +\i 037-HIVE-10562.postgres.sql; UPDATE "VERSION" SET "SCHEMA_VERSION"='2.2.0', "VERSION_COMMENT"='Hive release version 2.2.0' where "VER_ID"=1; SELECT 'Finished upgrading MetaStore schema from 2.1.0 to 2.2.0'; diff --git a/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp b/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp index d605049..cc4c5e0 100644 --- a/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp +++ b/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp @@ -15736,6 +15736,11 @@ void NotificationEvent::__set_message(const std::string& val) { this->message = val; } +void NotificationEvent::__set_fmt(const std::string& val) { + this->fmt = val; +__isset.fmt = true; +} + uint32_t NotificationEvent::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); @@ -15809,6 +15814,14 @@ uint32_t NotificationEvent::read(::apache::thrift::protocol::TProtocol* iprot) { xfer += iprot->skip(ftype); } break; + case 7: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->fmt); + this->__isset.fmt = true; + } else { + xfer += iprot->skip(ftype); + } + break; default: xfer += iprot->skip(ftype); break; @@ -15860,6 +15873,11 @@ uint32_t NotificationEvent::write(::apache::thrift::protocol::TProtocol* oprot) xfer += oprot->writeString(this->message); xfer += oprot->writeFieldEnd(); + if (this->__isset.fmt) { + xfer += oprot->writeFieldBegin("fmt", ::apache::thrift::protocol::T_STRING, 7); + xfer += oprot->writeString(this->fmt); + xfer += oprot->writeFieldEnd(); + } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; @@ -15873,6 +15891,7 @@ void swap(NotificationEvent &a, NotificationEvent &b) { swap(a.dbName, b.dbName); swap(a.tableName, b.tableName); swap(a.message, b.message); + swap(a.fmt, b.fmt); swap(a.__isset, b.__isset); } @@ -15883,6 +15902,7 @@ NotificationEvent::NotificationEvent(const NotificationEvent& other639) { dbName = other639.dbName; tableName = other639.tableName; message = other639.message; + fmt = other639.fmt; __isset = other639.__isset; } NotificationEvent& NotificationEvent::operator=(const NotificationEvent& other640) { @@ -15892,6 +15912,7 @@ NotificationEvent& NotificationEvent::operator=(const NotificationEvent& other64 dbName = other640.dbName; tableName = other640.tableName; message = other640.message; + fmt = other640.fmt; __isset = other640.__isset; return *this; } @@ -15904,6 +15925,7 @@ void NotificationEvent::printTo(std::ostream& out) const { out << ", " << "dbName="; (__isset.dbName ? (out << to_string(dbName)) : (out << "")); out << ", " << "tableName="; (__isset.tableName ? (out << to_string(tableName)) : (out << "")); out << ", " << "message=" << to_string(message); + out << ", " << "fmt="; (__isset.fmt ? (out << to_string(fmt)) : (out << "")); out << ")"; } diff --git a/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h b/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h index 4d5da71..aacb850 100644 --- a/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h +++ b/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h @@ -6391,9 +6391,10 @@ inline std::ostream& operator<<(std::ostream& out, const NotificationEventReques } typedef struct _NotificationEvent__isset { - _NotificationEvent__isset() : dbName(false), tableName(false) {} + _NotificationEvent__isset() : dbName(false), tableName(false), fmt(false) {} bool dbName :1; bool tableName :1; + bool fmt :1; } _NotificationEvent__isset; class NotificationEvent { @@ -6401,7 +6402,7 @@ class NotificationEvent { NotificationEvent(const NotificationEvent&); NotificationEvent& operator=(const NotificationEvent&); - NotificationEvent() : eventId(0), eventTime(0), eventType(), dbName(), tableName(), message() { + NotificationEvent() : eventId(0), eventTime(0), eventType(), dbName(), tableName(), message(), fmt() { } virtual ~NotificationEvent() throw(); @@ -6411,6 +6412,7 @@ class NotificationEvent { std::string dbName; std::string tableName; std::string message; + std::string fmt; _NotificationEvent__isset __isset; @@ -6426,6 +6428,8 @@ class NotificationEvent { void __set_message(const std::string& val); + void __set_fmt(const std::string& val); + bool operator == (const NotificationEvent & rhs) const { if (!(eventId == rhs.eventId)) @@ -6444,6 +6448,10 @@ class NotificationEvent { return false; if (!(message == rhs.message)) return false; + if (__isset.fmt != rhs.__isset.fmt) + return false; + else if (__isset.fmt && !(fmt == rhs.fmt)) + return false; return true; } bool operator != (const NotificationEvent &rhs) const { diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/NotificationEvent.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/NotificationEvent.java index c40bb4b..01c3387 100644 --- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/NotificationEvent.java +++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/NotificationEvent.java @@ -44,6 +44,7 @@ private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbName", org.apache.thrift.protocol.TType.STRING, (short)4); private static final org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tableName", org.apache.thrift.protocol.TType.STRING, (short)5); private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)6); + private static final org.apache.thrift.protocol.TField FMT_FIELD_DESC = new org.apache.thrift.protocol.TField("fmt", org.apache.thrift.protocol.TType.STRING, (short)7); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -57,6 +58,7 @@ private String dbName; // optional private String tableName; // optional private String message; // required + private String fmt; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -65,7 +67,8 @@ EVENT_TYPE((short)3, "eventType"), DB_NAME((short)4, "dbName"), TABLE_NAME((short)5, "tableName"), - MESSAGE((short)6, "message"); + MESSAGE((short)6, "message"), + FMT((short)7, "fmt"); private static final Map byName = new HashMap(); @@ -92,6 +95,8 @@ public static _Fields findByThriftId(int fieldId) { return TABLE_NAME; case 6: // MESSAGE return MESSAGE; + case 7: // FMT + return FMT; default: return null; } @@ -135,7 +140,7 @@ public String getFieldName() { private static final int __EVENTID_ISSET_ID = 0; private static final int __EVENTTIME_ISSET_ID = 1; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.DB_NAME,_Fields.TABLE_NAME}; + private static final _Fields optionals[] = {_Fields.DB_NAME,_Fields.TABLE_NAME,_Fields.FMT}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -151,6 +156,8 @@ public String getFieldName() { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.FMT, new org.apache.thrift.meta_data.FieldMetaData("fmt", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(NotificationEvent.class, metaDataMap); } @@ -192,6 +199,9 @@ public NotificationEvent(NotificationEvent other) { if (other.isSetMessage()) { this.message = other.message; } + if (other.isSetFmt()) { + this.fmt = other.fmt; + } } public NotificationEvent deepCopy() { @@ -208,6 +218,7 @@ public void clear() { this.dbName = null; this.tableName = null; this.message = null; + this.fmt = null; } public long getEventId() { @@ -346,6 +357,29 @@ public void setMessageIsSet(boolean value) { } } + public String getFmt() { + return this.fmt; + } + + public void setFmt(String fmt) { + this.fmt = fmt; + } + + public void unsetFmt() { + this.fmt = null; + } + + /** Returns true if field fmt is set (has been assigned a value) and false otherwise */ + public boolean isSetFmt() { + return this.fmt != null; + } + + public void setFmtIsSet(boolean value) { + if (!value) { + this.fmt = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case EVENT_ID: @@ -396,6 +430,14 @@ public void setFieldValue(_Fields field, Object value) { } break; + case FMT: + if (value == null) { + unsetFmt(); + } else { + setFmt((String)value); + } + break; + } } @@ -419,6 +461,9 @@ public Object getFieldValue(_Fields field) { case MESSAGE: return getMessage(); + case FMT: + return getFmt(); + } throw new IllegalStateException(); } @@ -442,6 +487,8 @@ public boolean isSet(_Fields field) { return isSetTableName(); case MESSAGE: return isSetMessage(); + case FMT: + return isSetFmt(); } throw new IllegalStateException(); } @@ -513,6 +560,15 @@ public boolean equals(NotificationEvent that) { return false; } + boolean this_present_fmt = true && this.isSetFmt(); + boolean that_present_fmt = true && that.isSetFmt(); + if (this_present_fmt || that_present_fmt) { + if (!(this_present_fmt && that_present_fmt)) + return false; + if (!this.fmt.equals(that.fmt)) + return false; + } + return true; } @@ -550,6 +606,11 @@ public int hashCode() { if (present_message) list.add(message); + boolean present_fmt = true && (isSetFmt()); + list.add(present_fmt); + if (present_fmt) + list.add(fmt); + return list.hashCode(); } @@ -621,6 +682,16 @@ public int compareTo(NotificationEvent other) { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetFmt()).compareTo(other.isSetFmt()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFmt()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fmt, other.fmt); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -684,6 +755,16 @@ public String toString() { sb.append(this.message); } first = false; + if (isSetFmt()) { + if (!first) sb.append(", "); + sb.append("fmt:"); + if (this.fmt == null) { + sb.append("null"); + } else { + sb.append(this.fmt); + } + first = false; + } sb.append(")"); return sb.toString(); } @@ -793,6 +874,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, NotificationEvent s org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 7: // FMT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.fmt = iprot.readString(); + struct.setFmtIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -836,6 +925,13 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, NotificationEvent oprot.writeString(struct.message); oprot.writeFieldEnd(); } + if (struct.fmt != null) { + if (struct.isSetFmt()) { + oprot.writeFieldBegin(FMT_FIELD_DESC); + oprot.writeString(struct.fmt); + oprot.writeFieldEnd(); + } + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -864,13 +960,19 @@ public void write(org.apache.thrift.protocol.TProtocol prot, NotificationEvent s if (struct.isSetTableName()) { optionals.set(1); } - oprot.writeBitSet(optionals, 2); + if (struct.isSetFmt()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); if (struct.isSetDbName()) { oprot.writeString(struct.dbName); } if (struct.isSetTableName()) { oprot.writeString(struct.tableName); } + if (struct.isSetFmt()) { + oprot.writeString(struct.fmt); + } } @Override @@ -884,7 +986,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, NotificationEvent st struct.setEventTypeIsSet(true); struct.message = iprot.readString(); struct.setMessageIsSet(true); - BitSet incoming = iprot.readBitSet(2); + BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.dbName = iprot.readString(); struct.setDbNameIsSet(true); @@ -893,6 +995,10 @@ public void read(org.apache.thrift.protocol.TProtocol prot, NotificationEvent st struct.tableName = iprot.readString(); struct.setTableNameIsSet(true); } + if (incoming.get(2)) { + struct.fmt = iprot.readString(); + struct.setFmtIsSet(true); + } } } diff --git a/metastore/src/gen/thrift/gen-php/metastore/Types.php b/metastore/src/gen/thrift/gen-php/metastore/Types.php index 103cd86..ddd3b3e 100644 --- a/metastore/src/gen/thrift/gen-php/metastore/Types.php +++ b/metastore/src/gen/thrift/gen-php/metastore/Types.php @@ -15639,6 +15639,10 @@ class NotificationEvent { * @var string */ public $message = null; + /** + * @var string + */ + public $fmt = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -15667,6 +15671,10 @@ class NotificationEvent { 'var' => 'message', 'type' => TType::STRING, ), + 7 => array( + 'var' => 'fmt', + 'type' => TType::STRING, + ), ); } if (is_array($vals)) { @@ -15688,6 +15696,9 @@ class NotificationEvent { if (isset($vals['message'])) { $this->message = $vals['message']; } + if (isset($vals['fmt'])) { + $this->fmt = $vals['fmt']; + } } } @@ -15752,6 +15763,13 @@ class NotificationEvent { $xfer += $input->skip($ftype); } break; + case 7: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->fmt); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -15795,6 +15813,11 @@ class NotificationEvent { $xfer += $output->writeString($this->message); $xfer += $output->writeFieldEnd(); } + if ($this->fmt !== null) { + $xfer += $output->writeFieldBegin('fmt', TType::STRING, 7); + $xfer += $output->writeString($this->fmt); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; diff --git a/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py b/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py index 2f1c3cf..04c284f 100644 --- a/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py +++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py @@ -10868,6 +10868,7 @@ class NotificationEvent: - dbName - tableName - message + - fmt """ thrift_spec = ( @@ -10878,15 +10879,17 @@ class NotificationEvent: (4, TType.STRING, 'dbName', None, None, ), # 4 (5, TType.STRING, 'tableName', None, None, ), # 5 (6, TType.STRING, 'message', None, None, ), # 6 + (7, TType.STRING, 'fmt', None, None, ), # 7 ) - def __init__(self, eventId=None, eventTime=None, eventType=None, dbName=None, tableName=None, message=None,): + def __init__(self, eventId=None, eventTime=None, eventType=None, dbName=None, tableName=None, message=None, fmt=None,): self.eventId = eventId self.eventTime = eventTime self.eventType = eventType self.dbName = dbName self.tableName = tableName self.message = message + self.fmt = fmt def read(self, iprot): if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: @@ -10927,6 +10930,11 @@ def read(self, iprot): self.message = iprot.readString() else: iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRING: + self.fmt = iprot.readString() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -10961,6 +10969,10 @@ def write(self, oprot): oprot.writeFieldBegin('message', TType.STRING, 6) oprot.writeString(self.message) oprot.writeFieldEnd() + if self.fmt is not None: + oprot.writeFieldBegin('fmt', TType.STRING, 7) + oprot.writeString(self.fmt) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -10984,6 +10996,7 @@ def __hash__(self): value = (value * 31) ^ hash(self.dbName) value = (value * 31) ^ hash(self.tableName) value = (value * 31) ^ hash(self.message) + value = (value * 31) ^ hash(self.fmt) return value def __repr__(self): diff --git a/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb b/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb index b6050c6..37fcab7 100644 --- a/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb +++ b/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb @@ -2443,6 +2443,7 @@ class NotificationEvent DBNAME = 4 TABLENAME = 5 MESSAGE = 6 + FMT = 7 FIELDS = { EVENTID => {:type => ::Thrift::Types::I64, :name => 'eventId'}, @@ -2450,7 +2451,8 @@ class NotificationEvent EVENTTYPE => {:type => ::Thrift::Types::STRING, :name => 'eventType'}, DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName', :optional => true}, TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tableName', :optional => true}, - MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'} + MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}, + FMT => {:type => ::Thrift::Types::STRING, :name => 'fmt', :optional => true} } def struct_fields; FIELDS; end diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/MessageFactory.java b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/MessageFactory.java index df25f43..d19d138 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/MessageFactory.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/MessageFactory.java @@ -117,11 +117,6 @@ public static MessageDeserializer getDeserializer(String format, public abstract MessageDeserializer getDeserializer(); /** - * Getter for version-string, corresponding to all constructed messages. - */ - public abstract String getVersion(); - - /** * Getter for message-format. */ public abstract String getMessageFormat(); diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageFactory.java b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageFactory.java index f66a2a3..152d73c 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageFactory.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageFactory.java @@ -86,13 +86,8 @@ public MessageDeserializer getDeserializer() { } @Override - public String getVersion() { - return "0.1"; - } - - @Override public String getMessageFormat() { - return "json"; + return "json-0.2"; } @Override diff --git a/metastore/src/model/org/apache/hadoop/hive/metastore/model/MNotificationLog.java b/metastore/src/model/org/apache/hadoop/hive/metastore/model/MNotificationLog.java index aedac35..c3d35ea 100644 --- a/metastore/src/model/org/apache/hadoop/hive/metastore/model/MNotificationLog.java +++ b/metastore/src/model/org/apache/hadoop/hive/metastore/model/MNotificationLog.java @@ -25,6 +25,7 @@ private String dbName; private String tableName; private String message; + private String fmt; public MNotificationLog() { } @@ -86,4 +87,12 @@ public String getMessage() { public void setMessage(String message) { this.message = message; } + + public String getFmt() { + return fmt; + } + + public void setFmt(String fmt) { + this.fmt = fmt; + } } diff --git a/metastore/src/model/package.jdo b/metastore/src/model/package.jdo index daee72c..2ab4a78 100644 --- a/metastore/src/model/package.jdo +++ b/metastore/src/model/package.jdo @@ -1049,6 +1049,9 @@ + + +