[
https://issues.apache.org/jira/browse/HBASE-24552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17134580#comment-17134580
]
Huaxiang Sun commented on HBASE-24552:
--------------------------------------
{code:java}
public static HRegionFileSystem createRegionOnFileSystem(final Configuration
conf,
final FileSystem fs, final Path tableDir, final RegionInfo regionInfo)
throws IOException {
HRegionFileSystem regionFs = new HRegionFileSystem(conf, fs, tableDir,
regionInfo);
// We only create a .regioninfo and the region directory if this is the
default region replica
if (regionInfo.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {
Path regionDir = regionFs.getRegionDir();
if (fs.exists(regionDir)) {
LOG.warn("Trying to create a region that already exists on disk: " +
regionDir);
} else {
// Create the region directory
if (!createDirOnFileSystem(fs, conf, regionDir)) {
LOG.warn("Unable to create the region directory: " + regionDir);
throw new IOException("Unable to create region directory: " +
regionDir);
}
}
// Write HRI to a file in case we need to recover hbase:meta
regionFs.writeRegionInfoOnFilesystem(false);
} else {
if (LOG.isDebugEnabled())
LOG.debug("Skipping creation of .regioninfo file for " + regionInfo);
}
return regionFs;
}
{code}
> Replica region needs to do check if primary region exists in hdfs during
> createRegionOnFileSystem().
> ----------------------------------------------------------------------------------------------------
>
> Key: HBASE-24552
> URL: https://issues.apache.org/jira/browse/HBASE-24552
> Project: HBase
> Issue Type: Bug
> Components: read replicas
> Affects Versions: 2.3.0
> Reporter: Huaxiang Sun
> Assignee: Huaxiang Sun
> Priority: Major
>
> When a replica is opened, it does not check if region dir exists and if
> .regionInfo exists in the directory, region server will online this replica
> region even the primary region does not exist.
>
> It needs to do better to do more checks and fails region open if the check
> does not pass.
> Maybe we can do this check in master, will see.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)