Skip to content
Browse files

Removed unused "num.cleanup.permits" param and replaced it with "num.…

…scan.permits". These permits are shared by all jobs which scan the disk - slop pusher job, clean-up job and repair job
  • Loading branch information...
1 parent 24b21fa commit 6443cc8a65b42d70ed2c84d0541095edaf98aa7f @rsumbaly rsumbaly committed with afeinberg Jan 3, 2011
View
12 src/java/voldemort/server/VoldemortConfig.java
@@ -103,7 +103,7 @@
private int schedulerThreads;
- private int numCleanupPermits;
+ private int numScanPermits;
private RequestFormatType requestFormatType;
@@ -278,7 +278,7 @@ public VoldemortConfig(Props props) {
this.schedulerThreads = props.getInt("scheduler.threads", 6);
- this.numCleanupPermits = props.getInt("num.cleanup.permits", 1);
+ this.numScanPermits = props.getInt("num.scan.permits", 1);
this.storageConfigurations = props.getList("storage.configs",
ImmutableList.of(BdbStorageConfiguration.class.getName(),
@@ -1095,12 +1095,12 @@ public void setEnableServerRouting(boolean enableServerRouting) {
this.enableServerRouting = enableServerRouting;
}
- public int getNumCleanupPermits() {
- return numCleanupPermits;
+ public int getNumScanPermits() {
+ return numScanPermits;
}
- public void setNumCleanupPermits(int numCleanupPermits) {
- this.numCleanupPermits = numCleanupPermits;
+ public void setNumScanPermits(int numScanPermits) {
+ this.numScanPermits = numScanPermits;
}
public String getFailureDetectorImplementation() {
View
20 src/java/voldemort/server/storage/StorageService.java
@@ -113,8 +113,9 @@
private final StoreRepository storeRepository;
private final SchedulerService scheduler;
private final MetadataStore metadata;
- private final Semaphore cleanupPermits;
- private final Semaphore repairPermits;
+
+ // Common permit shared by all job which do a disk scan
+ private final Semaphore scanPermits;
private final SocketStoreFactory storeFactory;
private final ConcurrentMap<String, StorageConfiguration> storageConfigs;
private final ClientThreadPool clientThreadPool;
@@ -131,8 +132,7 @@ public StorageService(StoreRepository storeRepository,
this.scheduler = scheduler;
this.storeRepository = storeRepository;
this.metadata = metadata;
- this.cleanupPermits = new Semaphore(1);
- this.repairPermits = new Semaphore(1);
+ this.scanPermits = new Semaphore(voldemortConfig.getNumScanPermits());
this.storageConfigs = new ConcurrentHashMap<String, StorageConfiguration>();
this.clientThreadPool = new ClientThreadPool(config.getClientMaxThreads(),
config.getClientThreadIdleMs(),
@@ -217,12 +217,12 @@ protected void startInner() {
metadata,
failureDetector,
voldemortConfig,
- repairPermits)
+ scanPermits)
: new StreamingSlopPusherJob(storeRepository,
metadata,
failureDetector,
voldemortConfig,
- repairPermits),
+ scanPermits),
nextRun,
voldemortConfig.getSlopFrequencyMs());
@@ -236,7 +236,7 @@ protected void startInner() {
nextRun = cal.getTime();
logger.info("Initializing repair job " + voldemortConfig.getPusherType() + " at "
+ nextRun);
- RepairJob job = new RepairJob(storeRepository, metadata, repairPermits);
+ RepairJob job = new RepairJob(storeRepository, metadata, scanPermits);
JmxUtils.registerMbean(job, JmxUtils.createObjectName(job.getClass()));
scheduler.schedule("repair", job, nextRun, voldemortConfig.getRepairFrequencyMs());
@@ -514,7 +514,7 @@ private void scheduleCleanupJob(StoreDefinition storeDef,
EventThrottler throttler = new EventThrottler(maxReadRate);
Runnable cleanupJob = new DataCleanupJob<ByteArray, byte[], byte[]>(engine,
- cleanupPermits,
+ scanPermits,
storeDef.getRetentionDays()
* Time.MS_PER_DAY,
SystemTime.INSTANCE,
@@ -641,10 +641,10 @@ public void forceCleanupOldDataThrottled(String storeName, int entryScanThrottle
if(storeDef.hasRetentionPeriod()) {
ExecutorService executor = Executors.newFixedThreadPool(1);
try {
- if(cleanupPermits.availablePermits() >= 1) {
+ if(scanPermits.availablePermits() >= 1) {
executor.execute(new DataCleanupJob<ByteArray, byte[], byte[]>(engine,
- cleanupPermits,
+ scanPermits,
storeDef.getRetentionDays()
* Time.MS_PER_DAY,
SystemTime.INSTANCE,

0 comments on commit 6443cc8

Please sign in to comment.
Something went wrong with that request. Please try again.