Skip to content

Commit

Permalink
IGNITE-5281: Indexing: changed "space" to "cacheName". No more "space…
Browse files Browse the repository at this point in the history
…s". This closes #1992.

:quit
:quit
mdules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js~HEAD
  • Loading branch information
devozerov committed May 23, 2017
1 parent 018b25b commit cbf0b2a
Show file tree
Hide file tree
Showing 33 changed files with 491 additions and 508 deletions.
Expand Up @@ -47,7 +47,6 @@
import org.apache.ignite.Ignite; import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteClientDisconnectedException; import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteDataStreamer; import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteJdbcDriver; import org.apache.ignite.IgniteJdbcDriver;
Expand Down Expand Up @@ -708,7 +707,7 @@ private Ignite getIgnite(String cfgUrl) throws IgniteCheckedException {
@Override public void setSchema(String schema) throws SQLException { @Override public void setSchema(String schema) throws SQLException {
assert ignite instanceof IgniteEx; assert ignite instanceof IgniteEx;


cacheName = ((IgniteEx)ignite).context().query().space(schema); cacheName = ((IgniteEx)ignite).context().query().cacheName(schema);
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
Expand Down
Expand Up @@ -79,14 +79,15 @@ public GridIndexingManager(GridKernalContext ctx) {
/** /**
* Writes key-value pair to index. * Writes key-value pair to index.
* *
* @param space Space. * @param cacheName Cache name.
* @param key Key. * @param key Key.
* @param val Value. * @param val Value.
* @param expirationTime Expiration time or 0 if never expires. * @param expirationTime Expiration time or 0 if never expires.
* @throws IgniteCheckedException In case of error. * @throws IgniteCheckedException In case of error.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <K, V> void store(final String space, final K key, final V val, long expirationTime) throws IgniteCheckedException { public <K, V> void store(final String cacheName, final K key, final V val, long expirationTime)
throws IgniteCheckedException {
assert key != null; assert key != null;
assert val != null; assert val != null;
assert enabled(); assert enabled();
Expand All @@ -98,43 +99,43 @@ public <K, V> void store(final String space, final K key, final V val, long expi
if (log.isDebugEnabled()) if (log.isDebugEnabled())
log.debug("Storing key to cache query index [key=" + key + ", value=" + val + "]"); log.debug("Storing key to cache query index [key=" + key + ", value=" + val + "]");


getSpi().store(space, key, val, expirationTime); getSpi().store(cacheName, key, val, expirationTime);
} }
finally { finally {
busyLock.leaveBusy(); busyLock.leaveBusy();
} }
} }


/** /**
* @param space Space. * @param cacheName Cache name.
* @param key Key. * @param key Key.
* @throws IgniteCheckedException Thrown in case of any errors. * @throws IgniteCheckedException Thrown in case of any errors.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void remove(String space, Object key) throws IgniteCheckedException { public void remove(String cacheName, Object key) throws IgniteCheckedException {
assert key != null; assert key != null;
assert enabled(); assert enabled();


if (!busyLock.enterBusy()) if (!busyLock.enterBusy())
throw new IllegalStateException("Failed to remove from index (grid is stopping)."); throw new IllegalStateException("Failed to remove from index (grid is stopping).");


try { try {
getSpi().remove(space, key); getSpi().remove(cacheName, key);
} }
finally { finally {
busyLock.leaveBusy(); busyLock.leaveBusy();
} }
} }


/** /**
* @param space Space. * @param cacheName Cache name.
* @param params Parameters collection. * @param params Parameters collection.
* @param filters Filters. * @param filters Filters.
* @return Query result. * @return Query result.
* @throws IgniteCheckedException If failed. * @throws IgniteCheckedException If failed.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public IgniteSpiCloseableIterator<?> query(String space, Collection<Object> params, IndexingQueryFilter filters) public IgniteSpiCloseableIterator<?> query(String cacheName, Collection<Object> params, IndexingQueryFilter filters)
throws IgniteCheckedException { throws IgniteCheckedException {
if (!enabled()) if (!enabled())
throw new IgniteCheckedException("Indexing SPI is not configured."); throw new IgniteCheckedException("Indexing SPI is not configured.");
Expand All @@ -143,7 +144,7 @@ public IgniteSpiCloseableIterator<?> query(String space, Collection<Object> para
throw new IllegalStateException("Failed to execute query (grid is stopping)."); throw new IllegalStateException("Failed to execute query (grid is stopping).");


try { try {
final Iterator<?> res = getSpi().query(space, params, filters); final Iterator<?> res = getSpi().query(cacheName, params, filters);


if (res == null) if (res == null)
return new GridEmptyCloseableIterator<>(); return new GridEmptyCloseableIterator<>();
Expand Down
Expand Up @@ -173,7 +173,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
private GridQueryProcessor qryProc; private GridQueryProcessor qryProc;


/** */ /** */
private String space; private String cacheName;


/** */ /** */
private int maxIterCnt; private int maxIterCnt;
Expand Down Expand Up @@ -221,9 +221,9 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte


qryProc = cctx.kernalContext().query(); qryProc = cctx.kernalContext().query();


space = cctx.name(); cacheName = cctx.name();


enabled = qryProcEnabled || (isIndexingSpiEnabled() && !CU.isSystemCache(space)); enabled = qryProcEnabled || (isIndexingSpiEnabled() && !CU.isSystemCache(cacheName));


maxIterCnt = ccfg.getMaxQueryIteratorsCount(); maxIterCnt = ccfg.getMaxQueryIteratorsCount();


Expand Down Expand Up @@ -409,11 +409,11 @@ public void store(KeyCacheObject key,


Object val0 = unwrapIfNeeded(val, coctx); Object val0 = unwrapIfNeeded(val, coctx);


cctx.kernalContext().indexing().store(space, key0, val0, expirationTime); cctx.kernalContext().indexing().store(cacheName, key0, val0, expirationTime);
} }


if(qryProcEnabled) if(qryProcEnabled)
qryProc.store(space, key, partId, prevVal, prevVer, val, ver, expirationTime, link); qryProc.store(cacheName, key, partId, prevVal, prevVer, val, ver, expirationTime, link);
} }
finally { finally {
invalidateResultCache(); invalidateResultCache();
Expand Down Expand Up @@ -443,12 +443,12 @@ public void remove(KeyCacheObject key, int partId, CacheObject val, GridCacheVer
if (isIndexingSpiEnabled()) { if (isIndexingSpiEnabled()) {
Object key0 = unwrapIfNeeded(key, cctx.cacheObjectContext()); Object key0 = unwrapIfNeeded(key, cctx.cacheObjectContext());


cctx.kernalContext().indexing().remove(space, key0); cctx.kernalContext().indexing().remove(cacheName, key0);
} }


// val may be null if we have no previous value. We should not call processor in this case. // val may be null if we have no previous value. We should not call processor in this case.
if(qryProcEnabled && val != null) if(qryProcEnabled && val != null)
qryProc.remove(space, key, partId, val, ver); qryProc.remove(cacheName, key, partId, val, ver);
} }
finally { finally {
invalidateResultCache(); invalidateResultCache();
Expand Down Expand Up @@ -628,7 +628,7 @@ private QueryResult<K, V> executeQuery(GridCacheQueryAdapter<?> qry,
taskName)); taskName));
} }


