private DiskStore findDiskStore() { return this.cache.findDiskStore("diskStore"); } private DiskStoreImpl createDiskStore() {
public final DiskStoreImpl getOrCreateDefaultDiskStore() { DiskStoreImpl result = (DiskStoreImpl) findDiskStore(null); if (result == null) { synchronized (this) { result = (DiskStoreImpl) findDiskStore(null); if (result == null) { result = (DiskStoreImpl) createDiskStoreFactory().create(DEFAULT_DS_NAME); } } } return result; }
public DiskStoreImpl getOrCreateDefaultDiskStore() { DiskStoreImpl result = (DiskStoreImpl) findDiskStore(null); if (result == null) { synchronized (this) { result = (DiskStoreImpl) findDiskStore(null); if (result == null) { result = (DiskStoreImpl) createDiskStoreFactory().create(DEFAULT_DS_NAME); } } } return result; }
private DiskStore findExisting(String name) { DiskStore existing = null; if (this.cache instanceof GemFireCacheImpl) { GemFireCacheImpl gfc = (GemFireCacheImpl)this.cache; existing = gfc.findDiskStore(name); if (existing != null) { if (((DiskStoreImpl)existing).sameAs(this.attrs)) { return existing; } else { throw new IllegalStateException("DiskStore named \"" + name + "\" already exists"); } } } return existing; }
private DiskStore findExisting(String name) { DiskStore existing = null; if (this.cache instanceof GemFireCacheImpl) { GemFireCacheImpl gfc = (GemFireCacheImpl)this.cache; existing = gfc.findDiskStore(name); if (existing != null) { if (((DiskStoreImpl)existing).sameAs(this.attrs)) { return existing; } else { throw new IllegalStateException("DiskStore named \"" + name + "\" already exists"); } } } return existing; }
/*** * Only to be used for clean up in DUnits. */ public void destroySharedConfiguration() { Region<String, Configuration> configRegion; try { configRegion = getConfigurationRegion(); if (configRegion != null) { configRegion.destroyRegion(); } DiskStore configDiskStore = this.cache.findDiskStore(CLUSTER_CONFIG_ARTIFACTS_DIR_NAME); if (configDiskStore != null) { configDiskStore.destroy(); File file = new File(CONFIG_DISK_DIR_PATH); FileUtils.deleteDirectory(file); } FileUtils.deleteDirectory(new File(CONFIG_DIR_PATH)); } catch (IOException e) { e.printStackTrace(); } catch (Exception e1) { e1.printStackTrace(); } }
public void run() { GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); Region region = cache.getRegion(REGION_NAME); for(int i =0; i < 1024; i++) { region.put(i, new byte[1024]); } for(int i =2; i < 1024; i++) { assertTrue(region.destroy(i) != null); } DiskStore store = cache.findDiskStore(REGION_NAME); store.forceRoll(); } });
public void initialize() { if(!cache.getPdxPersistent() || cache.getPdxDiskStore() == null || cache.findDiskStore(cache.getPdxDiskStore()) != null) { distributedTypeRegistry.initialize(); } }
public void initialize() { if(!cache.getPdxPersistent() || cache.getPdxDiskStore() == null || cache.findDiskStore(cache.getPdxDiskStore()) != null) { distributedTypeRegistry.initialize(); } }
public static PersistentID compactDiskStore(String diskStoreName) { PersistentID persistentID = null; GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); if(cache != null && !cache.isClosed()) { DiskStoreImpl diskStore = (DiskStoreImpl) cache.findDiskStore(diskStoreName); if(diskStore != null && diskStore.forceCompaction()) { persistentID = diskStore.getPersistentID(); } } return persistentID; }
public static PersistentID compactDiskStore(String diskStoreName) { PersistentID persistentID = null; GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); if(cache != null && !cache.isClosed()) { DiskStoreImpl diskStore = (DiskStoreImpl) cache.findDiskStore(diskStoreName); if(diskStore != null && diskStore.forceCompaction()) { persistentID = diskStore.getPersistentID(); } } return persistentID; }
public void testMissingInitFile() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testMissingInitFile"; DiskStore diskStore = dsf.create(name); File ifFile = new File(diskStore.getDiskDirs()[0], "BACKUP" + name + DiskInitFile.IF_FILE_EXT); assertTrue(ifFile.exists()); AttributesFactory af = new AttributesFactory(); af.setDiskStoreName(name); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); cache.createRegion("r", af.create()); cache.close(); assertTrue(ifFile.exists()); assertTrue(ifFile.delete()); assertFalse(ifFile.exists()); cache = createCache(); dsf = cache.createDiskStoreFactory(); assertEquals(null, ((GemFireCacheImpl)cache).findDiskStore(name)); try { dsf.create(name); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { } // if test passed clean up files removeFiles(diskStore); }
public void testMissingCrfFile() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testMissingCrfFile"; DiskStore diskStore = dsf.create(name); File crfFile = new File(diskStore.getDiskDirs()[0], "BACKUP" + name + "_1.crf"); AttributesFactory af = new AttributesFactory(); af.setDiskStoreName(name); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); Region r = cache.createRegion("r", af.create()); r.put("key", "value"); assertTrue(crfFile.exists()); cache.close(); assertTrue(crfFile.exists()); assertTrue(crfFile.delete()); assertFalse(crfFile.exists()); cache = createCache(); dsf = cache.createDiskStoreFactory(); assertEquals(null, ((GemFireCacheImpl)cache).findDiskStore(name)); try { dsf.create(name); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { } // if test passed clean up files removeFiles(diskStore); }
public void testMissingDrfFile() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testMissingDrfFile"; DiskStore diskStore = dsf.create(name); File drfFile = new File(diskStore.getDiskDirs()[0], "BACKUP" + name + "_1.drf"); AttributesFactory af = new AttributesFactory(); af.setDiskStoreName(name); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); Region r = cache.createRegion("r", af.create()); r.put("key", "value"); assertTrue(drfFile.exists()); cache.close(); assertTrue(drfFile.exists()); assertTrue(drfFile.delete()); assertFalse(drfFile.exists()); cache = createCache(); dsf = cache.createDiskStoreFactory(); assertEquals(null, ((GemFireCacheImpl)cache).findDiskStore(name)); try { dsf.create(name); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { } // if test passed clean up files removeFiles(diskStore); }
@Override public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException, IOException { final GemFireTransaction tc = (GemFireTransaction)xact; final LanguageConnectionContext lcc = tc.getLanguageConnectionContext(); DataDictionary dd = lcc.getDataDictionary(); dd.startWriting(lcc); // Check to see if this diskstore already exists in the cache if (Misc.getGemFireCache().findDiskStore(storeName) != null) { throw StandardException.newException( SQLState.LANG_OBJECT_ALREADY_EXISTS,"DISKSTORE",storeName); } DiskStore ds = dsf.create(storeName.toUpperCase()); UUIDFactory factory = dd.getUUIDFactory(); String diskStoreName = ds.getName(); UUID id = factory.recreateUUID(diskStoreName); GfxdDiskStoreDescriptor dsd = new GfxdDiskStoreDescriptor(dd, id, ds, dirPathsAndSizes.toString()); dd.addDescriptor(dsd, null, DataDictionary.SYSDISKSTORES_CATALOG_NUM, false, tc); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONGLOM, "CreateDiskStoreNode: added diskstore configuration for " + diskStoreName + " in SYS table"); }
@Override public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException, IOException { final GemFireTransaction tc = (GemFireTransaction)xact; final LanguageConnectionContext lcc = tc.getLanguageConnectionContext(); DataDictionary dd = lcc.getDataDictionary(); dd.startWriting(lcc); // Check to see if this diskstore already exists in the cache if (Misc.getGemFireCache().findDiskStore(storeName) != null) { throw StandardException.newException( SQLState.LANG_OBJECT_ALREADY_EXISTS,"DISKSTORE",storeName); } DiskStore ds = dsf.create(storeName.toUpperCase()); UUIDFactory factory = dd.getUUIDFactory(); String diskStoreName = ds.getName(); UUID id = factory.recreateUUID(diskStoreName); GfxdDiskStoreDescriptor dsd = new GfxdDiskStoreDescriptor(dd, id, ds, dirPathsAndSizes.toString()); dd.addDescriptor(dsd, null, DataDictionary.SYSDISKSTORES_CATALOG_NUM, false, tc); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONGLOM, "CreateDiskStoreNode: added diskstore configuration for " + diskStoreName + " in SYS table"); }
@Override public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException, IOException { final GemFireTransaction tc = (GemFireTransaction)xact; final LanguageConnectionContext lcc = tc.getLanguageConnectionContext(); DataDictionary dd = lcc.getDataDictionary(); dd.startWriting(lcc); // Check to see if this diskstore already exists in the cache GemFireCacheImpl cache = Misc.getGemFireCache(); if (cache.findDiskStore(storeName) != null) { throw StandardException.newException( SQLState.LANG_OBJECT_ALREADY_EXISTS, "DISKSTORE", storeName); } DiskStore ds = GemFireStore.createDiskStore(dsf, SharedUtils.SQLToUpperCase(storeName), cache.getCancelCriterion()); UUIDFactory factory = dd.getUUIDFactory(); String diskStoreName = ds.getName(); UUID id = factory.recreateUUID(diskStoreName); GfxdDiskStoreDescriptor dsd = new GfxdDiskStoreDescriptor(dd, id, ds, dirPathsAndSizes); dd.addDescriptor(dsd, null, DataDictionary.SYSDISKSTORES_CATALOG_NUM, false, tc); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONGLOM, "CreateDiskStoreNode: added diskstore configuration for " + diskStoreName + " in SYS table"); }
@Override public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException, IOException { final GemFireTransaction tc = (GemFireTransaction)xact; final LanguageConnectionContext lcc = tc.getLanguageConnectionContext(); DataDictionaryImpl dd = (DataDictionaryImpl)lcc.getDataDictionary(); dd.startWriting(lcc); this.storeName = SharedUtils.SQLToUpperCase(storeName); DiskStoreImpl store = (DiskStoreImpl)Misc.getGemFireCache().findDiskStore( storeName); try { if (store != null) { store.destroy(); } } catch (Exception e) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONGLOM, "DropDiskStore :: got Exception", e); } ExecIndexRow keyRow = dd.getExecutionFactory().getIndexableRow(1); keyRow.setColumn(1, new SQLVarchar(storeName)); TabInfoImpl ti = dd .getNonCoreTI(DataDictionaryImpl.SYSDISKSTORES_CATALOG_NUM); ti.deleteRow(tc, keyRow, 0); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONGLOM, "DropDiskStore :: removed DiskStore " + storeName + " from SYS table"); }
@Override public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException, IOException { final GemFireTransaction tc = (GemFireTransaction)xact; final LanguageConnectionContext lcc = tc.getLanguageConnectionContext(); DataDictionaryImpl dd = (DataDictionaryImpl)lcc.getDataDictionary(); dd.startWriting(lcc); this.storeName = SharedUtils.SQLToUpperCase(storeName); DiskStoreImpl store = (DiskStoreImpl)Misc.getGemFireCache().findDiskStore( storeName); try { if (store != null) { store.destroy(); } } catch (Exception e) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONGLOM, "DropDiskStore :: got Exception", e); } ExecIndexRow keyRow = dd.getExecutionFactory().getIndexableRow(1); keyRow.setColumn(1, new SQLVarchar(storeName)); TabInfoImpl ti = dd .getNonCoreTI(DataDictionaryImpl.SYSDISKSTORES_CATALOG_NUM); ti.deleteRow(tc, keyRow, 0); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONGLOM, "DropDiskStore :: removed DiskStore " + storeName + " from SYS table"); }
@Override public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException, IOException { final GemFireTransaction tc = (GemFireTransaction)xact; final LanguageConnectionContext lcc = tc.getLanguageConnectionContext(); DataDictionaryImpl dd = (DataDictionaryImpl)lcc.getDataDictionary(); dd.startWriting(lcc); this.storeName = SharedUtils.SQLToUpperCase(storeName); DiskStoreImpl store = (DiskStoreImpl)Misc.getGemFireCache().findDiskStore( storeName); try { if (store != null) { store.destroy(); } } catch (Exception e) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONGLOM, "DropDiskStore :: got Exception", e); } ExecIndexRow keyRow = dd.getExecutionFactory().getIndexableRow(1); keyRow.setColumn(1, new SQLVarchar(storeName)); TabInfoImpl ti = dd .getNonCoreTI(DataDictionaryImpl.SYSDISKSTORES_CATALOG_NUM); ti.deleteRow(tc, keyRow, 0); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONGLOM, "DropDiskStore :: removed DiskStore " + storeName + " from SYS table"); }