java.io.Closeable, java.lang.AutoCloseable, org.apache.hadoop.service.Service@Private
@Evolving
public class StateStoreService
extends org.apache.hadoop.service.CompositeService
StateStoreDriver and maintain the connection to the data store. There are
multiple state store driver connections supported:
StateStoreFileImpl
StateStoreFileSystemImpl
StateStoreMySQLImpl
StateStoreZooKeeperImpl
The service also supports the dynamic registration of record stores like:
MembershipStore: state of the Namenodes in the
federation.
MountTableStore: Mount table between to subclusters.
See ViewFs.
RouterStore: Router state in the federation.
DisabledNameserviceStore: Disabled name services.
| Constructor | Description |
|---|---|
StateStoreService() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
closeDriver() |
Manually shuts down the driver.
|
long |
getCacheUpdateTime() |
The last time the state store cache was fully updated.
|
StateStoreDriver |
getDriver() |
Get the state store driver.
|
java.lang.String |
getIdentifier() |
Fetch a unique identifier for this state store instance.
|
StateStoreMetrics |
getMetrics() |
Get the metrics for the State Store.
|
<T extends RecordStore<? extends BaseRecord>> |
getRecordStores() |
Get the list of all RecordStores.
|
<T extends RecordStore<?>> |
getRegisteredRecordStore(java.lang.Class<T> recordStoreClass) |
Get the record store in this State Store for a given interface.
|
java.util.Collection<java.lang.Class<? extends BaseRecord>> |
getSupportedRecords() |
List of records supported by this State Store.
|
boolean |
isDriverReady() |
Check if the driver is ready to be used.
|
boolean |
loadCache(java.lang.Class<?> clazz) |
Update the cache for a specific record store.
|
boolean |
loadCache(java.lang.Class<?> clazz,
boolean force) |
Update the cache for a specific record store.
|
void |
loadDriver() |
Load the State Store driver.
|
void |
refreshCaches() |
Refresh the cache with information from the State Store.
|
void |
refreshCaches(boolean force) |
Refresh the cache with information from the State Store.
|
void |
registerCacheExternal(StateStoreCache client) |
Register a cached record store for automatic periodic cache updates.
|
protected void |
serviceInit(org.apache.hadoop.conf.Configuration config) |
Initialize the State Store and the connection to the back-end.
|
protected void |
serviceStart() |
|
protected void |
serviceStop() |
|
void |
setIdentifier(java.lang.String id) |
Set a unique synchronization identifier for this store.
|
void |
stopCacheUpdateService() |
Stops the cache update service.
|
addIfService, addService, getServices, removeServiceclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopprotected void serviceInit(org.apache.hadoop.conf.Configuration config)
throws java.lang.Exception
serviceInit in class org.apache.hadoop.service.CompositeServiceconfig - Configuration for the State Store.java.lang.Exception - Cannot create driver for the State Store.protected void serviceStart()
throws java.lang.Exception
serviceStart in class org.apache.hadoop.service.CompositeServicejava.lang.Exceptionprotected void serviceStop()
throws java.lang.Exception
serviceStop in class org.apache.hadoop.service.CompositeServicejava.lang.Exceptionpublic <T extends RecordStore<?>> T getRegisteredRecordStore(java.lang.Class<T> recordStoreClass)
T - The type of the record store.recordStoreClass - Class of the record store.public <T extends RecordStore<? extends BaseRecord>> java.util.List<T> getRecordStores()
T - The type of the record stores that are returned.public java.util.Collection<java.lang.Class<? extends BaseRecord>> getSupportedRecords()
public void loadDriver()
public boolean isDriverReady()
@VisibleForTesting
public void closeDriver()
throws java.lang.Exception
java.lang.Exception - If the driver cannot be closed.public StateStoreDriver getDriver()
public java.lang.String getIdentifier()
public void setIdentifier(java.lang.String id)
id - Unique identifier, typically the router's RPC address.public long getCacheUpdateTime()
@VisibleForTesting public void stopCacheUpdateService()
public void registerCacheExternal(StateStoreCache client)
client - Client to the state store.public void refreshCaches()
public void refreshCaches(boolean force)
force - If we force the refresh.public boolean loadCache(java.lang.Class<?> clazz)
throws java.io.IOException
clazz - Class of the record store.java.io.IOException - if the cache update failed.public boolean loadCache(java.lang.Class<?> clazz,
boolean force)
throws java.io.IOException
clazz - Class of the record store.force - Force the update ignoring cached periods.java.io.IOException - if the cache update failed.public StateStoreMetrics getMetrics()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.