/** * Returns the disk store as a string. Serves calling methods for both * factory attributes and actual disk store. */ private static synchronized String diskStoreToString(String diskStoreName, DiskStore d) { StringBuffer buf = new StringBuffer(); buf.append("\n diskStoreName: " + diskStoreName); buf.append("\n allowForceCompaction: " + d.getAllowForceCompaction()); buf.append("\n autoCompact: " + d.getAutoCompact()); buf.append("\n compactionThreshold: " + d.getCompactionThreshold()); buf.append("\n diskDirSizes: " + asList(d.getDiskDirSizes())); buf.append("\n diskDirs: " + Arrays.asList(d.getDiskDirs())); buf.append("\n maxOplogSize: " + d.getMaxOplogSize()); buf.append("\n queueSize: " + d.getQueueSize()); buf.append("\n timeInterval: " + d.getTimeInterval()); buf.append("\n writeBufferSize: " + d.getWriteBufferSize()); return buf.toString(); }
public GfxdDiskStoreDescriptor(DataDictionary dd, UUID id,DiskStore ds, String dirAndSize) { super(dd); this.id = id; this.diskStoreName = ds.getName(); this.maxLogSize = ds.getMaxOplogSize(); this.autoCompact = Boolean.toString(ds.getAutoCompact()); this.allowForceCompaction = Boolean.toString(ds.getAllowForceCompaction()); this.compactionThreshold = ds.getCompactionThreshold(); this.timeInterval = ds.getTimeInterval(); this.writeBufferSize = ds.getWriteBufferSize(); this.queueSize = ds.getQueueSize(); this.dirAndSize = dirAndSize; }
public GfxdDiskStoreDescriptor(DataDictionary dd, UUID id,DiskStore ds, String dirAndSize) { super(dd); this.id = id; this.diskStoreName = ds.getName(); this.maxLogSize = ds.getMaxOplogSize(); this.autoCompact = Boolean.toString(ds.getAutoCompact()); this.allowForceCompaction = Boolean.toString(ds.getAllowForceCompaction()); this.compactionThreshold = ds.getCompactionThreshold(); this.timeInterval = ds.getTimeInterval(); this.writeBufferSize = ds.getWriteBufferSize(); this.queueSize = ds.getQueueSize(); this.dirAndSize = dirAndSize; }
public GfxdDiskStoreDescriptor(DataDictionary dd, UUID id,DiskStore ds, String dirAndSize) { super(dd); this.id = id; this.diskStoreName = ds.getName(); this.maxLogSize = ds.getMaxOplogSize(); this.autoCompact = Boolean.toString(ds.getAutoCompact()); this.allowForceCompaction = Boolean.toString(ds.getAllowForceCompaction()); this.compactionThreshold = ds.getCompactionThreshold(); this.timeInterval = ds.getTimeInterval(); this.writeBufferSize = ds.getWriteBufferSize(); this.queueSize = ds.getQueueSize(); this.dirAndSize = dirAndSize; }
if (generateDefaults() || ds.getMaxOplogSize() != DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE) atts.addAttribute("", "", MAX_OPLOG_SIZE, "", String.valueOf(ds.getMaxOplogSize()));
/** * test Illegal max oplog size */ public void testMaxOplogSize() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); try { dsf.setMaxOplogSize(-1); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } dsf.setMaxOplogSize(1); assertEquals(1, dsf.create("test").getMaxOplogSize()); }
if (generateDefaults() || ds.getMaxOplogSize() != DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE) atts.addAttribute("", "", MAX_OPLOG_SIZE, "", String.valueOf(ds.getMaxOplogSize()));
throw new RuntimeException(LocalizedStrings.DiskStoreAttributesCreation_ALLOWFORCECOMPACTION_OF_0_IS_NOT_THE_SAME_THIS_1_OTHER_2.toLocalizedString(new Object[] {name, this.allowForceCompaction, other.getAllowForceCompaction()})); if (this.getMaxOplogSizeInBytes() != other.getMaxOplogSize()*1024*1024) { throw new RuntimeException(LocalizedStrings.DiskStoreAttributesCreation_MAXOPLOGSIZE_OF_0_IS_NOT_THE_SAME_THIS_1_OTHER_2.toLocalizedString(new Object[] {name, getMaxOplogSizeInBytes()/(1024*1024), other.getMaxOplogSize()}));
public void testMaxOplogSize() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testMaxOplogSize"; DiskStore ds = dsf .setMaxOplogSize(0) .create(name); assertEquals(0, ds.getMaxOplogSize()); name = "testMaxOplogSize2"; // max is Integer.MAX MBs since that is the max diskDir size which uses int long max = Integer.MAX_VALUE; //long max = Long.MAX_VALUE / (1024*1024); ds = dsf .setMaxOplogSize(max) .create(name); assertEquals(max, ds.getMaxOplogSize()); // check illegal stuff try { dsf.setMaxOplogSize(-1); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } try { dsf.setMaxOplogSize(max+1); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } } public void testFlush() {
throw new RuntimeException(LocalizedStrings.DiskStoreAttributesCreation_ALLOWFORCECOMPACTION_OF_0_IS_NOT_THE_SAME_THIS_1_OTHER_2.toLocalizedString(new Object[] {name, this.allowForceCompaction, other.getAllowForceCompaction()})); if (this.maxOplogSizeInBytes != other.getMaxOplogSize()*1024*1024) { throw new RuntimeException(LocalizedStrings.DiskStoreAttributesCreation_MAXOPLOGSIZE_OF_0_IS_NOT_THE_SAME_THIS_1_OTHER_2.toLocalizedString(new Object[] {name, this.maxOplogSizeInBytes/1024/1024, other.getMaxOplogSize()}));
public void testGetDefaultInstance() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testGetDefaultInstance"; assertEquals(null, cache.findDiskStore(name)); DiskStore ds = dsf.create(name); assertEquals(ds, cache.findDiskStore(name)); assertEquals(name, ds.getName()); assertEquals(DiskStoreFactory.DEFAULT_AUTO_COMPACT, ds.getAutoCompact()); assertEquals(DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD, ds.getCompactionThreshold()); assertEquals(DiskStoreFactory.DEFAULT_ALLOW_FORCE_COMPACTION, ds.getAllowForceCompaction()); assertEquals(DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE, ds.getMaxOplogSize()); assertEquals(DiskStoreFactory.DEFAULT_TIME_INTERVAL, ds.getTimeInterval()); assertEquals(DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE, ds.getWriteBufferSize()); assertEquals(DiskStoreFactory.DEFAULT_QUEUE_SIZE, ds.getQueueSize()); if (!Arrays.equals(DiskStoreFactory.DEFAULT_DISK_DIRS, ds.getDiskDirs())) { fail("expected=" + Arrays.toString(DiskStoreFactory.DEFAULT_DISK_DIRS) + " had=" + Arrays.toString(ds.getDiskDirs())); } if (!Arrays.equals(DiskStoreFactory.DEFAULT_DISK_DIR_SIZES, ds.getDiskDirSizes())) { fail("expected=" + Arrays.toString(DiskStoreFactory.DEFAULT_DISK_DIR_SIZES) + " had=" + Arrays.toString(ds.getDiskDirSizes())); } }
da.getAutoCompact() != d.getAutoCompact() || da.getCompactionThreshold() != d.getCompactionThreshold() || da.getMaxOplogSize() != d.getMaxOplogSize() || da.getQueueSize() != d.getQueueSize() || da.getTimeInterval() != d.getTimeInterval() ||
protected static String getDiskAttributes(Region r) { String dsn = r.getAttributes().getDiskStoreName(); if (dsn == null) { throw new HydraConfigException("Persistence is not configured"); } DiskStore ds = DiskStoreHelper.getDiskStore(dsn); return "the DiskStore is" + ds + ", the allow force compaction is " + ds.getAllowForceCompaction() + ", the auto compact is " + ds.getAutoCompact() + ", the compaction threshold is " + ds.getCompactionThreshold() + ", the disk dir num is " + ds.getDiskDirs().length + ", the max oplog size is " + ds.getMaxOplogSize() + ", the queue size is " + ds.getQueueSize() + ", the synchronous (from the region) is " + r.getAttributes().isDiskSynchronous() ; } protected static String getResourceManager(Cache c) {
protected void verify(LocalRegion lr, DiskRegionProperties drp) { DiskStore ds = cache.findDiskStore(lr.getDiskStoreName()); assertTrue(ds != null); assertTrue(lr.getAttributes().isDiskSynchronous() == drp.isSynchronous()); assertTrue(ds.getAutoCompact() == drp.isRolling()); assertEquals(drp.getMaxOplogSize()/(1024*1024), ds.getMaxOplogSize()); if (drp.getTimeInterval() != -1) { assertEquals(drp.getTimeInterval(), ds.getTimeInterval()); } else { assertEquals(DiskStoreFactory.DEFAULT_TIME_INTERVAL, ds.getTimeInterval()); } assertEquals((int)drp.getBytesThreshold(), ds.getQueueSize()); int dirnum = drp.getDiskDirs().length; int dirnum2 = ds.getDiskDirs().length; int[] diskSizes = drp.getDiskDirSizes(); int[] ds_diskSizes = ds.getDiskDirSizes(); assertEquals(dirnum, dirnum2); if (diskSizes == null) { diskSizes = new int[dirnum]; java.util.Arrays.fill(diskSizes, Integer.MAX_VALUE); } for (int i=0; i<dirnum; i++) { assertTrue("diskSizes not matching", diskSizes[i] == ds_diskSizes[i]); } }
diskStoreDetails.setAutoCompact(diskStore.getAutoCompact()); diskStoreDetails.setCompactionThreshold(diskStore.getCompactionThreshold()); diskStoreDetails.setMaxOplogSize(diskStore.getMaxOplogSize()); diskStoreDetails.setQueueSize(diskStore.getQueueSize()); diskStoreDetails.setTimeInterval(diskStore.getTimeInterval());
assertTrue(ds1 != null); assertTrue(ds1.getAutoCompact() == true); assertTrue(ds1.getMaxOplogSize() == 2); assertTrue(ds2 != null); assertTrue(ds2.getAutoCompact() == false); assertTrue(ds2.getMaxOplogSize() == 0); assertTrue(ds3 != null); assertTrue(ds3.getAutoCompact() == true); assertTrue(ds3.getMaxOplogSize() == 2); assertTrue(ds3.getQueueSize() == 10000); assertTrue(ds3.getTimeInterval() == 15); assertTrue(ds4 != null); assertTrue(ds4.getAutoCompact() == false); assertTrue(ds4.getMaxOplogSize() == 2); assertTrue(ds4.getQueueSize() == 0); assertTrue(ds5 != null); assertTrue(ds5.getAutoCompact() == true); assertTrue(ds5.getMaxOplogSize() == 2); assertTrue(ds6 != null); assertTrue(ds6.getAutoCompact() == false); assertTrue(ds6.getMaxOplogSize() == 0); assertTrue(ds7 != null); assertTrue(ds7.getAutoCompact() == true);
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()); }
diskStoreDetails.setAutoCompact(diskStore.getAutoCompact()); diskStoreDetails.setCompactionThreshold(diskStore.getCompactionThreshold()); diskStoreDetails.setMaxOplogSize(diskStore.getMaxOplogSize()); diskStoreDetails.setQueueSize(diskStore.getQueueSize()); diskStoreDetails.setTimeInterval(diskStore.getTimeInterval());
atLeast(1).of(mockDiskStore).getDiskStoreUUID(); will(returnValue(diskStoreId)); oneOf(mockDiskStore).getMaxOplogSize(); will(returnValue(maxOplogSize)); atLeast(1).of(mockDiskStore).getName();