Skip to content

Commit 4ca760f

Browse files
committed
Revert "HBASE-22664 Move protobuf stuff in hbase-rsgroup to hbase-protocol-shaded (#362)"
This reverts commit d364364.
1 parent c2c9984 commit 4ca760f

File tree

11 files changed

+108
-254
lines changed

11 files changed

+108
-254
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,36 +1768,23 @@ public static ServerName toServerName(final byte [] data) throws Deserialization
17681768
return ServerName.valueOf(hostname, port, -1L);
17691769
}
17701770

1771-
public static HBaseProtos.TimeRange toTimeRange(TimeRange timeRange) {
1772-
if (timeRange == null) {
1773-
timeRange = TimeRange.allTime();
1774-
}
1775-
return HBaseProtos.TimeRange.newBuilder().setFrom(timeRange.getMin()).setTo(timeRange.getMax())
1776-
.build();
1777-
}
1778-
17791771
public static RSGroupInfo toGroupInfo(RSGroupProtos.RSGroupInfo proto) {
17801772
RSGroupInfo RSGroupInfo = new RSGroupInfo(proto.getName());
1781-
for (HBaseProtos.ServerName el : proto.getServersList()) {
1773+
for(HBaseProtos.ServerName el: proto.getServersList()) {
17821774
RSGroupInfo.addServer(Address.fromParts(el.getHostName(), el.getPort()));
17831775
}
1784-
for (HBaseProtos.TableName pTableName : proto.getTablesList()) {
1776+
for(HBaseProtos.TableName pTableName: proto.getTablesList()) {
17851777
RSGroupInfo.addTable(ProtobufUtil.toTableName(pTableName));
17861778
}
17871779
return RSGroupInfo;
17881780
}
17891781

1790-
public static RSGroupProtos.RSGroupInfo toProtoGroupInfo(RSGroupInfo pojo) {
1791-
List<HBaseProtos.TableName> tables = new ArrayList<>(pojo.getTables().size());
1792-
for (TableName arg : pojo.getTables()) {
1793-
tables.add(ProtobufUtil.toProtoTableName(arg));
1794-
}
1795-
List<HBaseProtos.ServerName> hostports = new ArrayList<>(pojo.getServers().size());
1796-
for (Address el : pojo.getServers()) {
1797-
hostports.add(HBaseProtos.ServerName.newBuilder().setHostName(el.getHostname())
1798-
.setPort(el.getPort()).build());
1782+
public static HBaseProtos.TimeRange toTimeRange(TimeRange timeRange) {
1783+
if (timeRange == null) {
1784+
timeRange = TimeRange.allTime();
17991785
}
1800-
return RSGroupProtos.RSGroupInfo.newBuilder().setName(pojo.getName()).addAllServers(hostports)
1801-
.addAllTables(tables).build();
1786+
return HBaseProtos.TimeRange.newBuilder().setFrom(timeRange.getMin())
1787+
.setTo(timeRange.getMax())
1788+
.build();
18021789
}
18031790
}

hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@
9191
import org.apache.hadoop.hbase.filter.ByteArrayComparable;
9292
import org.apache.hadoop.hbase.filter.Filter;
9393
import org.apache.hadoop.hbase.io.TimeRange;
94-
import org.apache.hadoop.hbase.net.Address;
9594
import org.apache.hadoop.hbase.protobuf.ProtobufMagic;
9695
import org.apache.hadoop.hbase.protobuf.ProtobufMessageConverter;
9796
import org.apache.hadoop.hbase.quotas.QuotaScope;
@@ -100,7 +99,6 @@
10099
import org.apache.hadoop.hbase.quotas.ThrottleType;
101100
import org.apache.hadoop.hbase.replication.ReplicationLoadSink;
102101
import org.apache.hadoop.hbase.replication.ReplicationLoadSource;
103-
import org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
104102
import org.apache.hadoop.hbase.security.visibility.Authorizations;
105103
import org.apache.hadoop.hbase.security.visibility.CellVisibility;
106104
import org.apache.hadoop.hbase.util.Addressing;
@@ -177,7 +175,6 @@
177175
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MajorCompactionTimestampResponse;
178176
import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos;
179177
import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos;
180-
import org.apache.hadoop.hbase.shaded.protobuf.generated.RSGroupProtos;
181178
import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerReportRequest;
182179
import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerStartupRequest;
183180
import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos;
@@ -3290,29 +3287,4 @@ public static Set<String> toCompactedStoreFiles(byte[] bytes) throws IOException
32903287
}
32913288
return Collections.emptySet();
32923289
}
3293-
3294-
public static RSGroupInfo toGroupInfo(RSGroupProtos.RSGroupInfo proto) {
3295-
RSGroupInfo RSGroupInfo = new RSGroupInfo(proto.getName());
3296-
for (HBaseProtos.ServerName el : proto.getServersList()) {
3297-
RSGroupInfo.addServer(Address.fromParts(el.getHostName(), el.getPort()));
3298-
}
3299-
for (HBaseProtos.TableName pTableName : proto.getTablesList()) {
3300-
RSGroupInfo.addTable(ProtobufUtil.toTableName(pTableName));
3301-
}
3302-
return RSGroupInfo;
3303-
}
3304-
3305-
public static RSGroupProtos.RSGroupInfo toProtoGroupInfo(RSGroupInfo pojo) {
3306-
List<HBaseProtos.TableName> tables = new ArrayList<>(pojo.getTables().size());
3307-
for (TableName arg : pojo.getTables()) {
3308-
tables.add(ProtobufUtil.toProtoTableName(arg));
3309-
}
3310-
List<HBaseProtos.ServerName> hostports = new ArrayList<>(pojo.getServers().size());
3311-
for (Address el : pojo.getServers()) {
3312-
hostports.add(HBaseProtos.ServerName.newBuilder().setHostName(el.getHostname())
3313-
.setPort(el.getPort()).build());
3314-
}
3315-
return RSGroupProtos.RSGroupInfo.newBuilder().setName(pojo.getName()).addAllServers(hostports)
3316-
.addAllTables(tables).build();
3317-
}
33183290
}

