/** {@inheritDoc} */ @Override protected void onKernalStart0() throws GridException { if (ggfsCtx.configuration().isFragmentizerEnabled()) { // Check at startup if this node is a fragmentizer coordinator. GridDiscoveryEvent locJoinEvt = ggfsCtx.kernalContext().discovery().localJoinEvent(); checkLaunchCoordinator(locJoinEvt); } }
/** {@inheritDoc} */ @Override protected void onKernalStart0() throws GridException { if (ggfsCtx.configuration().isFragmentizerEnabled()) { // Check at startup if this node is a fragmentizer coordinator. GridDiscoveryEvent locJoinEvt = ggfsCtx.kernalContext().discovery().localJoinEvent(); checkLaunchCoordinator(locJoinEvt); } }
/** * Gets initial affinity range. This range will have 0 length and will start from first * non-occupied file block. * * @param fileInfo File info to build initial range for. * @return Affinity range. */ private GridGgfsFileAffinityRange initialStreamRange(GridGgfsFileInfo fileInfo) { if (!ggfsCtx.configuration().isFragmentizerEnabled()) return null; if (!Boolean.parseBoolean(fileInfo.properties().get(GridGgfs.PROP_PREFER_LOCAL_WRITES))) return null; int blockSize = fileInfo.blockSize(); // Find first non-occupied block offset. long off = ((fileInfo.length() + blockSize - 1) / blockSize) * blockSize; // Need to get last affinity key and reuse it if we are on the same node. long lastBlockOff = off - fileInfo.blockSize(); if (lastBlockOff < 0) lastBlockOff = 0; GridGgfsFileMap map = fileInfo.fileMap(); GridUuid prevAffKey = map == null ? null : map.affinityKey(lastBlockOff, false); GridUuid affKey = data.nextAffinityKey(prevAffKey); return affKey == null ? null : new GridGgfsFileAffinityRange(off, off, affKey); }
/** * Gets initial affinity range. This range will have 0 length and will start from first * non-occupied file block. * * @param fileInfo File info to build initial range for. * @return Affinity range. */ private GridGgfsFileAffinityRange initialStreamRange(GridGgfsFileInfo fileInfo) { if (!ggfsCtx.configuration().isFragmentizerEnabled()) return null; if (!Boolean.parseBoolean(fileInfo.properties().get(GridGgfs.PROP_PREFER_LOCAL_WRITES))) return null; int blockSize = fileInfo.blockSize(); // Find first non-occupied block offset. long off = ((fileInfo.length() + blockSize - 1) / blockSize) * blockSize; // Need to get last affinity key and reuse it if we are on the same node. long lastBlockOff = off - fileInfo.blockSize(); if (lastBlockOff < 0) lastBlockOff = 0; GridGgfsFileMap map = fileInfo.fileMap(); GridUuid prevAffKey = map == null ? null : map.affinityKey(lastBlockOff, false); GridUuid affKey = data.nextAffinityKey(prevAffKey); return affKey == null ? null : new GridGgfsFileAffinityRange(off, off, affKey); }
ggfsCfg.getDefaultMode(), ggfsCfg.getPathModes(), ggfsCfg.isFragmentizerEnabled()));
ggfsCfg.getDefaultMode(), ggfsCfg.getPathModes(), ggfsCfg.isFragmentizerEnabled()));
/** {@inheritDoc} */ @Override protected void start0() throws GridException { if (!ggfsCtx.configuration().isFragmentizerEnabled()) return; // We care only about node leave and fail events. ggfsCtx.kernalContext().event().addLocalEventListener(new GridLocalEventListener() { @Override public void onEvent(GridEvent evt) { assert evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED; GridDiscoveryEvent discoEvt = (GridDiscoveryEvent)evt; checkLaunchCoordinator(discoEvt); } }, EVT_NODE_LEFT, EVT_NODE_FAILED); fragmentizerWorker = new FragmentizerWorker(); String ggfsName = ggfsCtx.configuration().getName(); topic = F.isEmpty(ggfsName) ? TOPIC_GGFS : TOPIC_GGFS.topic(ggfsName); ggfsCtx.kernalContext().io().addMessageListener(topic, fragmentizerWorker); new GridThread(fragmentizerWorker).start(); }
/** {@inheritDoc} */ @Override protected void start0() throws GridException { if (!ggfsCtx.configuration().isFragmentizerEnabled()) return; // We care only about node leave and fail events. ggfsCtx.kernalContext().event().addLocalEventListener(new GridLocalEventListener() { @Override public void onEvent(GridEvent evt) { assert evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED; GridDiscoveryEvent discoEvt = (GridDiscoveryEvent)evt; checkLaunchCoordinator(discoEvt); } }, EVT_NODE_LEFT, EVT_NODE_FAILED); fragmentizerWorker = new FragmentizerWorker(); String ggfsName = ggfsCtx.configuration().getName(); topic = F.isEmpty(ggfsName) ? TOPIC_GGFS : TOPIC_GGFS.topic(ggfsName); ggfsCtx.kernalContext().io().addMessageListener(topic, fragmentizerWorker); new GridThread(fragmentizerWorker).start(); }
cfg.fragmentizerConcurrentFiles(ggfs.getFragmentizerConcurrentFiles()); cfg.fragmentizerLocalWritesRatio(ggfs.getFragmentizerLocalWritesRatio()); cfg.fragmentizerEnabled(ggfs.isFragmentizerEnabled()); cfg.fragmentizerThrottlingBlockLength(ggfs.getFragmentizerThrottlingBlockLength()); cfg.fragmentizerThrottlingDelay(ggfs.getFragmentizerThrottlingDelay());
fragmentizerConcurrentFiles = cfg.getFragmentizerConcurrentFiles(); fragmentizerLocWritesRatio = cfg.getFragmentizerLocalWritesRatio(); fragmentizerEnabled = cfg.isFragmentizerEnabled(); fragmentizerThrottlingBlockLen = cfg.getFragmentizerThrottlingBlockLength(); fragmentizerThrottlingDelay = cfg.getFragmentizerThrottlingDelay();