Class HintScanPrioritizer
- java.lang.Object
-
- org.apache.accumulo.core.spi.scan.HintScanPrioritizer
-
- All Implemented Interfaces:
ScanPrioritizer
public class HintScanPrioritizer extends Object implements ScanPrioritizer
When configured for a scan executor, this prioritizer allows scanners to set priorities as integers. Lower integers result in higher priority.Scanners can put the key/values
priority=<integer>
and/orscan_type=<type>
in the map passed toScannerBase.setExecutionHints(Map)
to set the priority. When apriority
hint is set it takes precedence and the value is used as the priority. When ascan_type
hint is set the priority is looked up using the value.This prioritizer accepts the option
default_priority=<integer>
which determines what priority to use for scans without a hint. If not set, thendefault_priority
isInteger.MAX_VALUE
.This prioritizer accepts the option
bad_hint_action=fail|log|none
. This option determines what happens when a priority hint is not an integer. It defaults tolog
which logs a warning. Thefail
option throws an exception which may fail the scan. Thenone
option silently ignores invalid hints.This prioritizer accepts the option
priority.<type>=<integer>
which maps a scan type hint to a priority.When two scans have the same priority, the scan is prioritized based on last run time and then creation time.
If a secondary or tertiary priority is needed, this can be done with bit shifting. For example assume a primary priority of 1 to 3 is desired followed by a secondary priority of 1 to 10 . This can be encoded as
int priority = primary << 4 | secondary
. When the primary bits are equal the comparison naturally falls back to the secondary bits. The example does not handle the case where the primary of secondary priorities are outside expected ranges.- Since:
- 2.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.accumulo.core.spi.scan.ScanPrioritizer
ScanPrioritizer.CreateParameters
-
-
Constructor Summary
Constructors Constructor Description HintScanPrioritizer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Comparator<ScanInfo>
createComparator(ScanPrioritizer.CreateParameters params)
-
-
-
Method Detail
-
createComparator
public Comparator<ScanInfo> createComparator(ScanPrioritizer.CreateParameters params)
- Specified by:
createComparator
in interfaceScanPrioritizer
-
-