@Override public boolean equals(Object o) { boolean superEq = super.equals(o); if (!superEq) { return superEq; } MetaEntry me = (MetaEntry) o; if (!regionServer.equals(me.regionServer)) { return false; } return (modTime == me.modTime); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TabletFragmentInfo other = (TabletFragmentInfo) obj; if (regionInfo == null) { if (other.regionInfo != null) { return false; } } else if (!regionInfo.equals(other.regionInfo)) { return false; } if (tabletInfoImpl == null) { if (other.tabletInfoImpl != null) { return false; } } else if (!tabletInfoImpl.equals(other.tabletInfoImpl)) { return false; } return true; }
@Test public void testRegionInfos() throws Exception { HRegionInfo hri = createRandomRegion("testRegionInfos"); byte[] triple = HRegionInfo.toDelimitedByteArray(hri, hri, hri); List<HRegionInfo> regions = HRegionInfo.parseDelimitedFrom(triple, 0, triple.length); assertTrue(regions.size() == 3); assertTrue(regions.get(0).equals(regions.get(1))); assertTrue(regions.get(0).equals(regions.get(2))); }
@Test public void testPb() throws DeserializationException { HRegionInfo hri = HRegionInfo.FIRST_META_REGIONINFO; byte [] bytes = hri.toByteArray(); HRegionInfo pbhri = HRegionInfo.parseFrom(bytes); assertTrue(hri.equals(pbhri)); }
@Override public boolean equals(Object o) { boolean superEq = super.equals(o); if (!superEq) { return superEq; } MetaEntry me = (MetaEntry) o; if (!regionServer.equals(me.regionServer)) { return false; } return (modTime == me.modTime); }
public boolean equals(Object o) { boolean superEq = super.equals(o); if (!superEq) { return superEq; } MetaEntry me = (MetaEntry) o; if (!regionServer.equals(me.regionServer)) { return false; } return (modTime == me.modTime); } }
/** * Check if two states are the same, except timestamp */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) { return false; } RegionState tmp = (RegionState)obj; return tmp.hri.equals(hri) && tmp.state == state && ((serverName != null && serverName.equals(tmp.serverName)) || (tmp.serverName == null && serverName == null)); }
/** * @param regionInfo * @param deadServers Map of deadServers and the regions they were carrying; * can be null. * @return True if the passed regionInfo in the passed map of deadServers? */ private boolean isOnDeadServer(final HRegionInfo regionInfo, final Map<ServerName, List<Pair<HRegionInfo, Result>>> deadServers) { if (deadServers == null) return false; for (Map.Entry<ServerName, List<Pair<HRegionInfo, Result>>> deadServer: deadServers.entrySet()) { for (Pair<HRegionInfo, Result> e: deadServer.getValue()) { if (e.getFirst().equals(regionInfo)) return true; } } return false; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TabletFragmentInfo other = (TabletFragmentInfo) obj; if (regionInfo == null) { if (other.regionInfo != null) { return false; } } else if (!regionInfo.equals(other.regionInfo)) { return false; } if (tabletInfoImpl == null) { if (other.tabletInfoImpl != null) { return false; } } else if (!tabletInfoImpl.equals(other.tabletInfoImpl)) { return false; } return true; }
/** * Verify that the regionInfo is valid * @param region the region to check * @param manifest snapshot manifest to inspect */ private void verifyRegionInfo(final HRegionInfo region, final SnapshotRegionManifest manifest) throws IOException { HRegionInfo manifestRegionInfo = HRegionInfo.convert(manifest.getRegionInfo()); if (!region.equals(manifestRegionInfo)) { String msg = "Manifest region info " + manifestRegionInfo + "doesn't match expected region:" + region; throw new CorruptedSnapshotException(msg, snapshot); } } }
try { found.readFields(in); if (!region.equals(found)) { throw new CorruptedSnapshotException("Found region info (" + found + ") doesn't match expected region:" + region, snapshot);
@Test public void testRegionInfos() throws Exception { HRegionInfo hri = createRandomRegion("testRegionInfos"); byte[] triple = HRegionInfo.toDelimitedByteArray(hri, hri, hri); List<HRegionInfo> regions = HRegionInfo.parseDelimitedFrom(triple, 0, triple.length); assertTrue(regions.size() == 3); assertTrue(regions.get(0).equals(regions.get(1))); assertTrue(regions.get(0).equals(regions.get(2))); }
/** * Removes the given location from the list * @param location the location to remove * @return an RegionLocations object with removed locations or the same object * if nothing is removed */ public RegionLocations remove(HRegionLocation location) { if (location == null) return this; if (location.getRegionInfo() == null) return this; int replicaId = location.getRegionInfo().getReplicaId(); if (replicaId >= locations.length) return this; // check whether something to remove. HRL.compareTo() compares ONLY the // serverName. We want to compare the HRI's as well. if (locations[replicaId] == null || !location.getRegionInfo().equals(locations[replicaId].getRegionInfo()) || !location.equals(locations[replicaId])) { return this; } HRegionLocation[] newLocations = new HRegionLocation[locations.length]; System.arraycopy(locations, 0, newLocations, 0, locations.length); newLocations[replicaId] = null; return new RegionLocations(newLocations); }
@Test public void testPb() throws DeserializationException { HRegionInfo hri = HRegionInfo.FIRST_META_REGIONINFO; byte [] bytes = hri.toByteArray(); HRegionInfo pbhri = HRegionInfo.parseFrom(bytes); assertTrue(hri.equals(pbhri)); }
/** * Returns a StoreFileInfo from the given FileStatus. Secondary replicas refer to the * files of the primary region, so an HFileLink is used to construct the StoreFileInfo. This * way ensures that the secondary will be able to continue reading the store files even if * they are moved to archive after compaction * @throws IOException */ public static StoreFileInfo getStoreFileInfo(Configuration conf, FileSystem fs, HRegionInfo regionInfo, HRegionInfo regionInfoForFs, String familyName, Path path) throws IOException { // if this is a primary region, just return the StoreFileInfo constructed from path if (regionInfo.equals(regionInfoForFs)) { return new StoreFileInfo(conf, fs, path); } // else create a store file link. The link file does not exists on filesystem though. HFileLink link = HFileLink.build(conf, regionInfoForFs.getTable(), regionInfoForFs.getEncodedName(), familyName, path.getName()); if (StoreFileInfo.isReference(path)) { Reference reference = Reference.read(fs, path); return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference); } return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link); }
return false; if (region_a.getRegionInfo().equals(region_b.getRegionInfo())) { LOG.info("Can't merge the same region " + region_a); return false;