@@ -93,7 +93,6 @@ public class HMobStore extends HStore {
93
93
private AtomicLong mobFlushedCellsSize = new AtomicLong ();
94
94
private AtomicLong mobScanCellsCount = new AtomicLong ();
95
95
private AtomicLong mobScanCellsSize = new AtomicLong ();
96
- private ColumnFamilyDescriptor family ;
97
96
private Map <TableName , List <Path >> map = new ConcurrentHashMap <>();
98
97
private final IdLock keyLock = new IdLock ();
99
98
// When we add a MOB reference cell to the HFile, we will add 2 tags along with it
@@ -107,16 +106,15 @@ public class HMobStore extends HStore {
107
106
public HMobStore (final HRegion region , final ColumnFamilyDescriptor family ,
108
107
final Configuration confParam , boolean warmup ) throws IOException {
109
108
super (region , family , confParam , warmup );
110
- this .family = family ;
111
109
this .mobFileCache = region .getMobFileCache ();
112
110
this .homePath = MobUtils .getMobHome (conf );
113
111
this .mobFamilyPath = MobUtils .getMobFamilyPath (conf , this .getTableName (),
114
- family . getNameAsString ());
112
+ getColumnFamilyName ());
115
113
List <Path > locations = new ArrayList <>(2 );
116
114
locations .add (mobFamilyPath );
117
115
TableName tn = region .getTableDescriptor ().getTableName ();
118
116
locations .add (HFileArchiveUtil .getStoreArchivePath (conf , tn , MobUtils .getMobRegionInfo (tn )
119
- .getEncodedName (), family . getNameAsString ()));
117
+ .getEncodedName (), getColumnFamilyName ()));
120
118
map .put (tn , locations );
121
119
List <Tag > tags = new ArrayList <>(2 );
122
120
tags .add (MobConstants .MOB_REF_TAG );
@@ -209,7 +207,7 @@ public StoreFileWriter createWriterInTmp(String date, Path basePath, long maxKey
209
207
Compression .Algorithm compression , byte [] startKey ,
210
208
boolean isCompaction ) throws IOException {
211
209
MobFileName mobFileName = MobFileName .create (startKey , date , UUID .randomUUID ()
212
- .toString ().replaceAll ("-" , "" ), region .getRegionInfo ().getEncodedName ());
210
+ .toString ().replaceAll ("-" , "" ), getHRegion () .getRegionInfo ().getEncodedName ());
213
211
return createWriterInTmp (mobFileName , basePath , maxKeyCount , compression , isCompaction );
214
212
}
215
213
@@ -226,9 +224,11 @@ public StoreFileWriter createWriterInTmp(String date, Path basePath, long maxKey
226
224
public StoreFileWriter createWriterInTmp (MobFileName mobFileName , Path basePath ,
227
225
long maxKeyCount , Compression .Algorithm compression ,
228
226
boolean isCompaction ) throws IOException {
229
- return MobUtils .createWriter (conf , region .getFilesystem (), family ,
230
- new Path (basePath , mobFileName .getFileName ()), maxKeyCount , compression , cacheConf ,
231
- cryptoContext , checksumType , bytesPerChecksum , blocksize , BloomType .NONE , isCompaction );
227
+ return MobUtils .createWriter (conf , getFileSystem (), getColumnFamilyDescriptor (),
228
+ new Path (basePath , mobFileName .getFileName ()), maxKeyCount , compression , getCacheConfig (),
229
+ getStoreContext ().getEncryptionContext (), StoreUtils .getChecksumType (conf ),
230
+ StoreUtils .getBytesPerChecksum (conf ), getStoreContext ().getBlockSize (), BloomType .NONE ,
231
+ isCompaction );
232
232
}
233
233
234
234
/**
@@ -245,10 +245,10 @@ public void commitFile(final Path sourceFile, Path targetPath) throws IOExceptio
245
245
validateMobFile (sourceFile );
246
246
LOG .info (" FLUSH Renaming flushed file from {} to {}" , sourceFile , dstPath );
247
247
Path parent = dstPath .getParent ();
248
- if (!region . getFilesystem ().exists (parent )) {
249
- region . getFilesystem ().mkdirs (parent );
248
+ if (!getFileSystem ().exists (parent )) {
249
+ getFileSystem ().mkdirs (parent );
250
250
}
251
- if (!region . getFilesystem ().rename (sourceFile , dstPath )) {
251
+ if (!getFileSystem ().rename (sourceFile , dstPath )) {
252
252
throw new IOException ("Failed rename of " + sourceFile + " to " + dstPath );
253
253
}
254
254
}
@@ -261,7 +261,7 @@ public void commitFile(final Path sourceFile, Path targetPath) throws IOExceptio
261
261
private void validateMobFile (Path path ) throws IOException {
262
262
HStoreFile storeFile = null ;
263
263
try {
264
- storeFile = new HStoreFile (region . getFilesystem (), path , conf , this . cacheConf ,
264
+ storeFile = new HStoreFile (getFileSystem (), path , conf , getCacheConfig () ,
265
265
BloomType .NONE , isPrimaryReplicaStore ());
266
266
storeFile .initReader ();
267
267
} catch (IOException e ) {
@@ -352,9 +352,11 @@ public List<Path> getLocations(TableName tableName) throws IOException {
352
352
locations = map .get (tableName );
353
353
if (locations == null ) {
354
354
locations = new ArrayList <>(2 );
355
- locations .add (MobUtils .getMobFamilyPath (conf , tableName , family .getNameAsString ()));
355
+ locations .add (MobUtils .getMobFamilyPath (conf , tableName , getColumnFamilyDescriptor ()
356
+ .getNameAsString ()));
356
357
locations .add (HFileArchiveUtil .getStoreArchivePath (conf , tableName ,
357
- MobUtils .getMobRegionInfo (tableName ).getEncodedName (), family .getNameAsString ()));
358
+ MobUtils .getMobRegionInfo (tableName ).getEncodedName (), getColumnFamilyDescriptor ()
359
+ .getNameAsString ()));
358
360
map .put (tableName , locations );
359
361
}
360
362
} finally {
@@ -388,7 +390,7 @@ private MobCell readCell(List<Path> locations, String fileName, Cell search,
388
390
MobFile file = null ;
389
391
Path path = new Path (location , fileName );
390
392
try {
391
- file = mobFileCache .openFile (fs , path , cacheConf );
393
+ file = mobFileCache .openFile (fs , path , getCacheConfig () );
392
394
return readPt != -1 ? file .readCell (search , cacheMobBlocks , readPt )
393
395
: file .readCell (search , cacheMobBlocks );
394
396
} catch (IOException e ) {
0 commit comments