Skip to content

Commit

Permalink
HBASE-27021 StoreFileInfo should set its initialPath in a consistent …
Browse files Browse the repository at this point in the history
…way (apache#4419)

Change-Id: I3d8a68d73fb91a31e0c8c41f50bf2cc06ff00685
Signed-off-by: Josh Elser <[email protected]>
Signed-off-by: Duo Zhang <[email protected]>
  • Loading branch information
wchevreuil authored and petersomogyi committed May 16, 2022
1 parent 3d9974e commit dc367e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public StoreFileWriter createWriter(CreateStoreFileWriterParams params) throws I

public HStoreFile createStoreFileAndReader(Path p) throws IOException {
FileSystem fs = ctx.getRegionFileSystem().getFileSystem();
StoreFileInfo info = new StoreFileInfo(conf, fs, fs.getFileStatus(p));
StoreFileInfo info = new StoreFileInfo(conf, fs, p, ctx.isPrimaryReplicaStore());
return createStoreFileAndReader(info);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private StoreFileInfo(final Configuration conf, final FileSystem fs, final FileS

this.fs = fs;
this.conf = conf;
this.initialPath = initialPath;
this.initialPath = fs.makeQualified(initialPath);
this.primaryReplica = primaryReplica;
this.noReadahead =
this.conf.getBoolean(STORE_FILE_READER_NO_READAHEAD, DEFAULT_STORE_FILE_READER_NO_READAHEAD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,16 @@ private void archiveStoreFile(int index) throws IOException {
private void closeCompactedFile(int index) throws IOException {
Collection<HStoreFile> files =
this.store.getStoreEngine().getStoreFileManager().getCompactedfiles();
HStoreFile sf = null;
Iterator<HStoreFile> it = files.iterator();
for (int i = 0; i <= index; i++) {
sf = it.next();
if (files.size() > 0) {
HStoreFile sf = null;
Iterator<HStoreFile> it = files.iterator();
for (int i = 0; i <= index; i++) {
sf = it.next();
}
sf.closeStoreFile(true);
store.getStoreEngine().getStoreFileManager()
.removeCompactedFiles(Collections.singletonList(sf));
}
sf.closeStoreFile(true);
store.getStoreEngine().getStoreFileManager().removeCompactedFiles(Lists.newArrayList(sf));
}

@Test
Expand Down

0 comments on commit dc367e9

Please sign in to comment.