public void testCompactionThreshold() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); try { dsf.setCompactionThreshold(-1); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } try { dsf.setCompactionThreshold(101); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } dsf.setCompactionThreshold(0); dsf.setCompactionThreshold(100); assertEquals(100, dsf.create("test").getCompactionThreshold()); }
public void testCompactionThreshold() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testCompactionThreshold1"; DiskStore ds = dsf .setCompactionThreshold(0) .create(name); assertEquals(0, ds.getCompactionThreshold()); name = "testCompactionThreshold2"; ds = dsf .setCompactionThreshold(100) .create(name); assertEquals(100, ds.getCompactionThreshold()); // check illegal stuff try { dsf.setCompactionThreshold(-1); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } try { dsf.setCompactionThreshold(101); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } }
/** * Configures the disk store factory using this disk store description. */ public void configure(DiskStoreFactory f) { f.setAllowForceCompaction(this.getAllowForceCompaction().booleanValue()); f.setAutoCompact(this.getAutoCompact().booleanValue()); f.setCompactionThreshold(this.getCompactionThreshold().intValue()); f.setDiskDirsAndSizes(this.getDiskDirs(), this.getDiskDirSizes()); f.setMaxOplogSize(this.getMaxOplogSize().longValue()); f.setQueueSize(this.getQueueSize().intValue()); f.setTimeInterval(this.getTimeInterval().longValue()); f.setWriteBufferSize(this.getWriteBufferSize().intValue()); }
dsf.setCompactionThreshold(ncn.getValue().getInt());
dsf.setCompactionThreshold(ncn.getValue().getInt());
dsf.setCompactionThreshold(ncn.getValue().getInt());
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File dir = getDiskDirForVM(vm0); dir.mkdirs(); dsf.setDiskDirs(new File[] {dir}); dsf.setMaxOplogSize(1); dsf.setAutoCompact(false); dsf.setAllowForceCompaction(true); dsf.setCompactionThreshold(20); DiskStore ds = dsf.create(REGION_NAME); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(true); rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); rf.setScope(Scope.DISTRIBUTED_ACK); rf.create(REGION_NAME); } };
private LocalRegion createRegion(final VM vm0) { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File dir = getDiskDirForVM(vm0); dir.mkdirs(); dsf.setDiskDirs(new File[] {dir}); dsf.setMaxOplogSize(1); //Turn of automatic compaction dsf.setAllowForceCompaction(true); dsf.setAutoCompact(false); //The compaction javadocs seem to be wrong. This //is the amount of live data in the oplog dsf.setCompactionThreshold(40); DiskStore ds = dsf.create(REGION_NAME); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(true); rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); rf.setScope(Scope.DISTRIBUTED_ACK); LocalRegion region = (LocalRegion) rf.create(REGION_NAME); return region; }
DiskStore ds1 = dsf.setAllowForceCompaction(true) .setAutoCompact(true) .setCompactionThreshold(100) .setMaxOplogSize(2) .setTimeInterval(10) DiskStore ds2 = dsf.setAllowForceCompaction(false) .setAutoCompact(false) .setCompactionThreshold(99) .setMaxOplogSize(1) .setTimeInterval(9)
public void testNonDefaults() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testNonDefaults"; DiskStore ds = dsf .setAutoCompact(!DiskStoreFactory.DEFAULT_AUTO_COMPACT) .setCompactionThreshold(DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD/2) .setAllowForceCompaction(!DiskStoreFactory.DEFAULT_ALLOW_FORCE_COMPACTION) .setMaxOplogSize(DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE+1) .setTimeInterval(DiskStoreFactory.DEFAULT_TIME_INTERVAL+1) .setWriteBufferSize(DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE+1) .setQueueSize(DiskStoreFactory.DEFAULT_QUEUE_SIZE+1) .create(name); assertEquals(!DiskStoreFactory.DEFAULT_AUTO_COMPACT, ds.getAutoCompact()); assertEquals(DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD/2, ds.getCompactionThreshold()); assertEquals(!DiskStoreFactory.DEFAULT_ALLOW_FORCE_COMPACTION, ds.getAllowForceCompaction()); assertEquals(DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE+1, ds.getMaxOplogSize()); assertEquals(DiskStoreFactory.DEFAULT_TIME_INTERVAL+1, ds.getTimeInterval()); assertEquals(DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE+1, ds.getWriteBufferSize()); assertEquals(DiskStoreFactory.DEFAULT_QUEUE_SIZE+1, ds.getQueueSize()); }
dsf.setAutoCompact(diskProps.isRolling()); dsf.setAllowForceCompaction(diskProps.getAllowForceCompaction()); dsf.setCompactionThreshold(diskProps.getCompactionThreshold()); if (diskProps.getTimeInterval() != -1) { dsf.setTimeInterval(diskProps.getTimeInterval());
dsf.setAutoCompact(false); dsf.setAllowForceCompaction(true); dsf.setCompactionThreshold(20); String name = "diskStore"; DiskStoreImpl ds = (DiskStoreImpl) dsf.create(name);