Interface Ample
-
- All Known Implementing Classes:
AmpleImpl
public interface Ample
Accumulo Metadata Persistence Layer. Entry point and abstractions layer for reading and updating persisted Accumulo metadata. This metadata may be stored in Zookeeper or in Accumulo system tables.This interface seeks to satisfy the following goals.
- Provide a single entry point for all reading and writing of Accumulo Metadata.
- The root tablet persists its data in Zookeeper. Metadata tablets persist their data in root tablet. All other tablets persist their data in the metadata table. This interface abstracts how and where information for a tablet is actually persisted.
- Before the creation of this interface, many concurrent metadata table updates resulted in separate synchronous RPCs. The design of this interface allows batching of metadata table updates within a tablet server for cluster wide efficiencies. Batching is not required by implementations, but the design of the interface makes it possible.
- Make code that updates Accumulo persistent metadata more concise. Before this interface existed, there was a lot of redundant and verbose code for updating metadata.
- Reduce specialized code for the root tablet. Currently there is specialized code to manage the root tablets files that is different from all other tablets. This interface is the beginning of an effort to remove this specialized code. See #936
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Ample.DataLevel
Accumulo is a distributed tree with three levels.static class
Ample.ReadConsistency
Controls how Accumulo metadata is read.static interface
Ample.TabletMutator
Interface for changing a tablets persistent data.static interface
Ample.TabletsMutator
This interface allows efficiently updating multiple tablets.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Mutation
createDeleteMutation(ReferenceFile tabletFilePathToRemove)
Return an encoded delete marker Mutation to delete the specified TabletFile path.default void
deleteExternalCompactionFinalStates(Collection<ExternalCompactionId> statusesToDelete)
default void
deleteGcCandidates(Ample.DataLevel level, Collection<String> paths)
default void
deleteScanServerFileReferences(String serverAddress, UUID serverSessionId)
Delete scan server references for this serverdefault void
deleteScanServerFileReferences(Collection<ScanServerRefTabletFile> refsToDelete)
Delete the set of scan server referencesdefault Stream<ExternalCompactionFinalState>
getExternalCompactionFinalStates()
default Iterator<String>
getGcCandidates(Ample.DataLevel level)
default Stream<ScanServerRefTabletFile>
getScanServerFileReferences()
Get ScanServer references to Tablet filesdefault Ample.TabletMutator
mutateTablet(KeyExtent extent)
Initiates mutating a single tablets persistent metadata.default Ample.TabletsMutator
mutateTablets()
Use this when updating multiple tablets.default void
putExternalCompactionFinalStates(Collection<ExternalCompactionFinalState> finalStates)
default void
putGcCandidates(TableId tableId, Collection<StoredTabletFile> candidates)
default void
putGcFileAndDirCandidates(TableId tableId, Collection<ReferenceFile> candidates)
UnlikeputGcCandidates(TableId, Collection)
this takes file and dir GC candidates.default void
putScanServerFileReferences(Collection<ScanServerRefTabletFile> scanRefs)
Insert ScanServer references to Tablet filesTabletMetadata
readTablet(KeyExtent extent, Ample.ReadConsistency readConsistency, TabletMetadata.ColumnType... colsToFetch)
Read a single tablets metadata.default TabletMetadata
readTablet(KeyExtent extent, TabletMetadata.ColumnType... colsToFetch)
Read a single tablets metadata.TabletsMetadata.TableOptions
readTablets()
Entry point for reading multiple tablets' metadata.
-
-
-
Method Detail
-
readTablet
default TabletMetadata readTablet(KeyExtent extent, TabletMetadata.ColumnType... colsToFetch)
Read a single tablets metadata. No checking is done for prev row, so it could differ. The method will read the data usingAmple.ReadConsistency.IMMEDIATE
.- Parameters:
extent
- Reads tablet metadata using the table id and end row from this extent.colsToFetch
- What tablets columns to fetch. If empty, then everything is fetched.
-
readTablet
TabletMetadata readTablet(KeyExtent extent, Ample.ReadConsistency readConsistency, TabletMetadata.ColumnType... colsToFetch)
Read a single tablets metadata. No checking is done for prev row, so it could differ.- Parameters:
extent
- Reads tablet metadata using the table id and end row from this extent.readConsistency
- Controls how the data is read.colsToFetch
- What tablets columns to fetch. If empty, then everything is fetched.
-
readTablets
TabletsMetadata.TableOptions readTablets()
Entry point for reading multiple tablets' metadata. Generates a TabletsMetadata builder object and assigns the AmpleImpl client to that builder object. This allows readTablets() to be called from a ClientContext. Associated methods of the TabletsMetadata Builder class are used to generate the metadata.
-
mutateTablet
default Ample.TabletMutator mutateTablet(KeyExtent extent)
Initiates mutating a single tablets persistent metadata. No data is persisted until themutate()
method is called on the returned object. If updating multiple tablets, consider usingmutateTablets()
- Parameters:
extent
- Mutates a tablet that has this table id and end row. The prev end row is not considered or checked.
-
mutateTablets
default Ample.TabletsMutator mutateTablets()
Use this when updating multiple tablets. Ensure the returns TabletsMutator is closed, or data may not be persisted.
-
putGcCandidates
default void putGcCandidates(TableId tableId, Collection<StoredTabletFile> candidates)
-
putGcFileAndDirCandidates
default void putGcFileAndDirCandidates(TableId tableId, Collection<ReferenceFile> candidates)
UnlikeputGcCandidates(TableId, Collection)
this takes file and dir GC candidates.
-
deleteGcCandidates
default void deleteGcCandidates(Ample.DataLevel level, Collection<String> paths)
-
getGcCandidates
default Iterator<String> getGcCandidates(Ample.DataLevel level)
-
putExternalCompactionFinalStates
default void putExternalCompactionFinalStates(Collection<ExternalCompactionFinalState> finalStates)
-
getExternalCompactionFinalStates
default Stream<ExternalCompactionFinalState> getExternalCompactionFinalStates()
-
deleteExternalCompactionFinalStates
default void deleteExternalCompactionFinalStates(Collection<ExternalCompactionId> statusesToDelete)
-
createDeleteMutation
default Mutation createDeleteMutation(ReferenceFile tabletFilePathToRemove)
Return an encoded delete marker Mutation to delete the specified TabletFile path. A ReferenceFile is used for the parameter because the Garbage Collector is optimized to store a directory for Tablet File. Otherwise, aTabletFile
object could be used. The tabletFilePathToRemove is validated and normalized before creating the mutation.- Parameters:
tabletFilePathToRemove
- String full path of the TabletFile- Returns:
- Mutation with encoded delete marker
-
putScanServerFileReferences
default void putScanServerFileReferences(Collection<ScanServerRefTabletFile> scanRefs)
Insert ScanServer references to Tablet files- Parameters:
scanRefs
- set of scan server ref table file objects
-
getScanServerFileReferences
default Stream<ScanServerRefTabletFile> getScanServerFileReferences()
Get ScanServer references to Tablet files- Returns:
- stream of scan server references
-
deleteScanServerFileReferences
default void deleteScanServerFileReferences(Collection<ScanServerRefTabletFile> refsToDelete)
Delete the set of scan server references- Parameters:
refsToDelete
- set of scan server references to delete
-
-