-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-26328 Clone snapshot doesn't load reference files into FILE SFT impl #3749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
470bd2e
8b26dcc
3b9936d
1756584
0ce891a
989028b
6581fef
ab03ee1
fe91ad4
dd7949f
cb35f18
e6979ce
6c712ec
ae31799
150d995
c4d7d28
1727115
f02941a
27235c1
2e5a496
7d285ff
a120c93
c8566cf
7b03fd2
ba9600c
9c9789b
d1a91be
d75b0ce
cab6140
708b7c1
41ed7e2
f2addb1
5c35744
767a3e1
be5a148
d3556bf
c53a80d
714e6a0
bbaf3e6
8e3400e
1adaf42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,6 @@ | |
| import org.apache.hadoop.hbase.master.RegionState; | ||
| import org.apache.hadoop.hbase.master.assignment.AssignmentManager; | ||
| import org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.CreateHdfsRegions; | ||
| import org.apache.hadoop.hbase.mob.MobUtils; | ||
| import org.apache.hadoop.hbase.monitoring.MonitoredTask; | ||
| import org.apache.hadoop.hbase.monitoring.TaskMonitor; | ||
| import org.apache.hadoop.hbase.procedure2.ProcedureStateSerializer; | ||
|
|
@@ -453,56 +452,25 @@ private List<RegionInfo> createFsLayout( | |
| List<RegionInfo> newRegions, | ||
| final CreateHdfsRegions hdfsRegionHandler) throws IOException { | ||
| final MasterFileSystem mfs = env.getMasterServices().getMasterFileSystem(); | ||
| final Path tempdir = mfs.getTempDir(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Snapshots recover is another feature that was relying on temdirs & renames. I took the decision to allow restored dirs being created on the final path already, my understanding is that tables being restored/cloned will not be enabled, and if the snapshot fails at this stage, it will not get to the meta updates stages, meaning there will be no inconsistencies. There would be the need to identify and cleanout leftovers of failed snapshot recoveries. Any thoughts/suggestions?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, I think this is similiar to the merge/split scenario. There is no reason that we can not do this. And in #3716 , @frostruan is trying to implement the snapshot operationby proc-v2, so I think we could implement the clean up logic in the rollback of the procedure. |
||
|
|
||
| // 1. Create Table Descriptor | ||
| // using a copy of descriptor, table will be created enabling first | ||
| final Path tempTableDir = CommonFSUtils.getTableDir(tempdir, tableDescriptor.getTableName()); | ||
| if (CommonFSUtils.isExists(mfs.getFileSystem(), tempTableDir)) { | ||
| final Path tableDir = CommonFSUtils.getTableDir(mfs.getRootDir(), | ||
| tableDescriptor.getTableName()); | ||
| if (CommonFSUtils.isExists(mfs.getFileSystem(), tableDir)) { | ||
| // if the region dirs exist, will cause exception and unlimited retry (see HBASE-24546) | ||
| LOG.warn("temp table dir already exists on disk: {}, will be deleted.", tempTableDir); | ||
| CommonFSUtils.deleteDirectory(mfs.getFileSystem(), tempTableDir); | ||
| LOG.warn("temp table dir already exists on disk: {}, will be deleted.", tableDir); | ||
| CommonFSUtils.deleteDirectory(mfs.getFileSystem(), tableDir); | ||
Apache9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| ((FSTableDescriptors) (env.getMasterServices().getTableDescriptors())) | ||
| .createTableDescriptorForTableDirectory(tempTableDir, | ||
| TableDescriptorBuilder.newBuilder(tableDescriptor).build(), false); | ||
| ((FSTableDescriptors)(env.getMasterServices().getTableDescriptors())) | ||
| .createTableDescriptorForTableDirectory(tableDir, | ||
| TableDescriptorBuilder.newBuilder(tableDescriptor).build(), false); | ||
|
|
||
| // 2. Create Regions | ||
| newRegions = hdfsRegionHandler.createHdfsRegions( | ||
| env, tempdir, tableDescriptor.getTableName(), newRegions); | ||
|
|
||
| // 3. Move Table temp directory to the hbase root location | ||
| CreateTableProcedure.moveTempDirectoryToHBaseRoot(env, tableDescriptor, tempTableDir); | ||
| // Move Table temp mob directory to the hbase root location | ||
| Path tempMobTableDir = MobUtils.getMobTableDir(tempdir, tableDescriptor.getTableName()); | ||
| if (mfs.getFileSystem().exists(tempMobTableDir)) { | ||
| moveTempMobDirectoryToHBaseRoot(mfs, tableDescriptor, tempMobTableDir); | ||
| } | ||
| return newRegions; | ||
| } | ||
| env, mfs.getRootDir(), tableDescriptor.getTableName(), newRegions); | ||
|
|
||
| /** | ||
| * Move table temp mob directory to the hbase root location | ||
| * @param mfs The master file system | ||
| * @param tableDescriptor The table to operate on | ||
| * @param tempMobTableDir The temp mob directory of table | ||
| * @throws IOException If failed to move temp mob dir to hbase root dir | ||
| */ | ||
| private void moveTempMobDirectoryToHBaseRoot(final MasterFileSystem mfs, | ||
| final TableDescriptor tableDescriptor, final Path tempMobTableDir) throws IOException { | ||
| FileSystem fs = mfs.getFileSystem(); | ||
| final Path tableMobDir = | ||
| MobUtils.getMobTableDir(mfs.getRootDir(), tableDescriptor.getTableName()); | ||
| if (!fs.delete(tableMobDir, true) && fs.exists(tableMobDir)) { | ||
| throw new IOException("Couldn't delete mob table " + tableMobDir); | ||
| } | ||
| if (!fs.exists(tableMobDir.getParent())) { | ||
| fs.mkdirs(tableMobDir.getParent()); | ||
| } | ||
| if (!fs.rename(tempMobTableDir, tableMobDir)) { | ||
| throw new IOException("Unable to move mob table from temp=" + tempMobTableDir | ||
| + " to hbase root=" + tableMobDir); | ||
| } | ||
| return newRegions; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.