getDataStoreName methods were recently added to DatastoreContext and ActorContext
to replace the getDataStoreType methods. The latter were marked as
deprecated but we can remove them since they aren't public APIs outside
of the context of sal-distributed-datastore. The remaining callers were
migrated to the getDataStoreName methods.
Change-Id: I7dab731d96b3b8c249a59824de4d78ea72500e05
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
public static final long DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS = TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES);
public static final int DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE = 2048000;
public static final long DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS = TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES);
public static final int DEFAULT_SHARD_SNAPSHOT_CHUNK_SIZE = 2048000;
- private static final Set<String> globalDatastoreTypes = Sets.newConcurrentHashSet();
+ private static final Set<String> globalDatastoreNames = Sets.newConcurrentHashSet();
private InMemoryDOMDataStoreConfigProperties dataStoreProperties;
private Duration shardTransactionIdleTimeout = DatastoreContext.DEFAULT_SHARD_TRANSACTION_IDLE_TIMEOUT;
private InMemoryDOMDataStoreConfigProperties dataStoreProperties;
private Duration shardTransactionIdleTimeout = DatastoreContext.DEFAULT_SHARD_TRANSACTION_IDLE_TIMEOUT;
private boolean transactionDebugContextEnabled = false;
private String shardManagerPersistenceId;
private boolean transactionDebugContextEnabled = false;
private String shardManagerPersistenceId;
- public static Set<String> getGlobalDatastoreTypes() {
- return globalDatastoreTypes;
+ public static Set<String> getGlobalDatastoreNames() {
+ return globalDatastoreNames;
}
private DatastoreContext() {
}
private DatastoreContext() {
- /**
- * @deprecated Use {@link #logicalStoreType(LogicalDatastoreType)} or {@link #dataStoreName(String)}.
- */
- @Deprecated
- public Builder dataStoreType(String dataStoreType){
- return dataStoreName(dataStoreType);
- }
-
public Builder logicalStoreType(LogicalDatastoreType logicalStoreType){
datastoreContext.logicalStoreType = Preconditions.checkNotNull(logicalStoreType);
public Builder logicalStoreType(LogicalDatastoreType logicalStoreType){
datastoreContext.logicalStoreType = Preconditions.checkNotNull(logicalStoreType);
maxShardDataChangeListenerQueueSize, maxShardDataStoreExecutorQueueSize);
if(datastoreContext.dataStoreName != null) {
maxShardDataChangeListenerQueueSize, maxShardDataStoreExecutorQueueSize);
if(datastoreContext.dataStoreName != null) {
- globalDatastoreTypes.add(datastoreContext.dataStoreName);
+ globalDatastoreNames.add(datastoreContext.dataStoreName);
}
return datastoreContext;
}
return datastoreContext;
@Override
public void onDatastoreContextUpdated(DatastoreContextFactory contextFactory) {
@Override
public void onDatastoreContextUpdated(DatastoreContextFactory contextFactory) {
- LOG.info("DatastoreContext updated for data store {}", actorContext.getDataStoreType());
+ LOG.info("DatastoreContext updated for data store {}", actorContext.getDataStoreName());
actorContext.setDatastoreContext(contextFactory);
datastoreConfigMXBean.setContext(contextFactory.getBaseDatastoreContext());
actorContext.setDatastoreContext(contextFactory);
datastoreConfigMXBean.setContext(contextFactory.getBaseDatastoreContext());
configDataStore.getActorContext() : operDataStore.getActorContext();
Set<String> allShardNames = actorContext.getConfiguration().getAllShardNames();
configDataStore.getActorContext() : operDataStore.getActorContext();
Set<String> allShardNames = actorContext.getConfiguration().getAllShardNames();
- LOG.debug("Sending message to all shards {} for data store {}", allShardNames, actorContext.getDataStoreType());
+ LOG.debug("Sending message to all shards {} for data store {}", allShardNames, actorContext.getDataStoreName());
for(String shardName: allShardNames) {
ListenableFuture<T> future = this.<T>ask(actorContext.getShardManager(), messageSupplier.apply(shardName),
for(String shardName: allShardNames) {
ListenableFuture<T> future = this.<T>ask(actorContext.getShardManager(), messageSupplier.apply(shardName),
return datastoreContext.getDataStoreName();
}
return datastoreContext.getDataStoreName();
}
- /**
- * Get the type of the data store to which this ActorContext belongs
- *
- * @return
- * @deprecated Use {@link #getDataStoreName()} instead.
- */
- @Deprecated
- public String getDataStoreType() {
- return datastoreContext.getDataStoreName();
- }
-
/**
* Get the current transaction creation rate limit
* @return
/**
* Get the current transaction creation rate limit
* @return
private final ActorContext actorContext;
private final long commitTimeoutInSeconds;
private final ActorContext actorContext;
private final long commitTimeoutInSeconds;
- private final String dataStoreType;
+ private final String dataStoreName;
private final RateLimiter txRateLimiter;
private final AtomicLong acquireCount = new AtomicLong();
private final RateLimiter txRateLimiter;
private final AtomicLong acquireCount = new AtomicLong();
public TransactionRateLimiter(ActorContext actorContext){
this.actorContext = actorContext;
this.commitTimeoutInSeconds = actorContext.getDatastoreContext().getShardTransactionCommitTimeoutInSeconds();
public TransactionRateLimiter(ActorContext actorContext){
this.actorContext = actorContext;
this.commitTimeoutInSeconds = actorContext.getDatastoreContext().getShardTransactionCommitTimeoutInSeconds();
- this.dataStoreType = actorContext.getDataStoreType();
+ this.dataStoreName = actorContext.getDataStoreName();
this.txRateLimiter = RateLimiter.create(actorContext.getDatastoreContext().getTransactionCreationInitialRateLimit());
}
this.txRateLimiter = RateLimiter.create(actorContext.getDatastoreContext().getTransactionCreationInitialRateLimit());
}
private double getRateLimitFromOtherDataStores(){
// Since we have no rate data for unused Tx's data store, adjust to the rate from another
// data store that does have rate data.
private double getRateLimitFromOtherDataStores(){
// Since we have no rate data for unused Tx's data store, adjust to the rate from another
// data store that does have rate data.
- for(String datastoreType: DatastoreContext.getGlobalDatastoreTypes()) {
- if(datastoreType.equals(this.dataStoreType)) {
+ for(String name: DatastoreContext.getGlobalDatastoreNames()) {
+ if(name.equals(this.dataStoreName)) {
- double newRateLimit = calculateNewRateLimit(actorContext.getOperationTimer(datastoreType, ActorContext.COMMIT),
+ double newRateLimit = calculateNewRateLimit(actorContext.getOperationTimer(name, ActorContext.COMMIT),
this.commitTimeoutInSeconds);
if(newRateLimit > 0.0) {
LOG.debug("On unused Tx - data Store {} commit rateLimit adjusted to {}",
this.commitTimeoutInSeconds);
if(newRateLimit > 0.0) {
LOG.debug("On unused Tx - data Store {} commit rateLimit adjusted to {}",
- this.dataStoreType, newRateLimit);
+ this.dataStoreName, newRateLimit);
final Set<String> peerIds = Sets.newHashSet();
for(String p: peerMemberNames) {
peerIds.add(ShardIdentifier.builder().memberName(p).shardName(shardName).
final Set<String> peerIds = Sets.newHashSet();
for(String p: peerMemberNames) {
peerIds.add(ShardIdentifier.builder().memberName(p).shardName(shardName).
- type(datastore.getActorContext().getDataStoreType()).build().toString());
+ type(datastore.getActorContext().getDataStoreName()).build().toString());
}
verifyRaftState(datastore, shardName, new RaftStateVerifier() {
}
verifyRaftState(datastore, shardName, new RaftStateVerifier() {
ImmutableMap<String, DatastoreSnapshot> map = ImmutableMap.of(snapshots.get(0).getType(), snapshots.get(0),
snapshots.get(1).getType(), snapshots.get(1));
ImmutableMap<String, DatastoreSnapshot> map = ImmutableMap.of(snapshots.get(0).getType(), snapshots.get(0),
snapshots.get(1).getType(), snapshots.get(1));
- verifyDatastoreSnapshot(node.configDataStore().getActorContext().getDataStoreType(),
- map.get(node.configDataStore().getActorContext().getDataStoreType()), "cars", "people");
+ verifyDatastoreSnapshot(node.configDataStore().getActorContext().getDataStoreName(),
+ map.get(node.configDataStore().getActorContext().getDataStoreName()), "cars", "people");
} finally {
new File(fileName).delete();
}
} finally {
new File(fileName).delete();
}
- DatastoreContext.getGlobalDatastoreTypes().add("config");
- DatastoreContext.getGlobalDatastoreTypes().add("operational");
+ DatastoreContext.getGlobalDatastoreNames().add("config");
+ DatastoreContext.getGlobalDatastoreNames().add("operational");
TransactionRateLimiter rateLimiter = new TransactionRateLimiter(actorContext);
TransactionRateLimiter rateLimiter = new TransactionRateLimiter(actorContext);