HBASE-24547 : Thrift support for HBASE-23941 (Operator support for get_slowlog_responses API) (#1892)

Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
This commit is contained in:
Viraj Jasani 2020-06-15 14:14:28 +05:30
parent 700c5a7e3b
commit 8b45b0c787
No known key found for this signature in database
GPG Key ID: B3D6C0B41C8ADFD5
42 changed files with 314 additions and 48 deletions

View File

@ -89,6 +89,7 @@ import org.apache.hadoop.hbase.thrift2.generated.TDataBlockEncoding;
import org.apache.hadoop.hbase.thrift2.generated.TDelete;
import org.apache.hadoop.hbase.thrift2.generated.TDeleteType;
import org.apache.hadoop.hbase.thrift2.generated.TDurability;
import org.apache.hadoop.hbase.thrift2.generated.TFilterByOperator;
import org.apache.hadoop.hbase.thrift2.generated.TGet;
import org.apache.hadoop.hbase.thrift2.generated.THRegionInfo;
import org.apache.hadoop.hbase.thrift2.generated.THRegionLocation;
@ -1501,16 +1502,56 @@ public class ThriftUtilities {
}
public static TLogQueryFilter getSlowLogQueryFromHBase(
LogQueryFilter slowLogQueryFilter) {
LogQueryFilter logQueryFilter) {
TLogQueryFilter tLogQueryFilter = new TLogQueryFilter();
tLogQueryFilter.setRegionName(slowLogQueryFilter.getRegionName());
tLogQueryFilter.setClientAddress(slowLogQueryFilter.getClientAddress());
tLogQueryFilter.setTableName(slowLogQueryFilter.getTableName());
tLogQueryFilter.setUserName(slowLogQueryFilter.getUserName());
tLogQueryFilter.setLimit(slowLogQueryFilter.getLimit());
tLogQueryFilter.setRegionName(logQueryFilter.getRegionName());
tLogQueryFilter.setClientAddress(logQueryFilter.getClientAddress());
tLogQueryFilter.setTableName(logQueryFilter.getTableName());
tLogQueryFilter.setUserName(logQueryFilter.getUserName());
tLogQueryFilter.setLimit(logQueryFilter.getLimit());
TLogType tLogType = gettLogTypeFromHBase(logQueryFilter);
tLogQueryFilter.setLogType(tLogType);
TFilterByOperator tFilterByOperator = getTFilterByFromHBase(logQueryFilter);
tLogQueryFilter.setFilterByOperator(tFilterByOperator);
return tLogQueryFilter;
}
private static TLogType gettLogTypeFromHBase(final LogQueryFilter logQueryFilter) {
TLogType tLogType;
switch (logQueryFilter.getType()) {
case SLOW_LOG: {
tLogType = TLogType.SLOW_LOG;
break;
}
case LARGE_LOG: {
tLogType = TLogType.LARGE_LOG;
break;
}
default: {
tLogType = TLogType.SLOW_LOG;
}
}
return tLogType;
}
private static TFilterByOperator getTFilterByFromHBase(final LogQueryFilter logQueryFilter) {
TFilterByOperator tFilterByOperator;
switch (logQueryFilter.getFilterByOperator()) {
case AND: {
tFilterByOperator = TFilterByOperator.AND;
break;
}
case OR: {
tFilterByOperator = TFilterByOperator.OR;
break;
}
default: {
tFilterByOperator = TFilterByOperator.OR;
}
}
return tFilterByOperator;
}
public static LogQueryFilter getSlowLogQueryFromThrift(
TLogQueryFilter tLogQueryFilter) {
LogQueryFilter logQueryFilter = new LogQueryFilter();
@ -1519,9 +1560,51 @@ public class ThriftUtilities {
logQueryFilter.setTableName(tLogQueryFilter.getTableName());
logQueryFilter.setUserName(tLogQueryFilter.getUserName());
logQueryFilter.setLimit(tLogQueryFilter.getLimit());
LogQueryFilter.Type type = getLogTypeFromThrift(tLogQueryFilter);
logQueryFilter.setType(type);
LogQueryFilter.FilterByOperator filterByOperator = getFilterByFromThrift(tLogQueryFilter);
logQueryFilter.setFilterByOperator(filterByOperator);
return logQueryFilter;
}
private static LogQueryFilter.Type getLogTypeFromThrift(
final TLogQueryFilter tSlowLogQueryFilter) {
LogQueryFilter.Type type;
switch (tSlowLogQueryFilter.getLogType()) {
case SLOW_LOG: {
type = LogQueryFilter.Type.SLOW_LOG;
break;
}
case LARGE_LOG: {
type = LogQueryFilter.Type.LARGE_LOG;
break;
}
default: {
type = LogQueryFilter.Type.SLOW_LOG;
}
}
return type;
}
private static LogQueryFilter.FilterByOperator getFilterByFromThrift(
final TLogQueryFilter tLogQueryFilter) {
LogQueryFilter.FilterByOperator filterByOperator;
switch (tLogQueryFilter.getFilterByOperator()) {
case AND: {
filterByOperator = LogQueryFilter.FilterByOperator.AND;
break;
}
case OR: {
filterByOperator = LogQueryFilter.FilterByOperator.OR;
break;
}
default: {
filterByOperator = LogQueryFilter.FilterByOperator.OR;
}
}
return filterByOperator;
}
public static List<TOnlineLogRecord> getSlowLogRecordsFromHBase(
List<OnlineLogRecord> onlineLogRecords) {
if (CollectionUtils.isEmpty(onlineLogRecords)) {

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields>, java.io.Serializable, Cloneable, Comparable<TAppend> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAppend");

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TAuthorization implements org.apache.thrift.TBase<TAuthorization, TAuthorization._Fields>, java.io.Serializable, Cloneable, Comparable<TAuthorization> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAuthorization");

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.regionserver.BloomType
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TBloomFilterType implements org.apache.thrift.TEnum {
/**
* Bloomfilters disabled

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TCellVisibility implements org.apache.thrift.TBase<TCellVisibility, TCellVisibility._Fields>, java.io.Serializable, Cloneable, Comparable<TCellVisibility> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCellVisibility");

View File

@ -12,7 +12,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* in a HBase table by column family and optionally
* a column qualifier and timestamp
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TColumn implements org.apache.thrift.TBase<TColumn, TColumn._Fields>, java.io.Serializable, Cloneable, Comparable<TColumn> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TColumn");

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.client.ColumnFamilyDescriptor
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TColumnFamilyDescriptor implements org.apache.thrift.TBase<TColumnFamilyDescriptor, TColumnFamilyDescriptor._Fields>, java.io.Serializable, Cloneable, Comparable<TColumnFamilyDescriptor> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TColumnFamilyDescriptor");

View File

@ -10,7 +10,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
/**
* Represents a single cell and the amount to increment it by
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TColumnIncrement implements org.apache.thrift.TBase<TColumnIncrement, TColumnIncrement._Fields>, java.io.Serializable, Cloneable, Comparable<TColumnIncrement> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TColumnIncrement");

View File

@ -10,7 +10,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
/**
* Represents a single cell and its value.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColumnValue._Fields>, java.io.Serializable, Cloneable, Comparable<TColumnValue> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TColumnValue");

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.filter.CompareFilter$CompareOp.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TCompareOp implements org.apache.thrift.TEnum {
LESS(0),
LESS_OR_EQUAL(1),

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.io.compress.Algorithm
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TCompressionAlgorithm implements org.apache.thrift.TEnum {
LZO(0),
GZ(1),

View File

@ -12,7 +12,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* - STRONG means reads only from primary region
* - TIMELINE means reads might return values from secondary region replicas
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TConsistency implements org.apache.thrift.TEnum {
STRONG(1),
TIMELINE(2);

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.io.encoding.DataBlockEncoding
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TDataBlockEncoding implements org.apache.thrift.TEnum {
/**
* Disable data block encoding.

View File

@ -33,7 +33,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* by changing the durability. If you don't provide durability, it defaults to
* column family's default setting for durability.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TDelete implements org.apache.thrift.TBase<TDelete, TDelete._Fields>, java.io.Serializable, Cloneable, Comparable<TDelete> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDelete");

View File

@ -12,7 +12,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* - DELETE_COLUMN means exactly one version will be removed,
* - DELETE_COLUMNS means previous versions will also be removed.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TDeleteType implements org.apache.thrift.TEnum {
DELETE_COLUMN(0),
DELETE_COLUMNS(1),

View File

@ -14,7 +14,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* - SYNC_WAL means write the Mutation to the WAL synchronously,
* - FSYNC_WAL means Write the Mutation to the WAL synchronously and force the entries to disk.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TDurability implements org.apache.thrift.TEnum {
USE_DEFAULT(0),
SKIP_WAL(1),

View File

@ -0,0 +1,43 @@
/**
* Autogenerated by Thrift Compiler (0.13.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift2.generated;
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TFilterByOperator implements org.apache.thrift.TEnum {
AND(0),
OR(1);
private final int value;
private TFilterByOperator(int value) {
this.value = value;
}
/**
* Get the integer value of this enum value, as defined in the Thrift IDL.
*/
public int getValue() {
return value;
}
/**
* Find a the enum type by its integer value, as defined in the Thrift IDL.
* @return null if the value is not found.
*/
@org.apache.thrift.annotation.Nullable
public static TFilterByOperator findByValue(int value) {
switch (value) {
case 0:
return AND;
case 1:
return OR;
default:
return null;
}
}
}

View File

@ -20,7 +20,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* If you specify a time range and a timestamp the range is ignored.
* Timestamps on TColumns are ignored.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.io.Serializable, Cloneable, Comparable<TGet> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGet");

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class THBaseService {
public interface Iface {

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class THRegionInfo implements org.apache.thrift.TBase<THRegionInfo, THRegionInfo._Fields>, java.io.Serializable, Cloneable, Comparable<THRegionInfo> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("THRegionInfo");

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class THRegionLocation implements org.apache.thrift.TBase<THRegionLocation, THRegionLocation._Fields>, java.io.Serializable, Cloneable, Comparable<THRegionLocation> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("THRegionLocation");

View File

@ -12,7 +12,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* to the HBase master or a HBase region server. Also used to return
* more general HBase error conditions.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TIOError extends org.apache.thrift.TException implements org.apache.thrift.TBase<TIOError, TIOError._Fields>, java.io.Serializable, Cloneable, Comparable<TIOError> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIOError");

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* A TIllegalArgument exception indicates an illegal or invalid
* argument was passed into a procedure.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TIllegalArgument extends org.apache.thrift.TException implements org.apache.thrift.TBase<TIllegalArgument, TIllegalArgument._Fields>, java.io.Serializable, Cloneable, Comparable<TIllegalArgument> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIllegalArgument");

View File

@ -14,7 +14,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* by changing the durability. If you don't provide durability, it defaults to
* column family's default setting for durability.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncrement._Fields>, java.io.Serializable, Cloneable, Comparable<TIncrement> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIncrement");

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.KeepDeletedCells
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TKeepDeletedCells implements org.apache.thrift.TEnum {
/**
* Deleted Cells are not retained.

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.client.LogQueryFilter
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter, TLogQueryFilter._Fields>, java.io.Serializable, Cloneable, Comparable<TLogQueryFilter> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TLogQueryFilter");
@ -21,6 +21,7 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField("limit", org.apache.thrift.protocol.TType.I32, (short)5);
private static final org.apache.thrift.protocol.TField LOG_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("logType", org.apache.thrift.protocol.TType.I32, (short)6);
private static final org.apache.thrift.protocol.TField FILTER_BY_OPERATOR_FIELD_DESC = new org.apache.thrift.protocol.TField("filterByOperator", org.apache.thrift.protocol.TType.I32, (short)7);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TLogQueryFilterStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TLogQueryFilterTupleSchemeFactory();
@ -35,6 +36,11 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
* @see TLogType
*/
public @org.apache.thrift.annotation.Nullable TLogType logType; // optional
/**
*
* @see TFilterByOperator
*/
public @org.apache.thrift.annotation.Nullable TFilterByOperator filterByOperator; // 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 {
@ -47,7 +53,12 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
*
* @see TLogType
*/
LOG_TYPE((short)6, "logType");
LOG_TYPE((short)6, "logType"),
/**
*
* @see TFilterByOperator
*/
FILTER_BY_OPERATOR((short)7, "filterByOperator");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
@ -75,6 +86,8 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
return LIMIT;
case 6: // LOG_TYPE
return LOG_TYPE;
case 7: // FILTER_BY_OPERATOR
return FILTER_BY_OPERATOR;
default:
return null;
}
@ -118,7 +131,7 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
// isset id assignments
private static final int __LIMIT_ISSET_ID = 0;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.REGION_NAME,_Fields.CLIENT_ADDRESS,_Fields.TABLE_NAME,_Fields.USER_NAME,_Fields.LIMIT,_Fields.LOG_TYPE};
private static final _Fields optionals[] = {_Fields.REGION_NAME,_Fields.CLIENT_ADDRESS,_Fields.TABLE_NAME,_Fields.USER_NAME,_Fields.LIMIT,_Fields.LOG_TYPE,_Fields.FILTER_BY_OPERATOR};
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@ -134,6 +147,8 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.LOG_TYPE, new org.apache.thrift.meta_data.FieldMetaData("logType", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TLogType.class)));
tmpMap.put(_Fields.FILTER_BY_OPERATOR, new org.apache.thrift.meta_data.FieldMetaData("filterByOperator", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TFilterByOperator.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TLogQueryFilter.class, metaDataMap);
}
@ -143,6 +158,8 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
this.logType = org.apache.hadoop.hbase.thrift2.generated.TLogType.SLOW_LOG;
this.filterByOperator = org.apache.hadoop.hbase.thrift2.generated.TFilterByOperator.OR;
}
/**
@ -166,6 +183,9 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
if (other.isSetLogType()) {
this.logType = other.logType;
}
if (other.isSetFilterByOperator()) {
this.filterByOperator = other.filterByOperator;
}
}
public TLogQueryFilter deepCopy() {
@ -182,6 +202,8 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
this.logType = org.apache.hadoop.hbase.thrift2.generated.TLogType.SLOW_LOG;
this.filterByOperator = org.apache.hadoop.hbase.thrift2.generated.TFilterByOperator.OR;
}
@org.apache.thrift.annotation.Nullable
@ -340,6 +362,39 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
}
}
/**
*
* @see TFilterByOperator
*/
@org.apache.thrift.annotation.Nullable
public TFilterByOperator getFilterByOperator() {
return this.filterByOperator;
}
/**
*
* @see TFilterByOperator
*/
public TLogQueryFilter setFilterByOperator(@org.apache.thrift.annotation.Nullable TFilterByOperator filterByOperator) {
this.filterByOperator = filterByOperator;
return this;
}
public void unsetFilterByOperator() {
this.filterByOperator = null;
}
/** Returns true if field filterByOperator is set (has been assigned a value) and false otherwise */
public boolean isSetFilterByOperator() {
return this.filterByOperator != null;
}
public void setFilterByOperatorIsSet(boolean value) {
if (!value) {
this.filterByOperator = null;
}
}
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case REGION_NAME:
@ -390,6 +445,14 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
}
break;
case FILTER_BY_OPERATOR:
if (value == null) {
unsetFilterByOperator();
} else {
setFilterByOperator((TFilterByOperator)value);
}
break;
}
}
@ -414,6 +477,9 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
case LOG_TYPE:
return getLogType();
case FILTER_BY_OPERATOR:
return getFilterByOperator();
}
throw new java.lang.IllegalStateException();
}
@ -437,6 +503,8 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
return isSetLimit();
case LOG_TYPE:
return isSetLogType();
case FILTER_BY_OPERATOR:
return isSetFilterByOperator();
}
throw new java.lang.IllegalStateException();
}
@ -510,6 +578,15 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
return false;
}
boolean this_present_filterByOperator = true && this.isSetFilterByOperator();
boolean that_present_filterByOperator = true && that.isSetFilterByOperator();
if (this_present_filterByOperator || that_present_filterByOperator) {
if (!(this_present_filterByOperator && that_present_filterByOperator))
return false;
if (!this.filterByOperator.equals(that.filterByOperator))
return false;
}
return true;
}
@ -541,6 +618,10 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
if (isSetLogType())
hashCode = hashCode * 8191 + logType.getValue();
hashCode = hashCode * 8191 + ((isSetFilterByOperator()) ? 131071 : 524287);
if (isSetFilterByOperator())
hashCode = hashCode * 8191 + filterByOperator.getValue();
return hashCode;
}
@ -612,6 +693,16 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetFilterByOperator()).compareTo(other.isSetFilterByOperator());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFilterByOperator()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filterByOperator, other.filterByOperator);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
@ -688,6 +779,16 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
}
first = false;
}
if (isSetFilterByOperator()) {
if (!first) sb.append(", ");
sb.append("filterByOperator:");
if (this.filterByOperator == null) {
sb.append("null");
} else {
sb.append(this.filterByOperator);
}
first = false;
}
sb.append(")");
return sb.toString();
}
@ -781,6 +882,14 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // FILTER_BY_OPERATOR
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.filterByOperator = org.apache.hadoop.hbase.thrift2.generated.TFilterByOperator.findByValue(iprot.readI32());
struct.setFilterByOperatorIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@ -836,6 +945,13 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
oprot.writeFieldEnd();
}
}
if (struct.filterByOperator != null) {
if (struct.isSetFilterByOperator()) {
oprot.writeFieldBegin(FILTER_BY_OPERATOR_FIELD_DESC);
oprot.writeI32(struct.filterByOperator.getValue());
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@ -872,7 +988,10 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
if (struct.isSetLogType()) {
optionals.set(5);
}
oprot.writeBitSet(optionals, 6);
if (struct.isSetFilterByOperator()) {
optionals.set(6);
}
oprot.writeBitSet(optionals, 7);
if (struct.isSetRegionName()) {
oprot.writeString(struct.regionName);
}
@ -891,12 +1010,15 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
if (struct.isSetLogType()) {
oprot.writeI32(struct.logType.getValue());
}
if (struct.isSetFilterByOperator()) {
oprot.writeI32(struct.filterByOperator.getValue());
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TLogQueryFilter struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet incoming = iprot.readBitSet(6);
java.util.BitSet incoming = iprot.readBitSet(7);
if (incoming.get(0)) {
struct.regionName = iprot.readString();
struct.setRegionNameIsSet(true);
@ -921,6 +1043,10 @@ public class TLogQueryFilter implements org.apache.thrift.TBase<TLogQueryFilter,
struct.logType = org.apache.hadoop.hbase.thrift2.generated.TLogType.findByValue(iprot.readI32());
struct.setLogTypeIsSet(true);
}
if (incoming.get(6)) {
struct.filterByOperator = org.apache.hadoop.hbase.thrift2.generated.TFilterByOperator.findByValue(iprot.readI32());
struct.setFilterByOperatorIsSet(true);
}
}
}

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TLogType implements org.apache.thrift.TEnum {
SLOW_LOG(1),
LARGE_LOG(2);

View File

@ -10,7 +10,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
/**
* Atomic mutation for the specified row. It can be either Put or Delete.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TMutation extends org.apache.thrift.TUnion<TMutation, TMutation._Fields> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TMutation");
private static final org.apache.thrift.protocol.TField PUT_FIELD_DESC = new org.apache.thrift.protocol.TField("put", org.apache.thrift.protocol.TType.STRUCT, (short)1);

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.NamespaceDescriptor
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TNamespaceDescriptor implements org.apache.thrift.TBase<TNamespaceDescriptor, TNamespaceDescriptor._Fields>, java.io.Serializable, Cloneable, Comparable<TNamespaceDescriptor> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TNamespaceDescriptor");

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.client.OnlineLogRecordrd
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TOnlineLogRecord implements org.apache.thrift.TBase<TOnlineLogRecord, TOnlineLogRecord._Fields>, java.io.Serializable, Cloneable, Comparable<TOnlineLogRecord> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TOnlineLogRecord");

View File

@ -19,7 +19,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* by changing the durability. If you don't provide durability, it defaults to
* column family's default setting for durability.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.io.Serializable, Cloneable, Comparable<TPut> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPut");

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TReadType implements org.apache.thrift.TEnum {
DEFAULT(1),
STREAM(2),

View File

@ -10,7 +10,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
/**
* if no Result is found, row and columnValues will not be set.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields>, java.io.Serializable, Cloneable, Comparable<TResult> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TResult");

View File

@ -10,7 +10,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
/**
* A TRowMutations object is used to apply a number of Mutations to a single row.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TRowMutations implements org.apache.thrift.TBase<TRowMutations, TRowMutations._Fields>, java.io.Serializable, Cloneable, Comparable<TRowMutations> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRowMutations");

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Any timestamps in the columns are ignored but the colFamTimeRangeMap included, use timeRange to select by timestamp.
* Max versions defaults to 1.
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, java.io.Serializable, Cloneable, Comparable<TScan> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TScan");

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TServerName implements org.apache.thrift.TBase<TServerName, TServerName._Fields>, java.io.Serializable, Cloneable, Comparable<TServerName> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TServerName");

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.client.TableDescriptor
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TTableDescriptor implements org.apache.thrift.TBase<TTableDescriptor, TTableDescriptor._Fields>, java.io.Serializable, Cloneable, Comparable<TTableDescriptor> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTableDescriptor");

View File

@ -11,7 +11,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
* Thrift wrapper around
* org.apache.hadoop.hbase.TableName
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TTableName implements org.apache.thrift.TBase<TTableName, TTableName._Fields>, java.io.Serializable, Cloneable, Comparable<TTableName> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTableName");

View File

@ -10,7 +10,7 @@ package org.apache.hadoop.hbase.thrift2.generated;
/**
* Specify type of thrift server: thrift and thrift2
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public enum TThriftServerType implements org.apache.thrift.TEnum {
ONE(1),
TWO(2);

View File

@ -7,7 +7,7 @@
package org.apache.hadoop.hbase.thrift2.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-04-14")
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-06-15")
public class TTimeRange implements org.apache.thrift.TBase<TTimeRange, TTimeRange._Fields>, java.io.Serializable, Cloneable, Comparable<TTimeRange> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTimeRange");

View File

@ -459,6 +459,11 @@ enum TLogType {
LARGE_LOG = 2
}
enum TFilterByOperator {
AND,
OR
}
/**
* Thrift wrapper around
* org.apache.hadoop.hbase.client.LogQueryFilter
@ -470,6 +475,7 @@ struct TLogQueryFilter {
4: optional string userName
5: optional i32 limit = 10
6: optional TLogType logType = 1
7: optional TFilterByOperator filterByOperator = TFilterByOperator.OR
}

View File

@ -63,6 +63,7 @@ import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.LogQueryFilter;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
@ -92,6 +93,7 @@ import org.apache.hadoop.hbase.thrift2.generated.TDataBlockEncoding;
import org.apache.hadoop.hbase.thrift2.generated.TDelete;
import org.apache.hadoop.hbase.thrift2.generated.TDeleteType;
import org.apache.hadoop.hbase.thrift2.generated.TDurability;
import org.apache.hadoop.hbase.thrift2.generated.TFilterByOperator;
import org.apache.hadoop.hbase.thrift2.generated.TGet;
import org.apache.hadoop.hbase.thrift2.generated.THBaseService;
import org.apache.hadoop.hbase.thrift2.generated.TIOError;
@ -1759,6 +1761,12 @@ public class TestThriftHBaseServiceHandler {
clearedResponses.forEach(Assert::assertTrue);
TLogQueryFilter tLogQueryFilter = new TLogQueryFilter();
tLogQueryFilter.setLimit(15);
Assert.assertEquals(tLogQueryFilter.getFilterByOperator(), TFilterByOperator.OR);
LogQueryFilter logQueryFilter = ThriftUtilities.getSlowLogQueryFromThrift(tLogQueryFilter);
Assert.assertEquals(logQueryFilter.getFilterByOperator(), LogQueryFilter.FilterByOperator.OR);
tLogQueryFilter.setFilterByOperator(TFilterByOperator.AND);
logQueryFilter = ThriftUtilities.getSlowLogQueryFromThrift(tLogQueryFilter);
Assert.assertEquals(logQueryFilter.getFilterByOperator(), LogQueryFilter.FilterByOperator.AND);
List<TOnlineLogRecord> tLogRecords =
thriftHBaseServiceHandler.getSlowLogResponses(tServerNames, tLogQueryFilter);
assertEquals(tLogRecords.size(), 0);