/** {@inheritDoc} */ @Override protected GridConfiguration getConfiguration(String gridName) throws Exception { GridConfiguration cfg = super.getConfiguration(gridName); cfg.setCacheConfiguration( cacheConfiguration(META_CACHE_NAME), cacheConfiguration(DATA_CACHE_NAME)); GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi(); discoSpi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(discoSpi); GridGgfsConfiguration ggfsCfg = new GridGgfsConfiguration(); ggfsCfg.setMetaCacheName(META_CACHE_NAME); ggfsCfg.setDataCacheName(DATA_CACHE_NAME); ggfsCfg.setName("ggfs"); ggfsCfg.setBlockSize(CFG_BLOCK_SIZE); ggfsCfg.setFragmentizerEnabled(true); cfg.setGgfsConfiguration(ggfsCfg); return cfg; }
/** @throws Exception If failed. */ public void testRemoteIfDataCacheNameEquals() throws Exception { GridConfiguration g2Cfg = getConfiguration("g2"); GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1); GridGgfsConfiguration g2GgfsCfg2 = new GridGgfsConfiguration(g1GgfsCfg2); g2GgfsCfg1.setName("g2GgfsCfg1"); g2GgfsCfg2.setName("g2GgfsCfg2"); g2GgfsCfg1.setMetaCacheName("g2MetaCache1"); g2GgfsCfg2.setMetaCacheName("g2MetaCache2"); g1Cfg.setCacheConfiguration( concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class)); g2Cfg.setCacheConfiguration( concat( dataCaches(1024), metaCaches("g2MetaCache1", "g2MetaCache2"), GridCacheConfiguration.class)); g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g2GgfsCfg2); G.start(g1Cfg); checkGridStartFails( g2Cfg, "Data cache names should be different for different GGFS instances", false); }
/** {@inheritDoc} */ @Override protected GridConfiguration getConfiguration(String gridName) throws Exception { GridConfiguration cfg = super.getConfiguration(gridName); GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi(); discoSpi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(discoSpi); GridGgfsConfiguration ggfsCfg = new GridGgfsConfiguration(); ggfsCfg.setDataCacheName("partitioned"); ggfsCfg.setMetaCacheName("replicated"); ggfsCfg.setName("ggfs"); ggfsCfg.setManagementPort(GridGgfsConfiguration.DFLT_MGMT_PORT + cnt); ggfsCfg.setIpcEndpointConfiguration( new HashMap<String, String>() { { put("type", "shmem"); put("port", String.valueOf(GridIpcSharedMemoryServerEndpoint.DFLT_IPC_PORT + cnt)); } }); ggfsCfg.setBlockSize( 512 * 1024); // Together with group blocks mapper will yield 64M per node groups. cfg.setGgfsConfiguration(ggfsCfg); cfg.setCacheConfiguration(cacheConfiguration()); cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED); GridTcpCommunicationSpi commSpi = new GridTcpCommunicationSpi(); commSpi.setSharedMemoryPort(-1); cfg.setCommunicationSpi(commSpi); cnt++; return cfg; }
/** @throws Exception If failed. */ public void testRemoteIfDataBlockSizeDiffers() throws Exception { GridConfiguration g2Cfg = getConfiguration("g2"); g1Cfg.setCacheConfiguration( concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class)); g2Cfg.setCacheConfiguration( concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class)); GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1); g2GgfsCfg1.setBlockSize(g2GgfsCfg1.getBlockSize() + 100); g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g1GgfsCfg2); G.start(g1Cfg); checkGridStartFails( g2Cfg, "Data block size should be same on all nodes in grid for GGFS", false); }
/** @throws Exception If failed. */ public void testRemoteIfPathModeDiffers() throws Exception { GridConfiguration g2Cfg = getConfiguration("g2"); GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1); GridGgfsConfiguration g2GgfsCfg2 = new GridGgfsConfiguration(g1GgfsCfg2); g2GgfsCfg1.setPathModes(ImmutableMap.of("/somePath", DUAL_SYNC)); g2GgfsCfg2.setPathModes(ImmutableMap.of("/somePath", DUAL_SYNC)); g1Cfg.setCacheConfiguration( concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class)); g2Cfg.setCacheConfiguration( concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class)); g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g2GgfsCfg2); G.start(g1Cfg); checkGridStartFails( g2Cfg, "Path modes should be the same on all nodes in grid for GGFS", false); }
/** {@inheritDoc} */ @Override protected GridConfiguration getConfiguration(String gridName) throws Exception { GridConfiguration cfg = super.getConfiguration(gridName); GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi(); discoSpi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(discoSpi); g1GgfsCfg1.setName("g1GgfsCfg1"); g1GgfsCfg1.setDataCacheName(dataCache1Name); g1GgfsCfg1.setMetaCacheName(metaCache1Name); g1GgfsCfg2.setName("g1GgfsCfg2"); g1GgfsCfg2.setDataCacheName(dataCache2Name); g1GgfsCfg2.setMetaCacheName(metaCache2Name); cfg.setGgfsConfiguration(g1GgfsCfg1, g1GgfsCfg2); cfg.setLocalHost("127.0.0.1"); return cfg; }
/** @throws Exception If failed. */ public void testRemoteIfDefaultModeDiffers() throws Exception { GridConfiguration g2Cfg = getConfiguration("g2"); GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1); GridGgfsConfiguration g2GgfsCfg2 = new GridGgfsConfiguration(g1GgfsCfg2); g1GgfsCfg1.setDefaultMode(DUAL_ASYNC); g1GgfsCfg2.setDefaultMode(DUAL_ASYNC); g2GgfsCfg1.setDefaultMode(DUAL_SYNC); g2GgfsCfg2.setDefaultMode(DUAL_SYNC); g1Cfg.setCacheConfiguration( concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class)); g2Cfg.setCacheConfiguration( concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class)); g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g2GgfsCfg2); G.start(g1Cfg); checkGridStartFails( g2Cfg, "Default mode should be the same on all nodes in grid for GGFS", false); }
/** @throws Exception If failed. */ public void testRemoteIfMetaCacheNameDiffers() throws Exception { GridConfiguration g2Cfg = getConfiguration("g2"); GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1); GridGgfsConfiguration g2GgfsCfg2 = new GridGgfsConfiguration(g1GgfsCfg2); g2GgfsCfg1.setMetaCacheName("g2MetaCache1"); g2GgfsCfg2.setMetaCacheName("g2MetaCache2"); g1Cfg.setCacheConfiguration( concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class)); g2Cfg.setCacheConfiguration( concat( dataCaches(1024), metaCaches("g2MetaCache1", "g2MetaCache2"), GridCacheConfiguration.class)); g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g2GgfsCfg2); G.start(g1Cfg); checkGridStartFails( g2Cfg, "Meta cache name should be the same on all nodes in grid for GGFS", false); }