Package org.gorpipe.gor.manager
Class BucketManager<T extends org.gorpipe.gor.table.dictionary.DictionaryEntry>
java.lang.Object
org.gorpipe.gor.manager.BucketManager<T>
public class BucketManager<T extends org.gorpipe.gor.table.dictionary.DictionaryEntry>
extends Object
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic final classBucketManager.Builder<T extends org.gorpipe.gor.table.dictionary.DictionaryEntry> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Durationstatic final BucketManager.BucketPackLevelstatic final intstatic final Durationstatic final Class<? extends org.gorpipe.gor.table.lock.TableLock>static final intstatic final intprotected Durationstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionBucketManager(org.gorpipe.gor.table.dictionary.BaseDictionaryTable<T> table) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidintbucketize(BucketManager.BucketPackLevel packLevel, int maxBucketCount) intbucketize(BucketManager.BucketPackLevel packLevel, int maxBucketCount, List<String> bucketDirs, boolean forceClean) Bucketize the given table.protected voidcleanOldBucketFiles(org.gorpipe.gor.table.lock.TableLock bucketizeLock, boolean force) Cleans up bucketFiles that are not in use and have not been accessed for a given period of time.voiddeleteBuckets(boolean force, String... buckets) Delete the given buckets.voiddeleteBuckets(String... buckets) Delete the given buckets.intprotected Stringprotected intGet effective min bucket size.intstatic BucketManager.BuildernewBuilder(org.gorpipe.gor.table.dictionary.BaseDictionaryTable table) protected final StringPick a bucket dir from a list.voidsetBucketDirs(List<String> newBucketDirs) Set the bucket dir list.voidsetBucketSize(int bucketSize) voidsetMinBucketSize(int minBucketSize)
-
Field Details
-
DEFAULT_MIN_BUCKET_SIZE
public static final int DEFAULT_MIN_BUCKET_SIZE- See Also:
-
DEFAULT_BUCKET_SIZE
public static final int DEFAULT_BUCKET_SIZE- See Also:
-
DEFAULT_MAX_BUCKET_COUNT
public static final int DEFAULT_MAX_BUCKET_COUNT- See Also:
-
DEFAULT_BUCKET_PACK_LEVEL
-
DEFAULT_LOCK_TIMEOUT
-
BUCKET_CLEANUP_INTERVAL
-
DEFAULT_LOCK_TYPE
-
HEADER_MIN_BUCKET_SIZE_KEY
- See Also:
-
HEADER_BUCKET_SIZE_KEY
- See Also:
-
HEADER_BUCKET_DIRS_KEY
- See Also:
-
HEADER_BUCKET_DIRS_LOCATION_KEY
- See Also:
-
HEADER_BUCKET_MAX_BUCKETS
- See Also:
-
gracePeriodForDeletingBuckets
-
-
Constructor Details
-
BucketManager
Default constructor.
-
-
Method Details
-
newBuilder
public static BucketManager.Builder newBuilder(org.gorpipe.gor.table.dictionary.BaseDictionaryTable table) -
bucketize
public void bucketize() -
bucketize
-
bucketize
public int bucketize(BucketManager.BucketPackLevel packLevel, int maxBucketCount, List<String> bucketDirs, boolean forceClean) Bucketize the given table.- Parameters:
packLevel- pack level to use (see BucketPackLevel).maxBucketCount- Maximum number of buckets to generate on this call, 0 or less means not set in which case we read it from the table, if its not set on the table we use default.bucketDirs- array of directories to bucketize to, ignored if null. The dirs are absolute or relative to the table dir.forceClean- Should we force clean bucket files (if force clean we ignoring grace periods).- Returns:
- buckets created.
-
deleteBuckets
Delete the given buckets.- Parameters:
buckets- list of buckets to be deleted.
-
deleteBuckets
Delete the given buckets.- Parameters:
force- should grace period be ignored.buckets- list of buckets to be deleted.
-
getEffectiveMinBucketSize
protected int getEffectiveMinBucketSize()Get effective min bucket size.- Returns:
- effective min bucket size.
-
getBucketSize
public int getBucketSize() -
setBucketSize
public void setBucketSize(int bucketSize) -
getMinBucketSize
public int getMinBucketSize() -
setMinBucketSize
public void setMinBucketSize(int minBucketSize) -
getDefaultBucketDir
-
getLockTimeout
-
setBucketDirs
Set the bucket dir list.- Parameters:
newBucketDirs- the new list of bucket dirs, absolute or relative to table dir.
-
pickBucketDir
Pick a bucket dir from a list. There couple of strategies to choose from (using the gor.table.buckets.directory.strategy option.) 'random': pick a directory by random. 'least_used': pick the directory that is least used by the dictionary. Default.- Returns:
- path to the chosen bucket dir, relative to path or absolute.
-
cleanOldBucketFiles
protected void cleanOldBucketFiles(org.gorpipe.gor.table.lock.TableLock bucketizeLock, boolean force) throws IOException Cleans up bucketFiles that are not in use and have not been accessed for a given period of time.Notes: 1. We only manage bucketdirs that are listed in the table meta data and are in use. So if we stop using a folder and there are no buckets there listed in the table then we need to manage it manually.
- Parameters:
bucketizeLock- the bucketize lock to use.force- force cleaning, ignoring grace periods.- Throws:
IOException
-