|
32 | 32 | import java.util.Map.Entry;
|
33 | 33 | import java.util.Set;
|
34 | 34 | import java.util.stream.Collectors;
|
| 35 | + |
35 | 36 | import org.apache.hadoop.conf.Configuration;
|
36 | 37 | import org.apache.hadoop.fs.Path;
|
37 | 38 | import org.apache.hadoop.hbase.ClusterMetricsBuilder;
|
|
45 | 46 | import org.apache.hadoop.hbase.ServerName;
|
46 | 47 | import org.apache.hadoop.hbase.TableName;
|
47 | 48 | import org.apache.hadoop.hbase.UnknownRegionException;
|
48 |
| -import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; |
49 | 49 | import org.apache.hadoop.hbase.client.MasterSwitchType;
|
50 | 50 | import org.apache.hadoop.hbase.client.RegionInfo;
|
51 | 51 | import org.apache.hadoop.hbase.client.RegionInfoBuilder;
|
|
103 | 103 | import org.apache.hadoop.hbase.security.access.ShadedAccessControlUtil;
|
104 | 104 | import org.apache.hadoop.hbase.security.access.UserPermission;
|
105 | 105 | import org.apache.hadoop.hbase.security.visibility.VisibilityController;
|
106 |
| -import org.apache.hadoop.hbase.snapshot.ClientSnapshotDescriptionUtils; |
107 |
| -import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils; |
108 |
| -import org.apache.hadoop.hbase.util.Bytes; |
109 |
| -import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; |
110 |
| -import org.apache.hadoop.hbase.util.ForeignExceptionUtil; |
111 |
| -import org.apache.hadoop.hbase.util.Pair; |
112 |
| -import org.apache.hadoop.hbase.wal.AbstractFSWALProvider; |
113 |
| -import org.apache.hadoop.hbase.zookeeper.MetaTableLocator; |
114 |
| -import org.apache.yetus.audience.InterfaceAudience; |
115 |
| -import org.apache.zookeeper.KeeperException; |
116 |
| -import org.slf4j.Logger; |
117 |
| -import org.slf4j.LoggerFactory; |
118 |
| - |
119 |
| -import org.apache.hbase.thirdparty.com.google.protobuf.RpcController; |
120 |
| -import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException; |
121 |
| -import org.apache.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations; |
122 |
| - |
123 | 106 | import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
124 | 107 | import org.apache.hadoop.hbase.shaded.protobuf.ResponseConverter;
|
125 | 108 | import org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos;
|
|
342 | 325 | import org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.UpdateReplicationPeerConfigRequest;
|
343 | 326 | import org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.UpdateReplicationPeerConfigResponse;
|
344 | 327 | import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
|
| 328 | +import org.apache.hadoop.hbase.snapshot.ClientSnapshotDescriptionUtils; |
| 329 | +import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils; |
| 330 | +import org.apache.hadoop.hbase.util.Bytes; |
| 331 | +import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; |
| 332 | +import org.apache.hadoop.hbase.util.ForeignExceptionUtil; |
| 333 | +import org.apache.hadoop.hbase.util.Pair; |
| 334 | +import org.apache.hadoop.hbase.wal.AbstractFSWALProvider; |
| 335 | +import org.apache.hadoop.hbase.zookeeper.MetaTableLocator; |
| 336 | +import org.apache.hbase.thirdparty.com.google.protobuf.RpcController; |
| 337 | +import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException; |
| 338 | +import org.apache.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations; |
| 339 | +import org.apache.yetus.audience.InterfaceAudience; |
| 340 | +import org.apache.zookeeper.KeeperException; |
| 341 | +import org.slf4j.Logger; |
| 342 | +import org.slf4j.LoggerFactory; |
345 | 343 |
|
346 | 344 | /**
|
347 | 345 | * Implements the master RPC services.
|
@@ -1744,10 +1742,13 @@ public CompactRegionResponse compactRegion(final RpcController controller,
|
1744 | 1742 | master.checkInitialized();
|
1745 | 1743 | byte[] regionName = request.getRegion().getValue().toByteArray();
|
1746 | 1744 | TableName tableName = RegionInfo.getTable(regionName);
|
| 1745 | + // TODO: support CompactType.MOB |
1747 | 1746 | // if the region is a mob region, do the mob file compaction.
|
1748 | 1747 | if (MobUtils.isMobRegionName(tableName, regionName)) {
|
1749 | 1748 | checkHFileFormatVersionForMob();
|
1750 |
| - return compactMob(request, tableName); |
| 1749 | + //return compactMob(request, tableName); |
| 1750 | + //TODO: support CompactType.MOB |
| 1751 | + return super.compactRegion(controller, request); |
1751 | 1752 | } else {
|
1752 | 1753 | return super.compactRegion(controller, request);
|
1753 | 1754 | }
|
@@ -1790,57 +1791,6 @@ public GetRegionInfoResponse getRegionInfo(final RpcController controller,
|
1790 | 1791 | }
|
1791 | 1792 | }
|
1792 | 1793 |
|
1793 |
| - /** |
1794 |
| - * Compacts the mob files in the current table. |
1795 |
| - * @param request the request. |
1796 |
| - * @param tableName the current table name. |
1797 |
| - * @return The response of the mob file compaction. |
1798 |
| - * @throws IOException |
1799 |
| - */ |
1800 |
| - private CompactRegionResponse compactMob(final CompactRegionRequest request, |
1801 |
| - TableName tableName) throws IOException { |
1802 |
| - if (!master.getTableStateManager().isTableState(tableName, TableState.State.ENABLED)) { |
1803 |
| - throw new DoNotRetryIOException("Table " + tableName + " is not enabled"); |
1804 |
| - } |
1805 |
| - boolean allFiles = false; |
1806 |
| - List<ColumnFamilyDescriptor> compactedColumns = new ArrayList<>(); |
1807 |
| - ColumnFamilyDescriptor[] hcds = master.getTableDescriptors().get(tableName).getColumnFamilies(); |
1808 |
| - byte[] family = null; |
1809 |
| - if (request.hasFamily()) { |
1810 |
| - family = request.getFamily().toByteArray(); |
1811 |
| - for (ColumnFamilyDescriptor hcd : hcds) { |
1812 |
| - if (Bytes.equals(family, hcd.getName())) { |
1813 |
| - if (!hcd.isMobEnabled()) { |
1814 |
| - LOG.error("Column family " + hcd.getNameAsString() + " is not a mob column family"); |
1815 |
| - throw new DoNotRetryIOException("Column family " + hcd.getNameAsString() |
1816 |
| - + " is not a mob column family"); |
1817 |
| - } |
1818 |
| - compactedColumns.add(hcd); |
1819 |
| - } |
1820 |
| - } |
1821 |
| - } else { |
1822 |
| - for (ColumnFamilyDescriptor hcd : hcds) { |
1823 |
| - if (hcd.isMobEnabled()) { |
1824 |
| - compactedColumns.add(hcd); |
1825 |
| - } |
1826 |
| - } |
1827 |
| - } |
1828 |
| - if (compactedColumns.isEmpty()) { |
1829 |
| - LOG.error("No mob column families are assigned in the mob compaction"); |
1830 |
| - throw new DoNotRetryIOException( |
1831 |
| - "No mob column families are assigned in the mob compaction"); |
1832 |
| - } |
1833 |
| - if (request.hasMajor() && request.getMajor()) { |
1834 |
| - allFiles = true; |
1835 |
| - } |
1836 |
| - String familyLogMsg = (family != null) ? Bytes.toString(family) : ""; |
1837 |
| - if (LOG.isTraceEnabled()) { |
1838 |
| - LOG.trace("User-triggered mob compaction requested for table: " |
1839 |
| - + tableName.getNameAsString() + " for column family: " + familyLogMsg); |
1840 |
| - } |
1841 |
| - master.requestMobCompaction(tableName, compactedColumns, allFiles); |
1842 |
| - return CompactRegionResponse.newBuilder().build(); |
1843 |
| - } |
1844 | 1794 |
|
1845 | 1795 | @Override
|
1846 | 1796 | public IsBalancerEnabledResponse isBalancerEnabled(RpcController controller,
|
|
0 commit comments