gvprathyusha6 commented on code in PR #5834:
URL: https://github.com/apache/hbase/pull/5834#discussion_r1571005337
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/storefiletracker/StoreFileTrackerBase.java:
##########
@@ -189,6 +202,107 @@ public final StoreFileWriter
createWriter(CreateStoreFileWriterParams params) th
return builder.build();
}
+ @Override
+ public String createHFileLink(CreateHFileLinkParams params) throws
IOException {
+ String name = HFileLink.createHFileLinkName(params.getLinkedTable(),
params.getLinkedRegion(),
+ params.getHfileName());
+ String refName =
+ HFileLink.createBackReferenceName(params.getDstTableName(),
params.getDstRegionName());
+
+ // Make sure the destination directory exists
+ params.getFs().mkdirs(params.getDstFamilyPath());
+
+ // Make sure the FileLink reference directory exists
+ Path archiveStoreDir = HFileArchiveUtil.getStoreArchivePath(conf,
params.getLinkedTable(),
+ params.getLinkedRegion(), params.getFamilyName());
+ Path backRefPath = null;
+ if (params.isCreateBackRef()) {
+ Path backRefssDir = HFileLink.getBackReferencesDir(archiveStoreDir,
params.getHfileName());
+ params.getFs().mkdirs(backRefssDir);
+
+ // Create the reference for the link
+ backRefPath = new Path(backRefssDir, refName);
+ params.getFs().createNewFile(backRefPath);
+ }
+ try {
+ // Create the link
+ if (params.getFs().createNewFile(new Path(params.getDstFamilyPath(),
name))) {
+ return name;
+ }
+ } catch (IOException e) {
+ LOG.error("couldn't create the link=" + name + " for " +
params.getDstFamilyPath(), e);
+ // Revert the reference if the link creation failed
+ if (params.isCreateBackRef()) {
+ params.getFs().delete(backRefPath, false);
+ }
+ throw e;
+ }
+ throw new IOException(
+ "File link=" + name + " already exists under " +
params.getDstFamilyPath() + " folder.");
+ }
+
+ @Override
+ public Reference createReference(Reference reference, Path path) throws
IOException {
Review Comment:
Yes thats correct, we will move it respective impl classes once we have the
implementation of virtual links ready in FSFT
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]