regionNames.remove(regionName); metaChanges.addRegionToRestore(ProtobufUtil.toRegionInfo(regionManifests.get(regionName) .getRegionInfo())); } else { LOG.info("region to remove: " + regionName); LOG.info("region to add: " + regionName); regionsToAdd.add(ProtobufUtil.toRegionInfo(regionManifests.get(regionName) .getRegionInfo()));
for (FamilyFiles ff : rm.getFamilyFilesList()) {
HRegionFileSystem regionFs = HRegionFileSystem.openRegionFromFileSystem(conf, fs, tableDir, regionInfo, true); SnapshotRegionManifest.Builder manifest = SnapshotRegionManifest.newBuilder();
RegionInfo hri = ProtobufUtil.toRegionInfo(snapshotRegionManifest.getRegionInfo()); if (hri.isOffline() && (hri.isSplit() || hri.isSplitParent())) { continue;
public Builder mergeFrom(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest other) { if (other == org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest.getDefaultInstance()) return this; if (other.hasVersion()) { setVersion(other.getVersion()); if (other.hasRegionInfo()) { mergeRegionInfo(other.getRegionInfo());
private Path createRegionManifest() throws IOException { byte[] startKey = Bytes.toBytes("AAAAAA"); byte[] stopKey = Bytes.toBytes("BBBBBB"); HRegionInfo regionInfo = new HRegionInfo(TABLE_NAME, startKey, stopKey, false); SnapshotRegionManifest.Builder dataRegionManifestBuilder = SnapshotRegionManifest.newBuilder(); dataRegionManifestBuilder.setRegionInfo(HRegionInfo.convert(regionInfo)); for (ColumnFamilyDescriptor hcd: builder.getTableDescriptor().getColumnFamilies()) { SnapshotRegionManifest.FamilyFiles.Builder family = SnapshotRegionManifest.FamilyFiles.newBuilder(); family.setFamilyName(UnsafeByteOperations.unsafeWrap(hcd.getName())); for (int j = 0; j < TEST_NUM_REGIONFILES; ++j) { SnapshotRegionManifest.StoreFile.Builder sfManifest = SnapshotRegionManifest.StoreFile.newBuilder(); sfManifest.setName(String.format("%064d", j)); sfManifest.setFileSize(j * 1024); family.addStoreFiles(sfManifest.build()); } dataRegionManifestBuilder.addFamilyFiles(family.build()); } SnapshotRegionManifest manifest = dataRegionManifestBuilder.build(); Path regionPath = new Path(snapshotDir, SnapshotManifestV2.SNAPSHOT_MANIFEST_PREFIX + regionInfo.getEncodedName()); FSDataOutputStream stream = fs.create(regionPath); try { manifest.writeTo(stream); } finally { stream.close(); } return regionPath; }
HRegionInfo regionInfo = new HRegionInfo(TABLE_NAME, startKey, stopKey, false); SnapshotRegionManifest.Builder dataRegionManifestBuilder = SnapshotRegionManifest.newBuilder();
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest)) { return super.equals(obj); } org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest other = (org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest) obj; boolean result = true; result = result && (hasVersion() == other.hasVersion()); if (hasVersion()) { result = result && (getVersion() == other.getVersion()); } result = result && (hasRegionInfo() == other.hasRegionInfo()); if (hasRegionInfo()) { result = result && getRegionInfo() .equals(other.getRegionInfo()); } result = result && getFamilyFilesList() .equals(other.getFamilyFilesList()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasVersion()) { hash = (37 * hash) + VERSION_FIELD_NUMBER; hash = (53 * hash) + getVersion(); } if (hasRegionInfo()) { hash = (37 * hash) + REGION_INFO_FIELD_NUMBER; hash = (53 * hash) + getRegionInfo().hashCode(); } if (getFamilyFilesCount() > 0) { hash = (37 * hash) + FAMILY_FILES_FIELD_NUMBER; hash = (53 * hash) + getFamilyFilesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream .computeInt32Size(1, version_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream .computeMessageSize(2, getRegionInfo()); } for (int i = 0; i < familyFiles_.size(); i++) { size += org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream .computeMessageSize(3, familyFiles_.get(i)); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
/** * Get list of region locations from SnapshotManifest * BaseResultIterators assume that regions are sorted using RegionInfo.COMPARATOR */ private List<HRegionLocation> getRegionLocationsFromManifest(SnapshotManifest manifest) { List<SnapshotRegionManifest> regionManifests = manifest.getRegionManifests(); Preconditions.checkNotNull(regionManifests); List<RegionInfo> regionInfos = Lists.newArrayListWithCapacity(regionManifests.size()); List<HRegionLocation> hRegionLocations = Lists.newArrayListWithCapacity(regionManifests.size()); for (SnapshotRegionManifest regionManifest : regionManifests) { RegionInfo regionInfo = ProtobufUtil.toRegionInfo(regionManifest.getRegionInfo()); if (isValidRegion(regionInfo)) { regionInfos.add(regionInfo); } } regionInfos.sort(RegionInfo.COMPARATOR); for (RegionInfo regionInfo : regionInfos) { hRegionLocations.add(new HRegionLocation(regionInfo, null)); } return hRegionLocations; }
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; if (!hasRegionInfo()) { memoizedIsInitialized = 0; return false; } if (!getRegionInfo().isInitialized()) { memoizedIsInitialized = 0; return false; } for (int i = 0; i < getFamilyFilesCount(); i++) { if (!getFamilyFiles(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }
public static List<HRegionInfo> getRegionInfosFromManifest(SnapshotManifest manifest) { List<SnapshotRegionManifest> regionManifests = manifest.getRegionManifests(); if (regionManifests == null) { throw new IllegalArgumentException("Snapshot seems empty"); } List<HRegionInfo> regionInfos = Lists.newArrayListWithCapacity(regionManifests.size()); for (SnapshotRegionManifest regionManifest : regionManifests) { HRegionInfo hri = HRegionInfo.convert(regionManifest.getRegionInfo()); if (hri.isOffline() && (hri.isSplit() || hri.isSplitParent())) { continue; } regionInfos.add(hri); } return regionInfos; }
public static List<HRegionInfo> getRegionInfosFromManifest(SnapshotManifest manifest) { List<SnapshotRegionManifest> regionManifests = manifest.getRegionManifests(); if (regionManifests == null) { throw new IllegalArgumentException("Snapshot seems empty"); } List<HRegionInfo> regionInfos = Lists.newArrayListWithCapacity(regionManifests.size()); for (SnapshotRegionManifest regionManifest : regionManifests) { HRegionInfo hri = HRegionInfo.convert(regionManifest.getRegionInfo()); if (hri.isOffline() && (hri.isSplit() || hri.isSplitParent())) { continue; } regionInfos.add(hri); } return regionInfos; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
public void writeTo(org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, version_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(2, getRegionInfo()); } for (int i = 0; i < familyFiles_.size(); i++) { output.writeMessage(3, familyFiles_.get(i)); } unknownFields.writeTo(output); }
private List<HRegionLocation> getRegionLocationsFromManifest(SnapshotManifest manifest) { List<SnapshotRegionManifest> regionManifests = manifest.getRegionManifests(); Preconditions.checkNotNull(regionManifests); List<HRegionLocation> regionLocations = Lists.newArrayListWithCapacity(regionManifests.size()); for (SnapshotRegionManifest regionManifest : regionManifests) { regionLocations.add(new HRegionLocation( ProtobufUtil.toRegionInfo(regionManifest.getRegionInfo()), null)); } return regionLocations; }
/** * Get list of region locations from SnapshotManifest * BaseResultIterators assume that regions are sorted using RegionInfo.COMPARATOR */ private List<HRegionLocation> getRegionLocationsFromManifest(SnapshotManifest manifest) { List<SnapshotRegionManifest> regionManifests = manifest.getRegionManifests(); Preconditions.checkNotNull(regionManifests); List<RegionInfo> regionInfos = Lists.newArrayListWithCapacity(regionManifests.size()); List<HRegionLocation> hRegionLocations = Lists.newArrayListWithCapacity(regionManifests.size()); for (SnapshotRegionManifest regionManifest : regionManifests) { RegionInfo regionInfo = ProtobufUtil.toRegionInfo(regionManifest.getRegionInfo()); if (isValidRegion(regionInfo)) { regionInfos.add(regionInfo); } } regionInfos.sort(RegionInfo.COMPARATOR); for (RegionInfo regionInfo : regionInfos) { hRegionLocations.add(new HRegionLocation(regionInfo, null)); } return hRegionLocations; }
RegionInfo hri = ProtobufUtil.toRegionInfo(snapshotRegionManifest.getRegionInfo()); if (hri.isOffline() && (hri.isSplit() || hri.isSplitParent())) { continue;
public Builder mergeFrom(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest other) { if (other == org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest.getDefaultInstance()) return this; if (other.hasVersion()) { setVersion(other.getVersion()); if (other.hasRegionInfo()) { mergeRegionInfo(other.getRegionInfo());