/** * @return {@code True} if values should be always unmarshalled. */ public boolean isUnmarshalValues() { return cacheCfg.isQueryIndexEnabled() || !cacheCfg.isStoreValueBytes(); }
/** * @throws GridException If query is invalid. */ public void validate() throws GridException { if (type != SCAN && !cctx.config().isQueryIndexEnabled()) throw new GridException("Indexing is disabled for cache: " + cctx.cache().name()); }
/** * @param key Key. * @param keyBytes Byte array with key value. * @return {@code true} if key was found and removed, otherwise {@code false}. * @throws GridException Thrown in case of any errors. */ @SuppressWarnings("SimplifiableIfStatement") public boolean remove(K key, @Nullable byte[] keyBytes) throws GridException { assert key != null; if (!cctx.config().isQueryIndexEnabled() && !(key instanceof GridCacheInternal)) return false; // No-op. if (!enterBusy()) return false; // Ignore index update when node is stopping. try { return idxMgr.remove(spi, space, key, keyBytes); } finally { invalidateResultCache(); leaveBusy(); } }
/** * Writes key-value pair to index. * * @param key Key. * @param keyBytes Byte array with key data. * @param val Value. * @param valBytes Value bytes. * @param ver Cache entry version. * @param expirationTime Expiration time or 0 if never expires. * @throws GridException In case of error. */ public void store(K key, @Nullable byte[] keyBytes, @Nullable V val, @Nullable byte[] valBytes, GridCacheVersion ver, long expirationTime) throws GridException { assert key != null; assert val != null || valBytes != null; if (!cctx.config().isQueryIndexEnabled() && !(key instanceof GridCacheInternal)) return; // No-op. if (!enterBusy()) return; // Ignore index update when node is stopping. try { if (val == null) val = cctx.marshaller().unmarshal(valBytes, cctx.deploy().globalLoader()); idxMgr.store(spi, space, key, keyBytes, val, valBytes, CU.versionToBytes(ver), expirationTime); } finally { invalidateResultCache(); leaveBusy(); } }
if (ctx.config().isQueryIndexEnabled()) { for (Iterator<Map.Entry<K, V>> it = ctx.swap().lazyOffHeapIterator(); it.hasNext();) { Map.Entry<K, V> e = it.next(); if (ctx.config().isQueryIndexEnabled()) { Iterator<Map.Entry<K, V>> it = null;
throw new GridException("Data cache is not configured locally for GGFS: " + cfg); if (dataCache.configuration().isQueryIndexEnabled()) throw new GridException("GGFS data cache cannot start with enabled query indexing."); throw new GridException("Metadata cache is not configured locally for GGFS: " + cfg); if (metaCache.configuration().isQueryIndexEnabled()) throw new GridException("GGFS metadata cache cannot start with enabled query indexing.");
throw new GridException("Data cache is not configured locally for GGFS: " + cfg); if (dataCache.configuration().isQueryIndexEnabled()) throw new GridException("GGFS data cache cannot start with enabled query indexing."); throw new GridException("Metadata cache is not configured locally for GGFS: " + cfg); if (metaCache.configuration().isQueryIndexEnabled()) throw new GridException("GGFS metadata cache cannot start with enabled query indexing.");
cfg.isWriteBehindEnabled()); perf.add("Disable query index (set 'queryIndexEnabled' to false)", !cfg.isQueryIndexEnabled());
if (cc.isQueryIndexEnabled()) throw new GridException("Cannot have query indexing enabled while values are stored off-heap. " + "You must either disable query indexing or disable off-heap values only flag for cache: " + boolean utilityCache = CU.isUtilityCache(cc.getName()); if (!ggfsCache && !utilityCache && !cc.isQueryIndexEnabled()) U.warn(log, "Query indexing is disabled (queries will not work) for cache: '" + cc.getName() + "'. " + "To enable change GridCacheConfiguration.isQueryIndexEnabled() property.",
preloadBatchSize = cfg.getPreloadBatchSize(); preloadMode = cfg.getPreloadMode(); qryIdxEnabled = cfg.isQueryIndexEnabled(); seqReserveSize = cfg.getAtomicSequenceReserveSize(); storeEnabled = cfg.getStore() != null;
cfg.writeSynchronizationMode(ccfg.getWriteSynchronizationMode()); cfg.swapEnabled(ccfg.isSwapEnabled()); cfg.queryIndexEnabled(ccfg.isQueryIndexEnabled()); cfg.batchUpdateOnCommit(ccfg.isBatchUpdateOnCommit()); cfg.invalidate(ccfg.isInvalidate());
qryCfg = cc.getQueryConfiguration(); refreshAheadRatio = cc.getRefreshAheadRatio(); qryIdxEnabled = cc.isQueryIndexEnabled(); seqReserveSize = cc.getAtomicSequenceReserveSize(); startSize = cc.getStartSize();