iter = qryProc.queryText(space, qry.clause(), qry.queryClassName(), filter(qry)); iter = qryProc.queryText(cacheName, qry.clause(), qry.queryClassName(), filter(qry));


break; break;


Expand Down Expand Up @@ -739,7 +739,7 @@ private FieldsResult executeFieldsQuery(GridCacheQueryAdapter<?> qry, @Nullable


try { try {
if (qry.type() == SPI) { if (qry.type() == SPI) {
IgniteSpiCloseableIterator<?> iter = cctx.kernalContext().indexing().query(space, F.asList(args), IgniteSpiCloseableIterator<?> iter = cctx.kernalContext().indexing().query(cacheName, F.asList(args),
filter(qry)); filter(qry));


res.onDone(iter); res.onDone(iter);
Expand Down Expand Up @@ -1907,7 +1907,7 @@ public Collection<GridCacheSqlMetadata> sqlMetadata() throws IgniteCheckedExcept
// Remote nodes that have current cache. // Remote nodes that have current cache.
Collection<ClusterNode> nodes = F.view(cctx.discovery().remoteNodes(), new P1<ClusterNode>() { Collection<ClusterNode> nodes = F.view(cctx.discovery().remoteNodes(), new P1<ClusterNode>() {
@Override public boolean apply(ClusterNode n) { @Override public boolean apply(ClusterNode n) {
return cctx.kernalContext().discovery().cacheAffinityNode(n, space); return cctx.kernalContext().discovery().cacheAffinityNode(n, cacheName);
} }
}); });


Expand Down Expand Up @@ -1945,7 +1945,7 @@ public Collection<GridCacheSqlMetadata> sqlMetadata() throws IgniteCheckedExcept
Collection<GridCacheSqlMetadata> col = new ArrayList<>(map.size()); Collection<GridCacheSqlMetadata> col = new ArrayList<>(map.size());


// Metadata for current cache must be first in list. // Metadata for current cache must be first in list.
col.add(new CacheSqlMetadata(map.remove(space))); col.add(new CacheSqlMetadata(map.remove(cacheName)));


for (Collection<CacheSqlMetadata> metas : map.values()) for (Collection<CacheSqlMetadata> metas : map.values())
col.add(new CacheSqlMetadata(metas)); col.add(new CacheSqlMetadata(metas));
Expand All @@ -1969,10 +1969,10 @@ public Collection<GridCacheSqlMetadata> sqlMetadata() throws IgniteCheckedExcept
return null; return null;


return new IndexingQueryFilter() { return new IndexingQueryFilter() {
@Nullable @Override public IgniteBiPredicate<K, V> forSpace(final String spaceName) { @Nullable @Override public IgniteBiPredicate<K, V> forCache(final String cacheName) {
final GridKernalContext ctx = cctx.kernalContext(); final GridKernalContext ctx = cctx.kernalContext();


final GridCacheAdapter<Object, Object> cache = ctx.cache().internalCache(spaceName); final GridCacheAdapter<Object, Object> cache = ctx.cache().internalCache(cacheName);


if (cache.context().isReplicated() || cache.configuration().getBackups() == 0) if (cache.context().isReplicated() || cache.configuration().getBackups() == 0)
return null; return null;
Expand Down Expand Up @@ -2016,10 +2016,10 @@ private IndexingQueryFilter filter(GridCacheQueryAdapter<?> qry) {
/** /**
* FOR TESTING ONLY * FOR TESTING ONLY
* *
* @return Indexing space for this query manager. * @return Cache name for this query manager.
*/ */
public String space() { public String cacheName() {
return space; return cacheName;
} }


/** /**
Expand Down

0 comments on commit cbf0b2a

Please sign in to comment.