saintstack commented on a change in pull request #2800:
URL: https://github.com/apache/hbase/pull/2800#discussion_r552381002
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
##########
@@ -1206,53 +1218,34 @@ public StoreFileWriter createWriterInTmp(long
maxKeyCount, Compression.Algorithm
}
}
}
- InetSocketAddress[] favoredNodes = null;
- if (region.getRegionServerServices() != null) {
- favoredNodes = region.getRegionServerServices().getFavoredNodesForRegion(
- region.getRegionInfo().getEncodedName());
- }
- HFileContext hFileContext = createFileContext(compression,
includeMVCCReadpoint, includesTag,
- cryptoContext);
- Path familyTempDir = new Path(fs.getTempDir(), family.getNameAsString());
- StoreFileWriter.Builder builder = new StoreFileWriter.Builder(conf,
writerCacheConf,
- this.getFileSystem())
- .withOutputDir(familyTempDir)
- .withBloomType(family.getBloomFilterType())
- .withMaxKeyCount(maxKeyCount)
- .withFavoredNodes(favoredNodes)
- .withFileContext(hFileContext)
- .withShouldDropCacheBehind(shouldDropBehind)
- .withCompactedFilesSupplier(this::getCompactedFiles)
- .withFileStoragePolicy(fileStoragePolicy);
+ HFileContext hFileContext = createFileContext(compression,
includeMVCCReadpoint, includesTag);
+ Path familyTempDir = new Path(getRegionFileSystem().getTempDir(),
getColumnFamilyName());
+ StoreFileWriter.Builder builder =
+ new StoreFileWriter.Builder(conf, writerCacheConf, getFileSystem())
+ .withOutputDir(familyTempDir)
+ .withBloomType(storeContext.getBloomFilterType())
+ .withMaxKeyCount(maxKeyCount)
+ .withFavoredNodes(storeContext.getFavoredNodes())
+ .withFileContext(hFileContext)
+ .withShouldDropCacheBehind(shouldDropBehind)
+ .withCompactedFilesSupplier(storeContext.getCompactedFilesSupplier())
+ .withFileStoragePolicy(fileStoragePolicy);
return builder.build();
}
private HFileContext createFileContext(Compression.Algorithm compression,
- boolean includeMVCCReadpoint, boolean includesTag, Encryption.Context
cryptoContext) {
+ boolean includeMVCCReadpoint, boolean includesTag) {
if (compression == null) {
compression = HFile.DEFAULT_COMPRESSION_ALGORITHM;
}
- HFileContext hFileContext = new HFileContextBuilder()
- .withIncludesMvcc(includeMVCCReadpoint)
- .withIncludesTags(includesTag)
- .withCompression(compression)
- .withCompressTags(family.isCompressTags())
- .withChecksumType(checksumType)
- .withBytesPerCheckSum(bytesPerChecksum)
- .withBlockSize(blocksize)
- .withHBaseCheckSum(true)
-
.withDataBlockEncoding(family.getDataBlockEncoding())
- .withEncryptionContext(cryptoContext)
-
.withCreateTime(EnvironmentEdgeManager.currentTime())
- .withColumnFamily(family.getName())
- .withTableName(region.getTableDescriptor()
- .getTableName().getName())
- .withCellComparator(this.comparator)
- .build();
- return hFileContext;
+ HFileContext fileContext = storeContext.getDefaultFileContext();
+ fileContext.setIncludesMvcc(includeMVCCReadpoint);
+ fileContext.setIncludesTags(includesTag);
+ fileContext.setCompression(compression);
+ fileContext.setFileCreateTime(EnvironmentEdgeManager.currentTime());
Review comment:
That'd be better. If a builder, lets use it everywhere (can add a
constructor on builder that allows a bit of shortcutting auto-filling most
fields....)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]