hbase-protocol-shaded/src/main/protobuf/RSGroup.proto

Lines changed: 0 additions & 33 deletions
This file was deleted.

hbase-protocol-shaded/src/main/protobuf/RSGroupAdmin.proto

Lines changed: 0 additions & 158 deletions
This file was deleted.

hbase-rsgroup/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@
4343
<groupId>org.apache.maven.plugins</groupId>
4444
<artifactId>maven-source-plugin</artifactId>
4545
</plugin>
46+
<plugin>
47+
<groupId>org.xolstice.maven.plugins</groupId>
48+
<artifactId>protobuf-maven-plugin</artifactId>
49+
<executions>
50+
<execution>
51+
<id>compile-protoc</id>
52+
<phase>generate-sources</phase>
53+
<goals>
54+
<goal>compile</goal>
55+
</goals>
56+
<configuration>
57+
<additionalProtoPathElements>
58+
<additionalProtoPathElement>${basedir}/../hbase-protocol/src/main/protobuf</additionalProtoPathElement>
59+
</additionalProtoPathElements>
60+
</configuration>
61+
</execution>
62+
</executions>
63+
</plugin>
4664
<plugin>
4765
<groupId>org.apache.maven.plugins</groupId>
4866
<artifactId>maven-checkstyle-plugin</artifactId>

hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminClient.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
package org.apache.hadoop.hbase.rsgroup;
1919

2020
import com.google.protobuf.ServiceException;
21+
2122
import java.io.IOException;
2223
import java.util.ArrayList;
2324
import java.util.List;
2425
import java.util.Set;
26+
2527
import org.apache.hadoop.hbase.TableName;
2628
import org.apache.hadoop.hbase.TableNotFoundException;
2729
import org.apache.hadoop.hbase.client.Admin;
@@ -68,7 +70,7 @@ public RSGroupInfo getRSGroupInfo(String groupName) throws IOException {
6870
GetRSGroupInfoResponse resp = stub.getRSGroupInfo(null,
6971
GetRSGroupInfoRequest.newBuilder().setRSGroupName(groupName).build());
7072
if(resp.hasRSGroupInfo()) {
71-
return ProtobufUtil.toGroupInfo(resp.getRSGroupInfo());
73+
return RSGroupProtobufUtil.toGroupInfo(resp.getRSGroupInfo());
7274
}
7375
return null;
7476
} catch (ServiceException e) {
@@ -83,7 +85,7 @@ public RSGroupInfo getRSGroupInfoOfTable(TableName tableName) throws IOException
8385
try {
8486
GetRSGroupInfoOfTableResponse resp = stub.getRSGroupInfoOfTable(null, request);
8587
if (resp.hasRSGroupInfo()) {
86-
return ProtobufUtil.toGroupInfo(resp.getRSGroupInfo());
88+
return RSGroupProtobufUtil.toGroupInfo(resp.getRSGroupInfo());
8789
}
8890
return null;
8991
} catch (ServiceException e) {
@@ -165,7 +167,7 @@ public List<RSGroupInfo> listRSGroups() throws IOException {
165167
ListRSGroupInfosRequest.getDefaultInstance()).getRSGroupInfoList();
166168
List<RSGroupInfo> result = new ArrayList<>(resp.size());
167169
for(RSGroupProtos.RSGroupInfo entry : resp) {
168-
result.add(ProtobufUtil.toGroupInfo(entry));
170+
result.add(RSGroupProtobufUtil.toGroupInfo(entry));
169171
}
170172
return result;
171173
} catch (ServiceException e) {
@@ -184,7 +186,7 @@ public RSGroupInfo getRSGroupOfServer(Address hostPort) throws IOException {
184186
try {
185187
GetRSGroupInfoOfServerResponse resp = stub.getRSGroupInfoOfServer(null, request);
186188
if (resp.hasRSGroupInfo()) {
187-
return ProtobufUtil.toGroupInfo(resp.getRSGroupInfo());
189+
return RSGroupProtobufUtil.toGroupInfo(resp.getRSGroupInfo());
188190
}
189191
return null;
190192
} catch (ServiceException e) {

0 commit comments

Comments
 (0)