Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2163,7 +2163,8 @@ public static SlowLogParams getSlowLogParams(Message message, boolean slowLogSca
}
} else if (message instanceof MutationProto) {
MutationProto mutationProto = (MutationProto) message;
String params = "type= " + mutationProto.getMutateType().toString();
String params = "type= " + mutationProto.getMutateType().toString() + ", row= "
+ getStringForByteString(mutationProto.getRow());
return new SlowLogParams(params);
} else if (message instanceof GetRequest) {
GetRequest getRequest = (GetRequest) message;
Expand All @@ -2182,7 +2183,8 @@ public static SlowLogParams getSlowLogParams(Message message, boolean slowLogSca
} else if (message instanceof MutateRequest) {
MutateRequest mutateRequest = (MutateRequest) message;
String regionName = getStringForByteString(mutateRequest.getRegion().getValue());
String params = "region= " + regionName;
String params = "region= " + regionName + ", row= "
+ getStringForByteString(mutateRequest.getMutation().getRow());
return new SlowLogParams(regionName, params);
} else if (message instanceof CoprocessorServiceRequest) {
CoprocessorServiceRequest coprocessorServiceRequest = (CoprocessorServiceRequest) message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.SlowLogParams;
import org.apache.hadoop.hbase.io.TimeRange;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
Expand All @@ -64,6 +65,7 @@
import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MutationProto.ColumnValue.QualifierValue;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MutationProto.DeleteType;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MutationProto.MutationType;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameBytesPair;
import org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos;
Expand Down Expand Up @@ -593,4 +595,32 @@ public void testIsEOF() throws Exception {
}
}
}

@Test
public void testSlowLogParamsMutationProto() {
MutationProto mutationProto =
ClientProtos.MutationProto.newBuilder().setRow(ByteString.copyFromUtf8("row123")).build();

SlowLogParams slowLogParams = ProtobufUtil.getSlowLogParams(mutationProto, false);

assertTrue(slowLogParams.getParams()
.contains(Bytes.toStringBinary(mutationProto.getRow().toByteArray())));
}

@Test
public void testSlowLogParamsMutateRequest() {
MutationProto mutationProto =
ClientProtos.MutationProto.newBuilder().setRow(ByteString.copyFromUtf8("row123")).build();
ClientProtos.MutateRequest mutateRequest =
ClientProtos.MutateRequest.newBuilder().setMutation(mutationProto)
.setRegion(HBaseProtos.RegionSpecifier.newBuilder()
.setType(HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME)
.setValue(ByteString.EMPTY).build())
.build();

SlowLogParams slowLogParams = ProtobufUtil.getSlowLogParams(mutateRequest, false);

assertTrue(slowLogParams.getParams()
.contains(Bytes.toStringBinary(mutationProto.getRow().toByteArray())));
}
}