Class RatioBasedCompactionPlanner
- All Implemented Interfaces:
CompactionPlanner
The following configuration options are supported. Replace <service> with the name of the
compaction service you are configuring.
- Note that the CompactionCoordinator and at least one running Compactor must be assigned to the "large" compactor group.
compaction.service.<service>.planner.opts.maxOpenThis determines the maximum number of files that will be included in a single compaction.compaction.service.<service>.planner.opts.groupsThis is a json array of compactor group objects which have the following fields:Default Compaction Planner Group options Field Name Description group name of the compactor resource group (required) maxSize threshold sum of the input files (required for all but one of the configs)
This 'groups' object provides information that is used for mapping a compaction job to a compactor group. The maxSize field determines the maximum size of compaction that will run in a group. The maxSize field can have a suffix of K,M,G for kilobytes, megabytes, or gigabytes and represents the sum of the input files for a given compaction. One group can have no max size and it will run everything that is too large for the other groups. If all groups have a max size, then system compactions will only run for compactions smaller than the largest max size. User and selector compactions will always run, even if there is no group for their size. These compactions will run on the group with the largest max size. The following example value for this property will create three separate compactor groups. "small" will run compactions of files whose file size sum is less than 100M, "medium" will run compactions of files whose file size sum is less than 500M, and "large" will run all other compactions on Compactors configured to pull jobs from the large group.[ {"group":"small", "maxSize":"100M"}, {"group":"medium", "maxSize":"500M"}, {"group": "large"} ]
Starting with Accumulo 2.1.3, this plugin will use the table config option
"table.file.max". When the following four conditions are met, then this plugin will try
to find a lower compaction ratio that will result in a compaction:
- When a tablet has no compactions running
- Its number of files exceeds table.file.max
- System compactions are not finding anything to compact
- No files are selected for user compaction
tserver.compaction.major.service.<service>.opts.lowestRatio- Since:
- 4.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.accumulo.core.spi.compaction.CompactionPlanner
CompactionPlanner.InitParameters, CompactionPlanner.PlanningParameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinit(CompactionPlanner.InitParameters params) Plan what work a compaction service should do.
-
Constructor Details
-
RatioBasedCompactionPlanner
public RatioBasedCompactionPlanner()
-
-
Method Details
-
init
- Specified by:
initin interfaceCompactionPlanner
-
makePlan
Description copied from interface:CompactionPlannerPlan what work a compaction service should do. The kind of compaction returned by
CompactionPlanner.PlanningParameters.getKind()determines what must be done with the files returned byCompactionPlanner.PlanningParameters.getCandidates(). The following are the expectations for the candidates for each kind.- CompactionKind.SYSTEM The planner is not required to do anything with the candidates and can choose to compact zero or more of them. The candidates may represent a subset of all the files in the case where a user compaction is in progress or other compactions are running.
- CompactionKind.USER and CompactionKind.SELECTED. The planner is required to eventually compact all candidates. Its ok to return a compaction plan that compacts a subset. When the planner compacts a subset, it will eventually be called again later. When it is called later the candidates will contain the files it did not compact and the results of any previous compactions it scheduled. The planner must eventually compact all of the files in the candidate set down to a single file. The compaction service will keep calling the planner until it does.
For a user and selector compaction assume the same thing happens, it will result in a slightly different outcome.
- The candidate set passed to makePlan contains the files
[F1,F2,F3,F4]and kind is USER - The planner returns a job to compact files
[F1,F2]on executor E1 - The compaction runs compacting
[F1,F2]into file[F5]
For the case above, eventually the planner will called again with a candidate set of
[F3,F4,F5]and it must eventually compact those three files to one.When a planner returns a compactions plan, task will be queued on a compactor group. Previously queued task that do not match the latest plan are removed. The planner is called periodically, whenever a new file is added, and whenever a compaction finishes.
Use
CompactionPlanner.PlanningParameters.createPlanBuilder()to build the plan this function returns.- Specified by:
makePlanin interfaceCompactionPlanner- See Also:
-