Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into sql-store
  • Loading branch information
agoncharuk committed Jan 21, 2016
2 parents 1901829 + 7a31e4f commit 50be063
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,8 @@ private GridCacheSharedContext createSharedContext(GridKernalContext kernalCtx,
}
else {
for (DynamicCacheChangeRequest req : batch.requests()) {
initReceivedCacheConfiguration(req);

if (req.template()) {
CacheConfiguration ccfg = req.startCacheConfiguration();

Expand Down Expand Up @@ -1990,6 +1992,8 @@ private void processClientReconnectData(UUID clientNodeId, DynamicCacheChangeBat
for (DynamicCacheChangeRequest req : batch.requests()) {
assert !req.template() : req;

initReceivedCacheConfiguration(req);

String name = req.cacheName();

boolean sysCache = CU.isMarshallerCache(name) || CU.isUtilityCache(name) || CU.isAtomicsCache(name);
Expand Down Expand Up @@ -2438,6 +2442,8 @@ private boolean onCacheChangeRequested(DynamicCacheChangeBatch batch,
boolean incMinorTopVer = false;

for (DynamicCacheChangeRequest req : batch.requests()) {
initReceivedCacheConfiguration(req);

if (req.template()) {
CacheConfiguration ccfg = req.startCacheConfiguration();

Expand Down Expand Up @@ -2581,6 +2587,18 @@ private boolean onCacheChangeRequested(DynamicCacheChangeBatch batch,
return incMinorTopVer;
}

/**
* @param req Cache change request.
*/
private void initReceivedCacheConfiguration(DynamicCacheChangeRequest req) {
if (req.startCacheConfiguration() != null) {
CacheConfiguration ccfg = req.startCacheConfiguration();

if (ccfg.isStoreKeepBinary() == null)
ccfg.setStoreKeepBinary(CacheConfiguration.DFLT_STORE_KEEP_BINARY);
}
}

/**
* Checks that preload-order-dependant caches has SYNC or ASYNC preloading mode.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,12 @@ public void initializeCache(CacheConfiguration<?, ?> ccfg) throws IgniteCheckedE
if (keyCls == null)
keyCls = Object.class;

desc.name(meta.getSimpleValueType());
String simpleValType = meta.getSimpleValueType();

if (simpleValType == null)
simpleValType = typeName(meta.getValueType());

desc.name(simpleValType);

if (binaryEnabled && !keyOrValMustDeserialize) {
// Safe to check null.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,35 +257,36 @@ protected void estimateMemorySize(IgniteEx ignite, GridCacheAdapter ca, int samp
* Fill values that should be stored in history;
*
* @param c Source cache.
* @return Cache.
*/
protected void initHistory(VisorCache c) {
c.name = name;
c.mode = mode;
c.memorySize = memorySize;
c.indexesSize = indexesSize;
c.size = size;
c.nearSize = nearSize;
c.dhtSize = dhtSize;
c.primarySize = primarySize;
c.offHeapAllocatedSize = offHeapAllocatedSize;
c.offHeapEntriesCnt = offHeapEntriesCnt;
c.swapSize = swapSize;
c.swapKeys = swapKeys;
c.partitions = partitions;
c.primaryPartitions = Collections.emptyList();
c.backupPartitions = Collections.emptyList();
c.metrics = metrics;
protected VisorCache initHistory(VisorCache c) {
if (c != null) {
c.name = name;
c.mode = mode;
c.memorySize = memorySize;
c.indexesSize = indexesSize;
c.size = size;
c.nearSize = nearSize;
c.dhtSize = dhtSize;
c.primarySize = primarySize;
c.offHeapAllocatedSize = offHeapAllocatedSize;
c.offHeapEntriesCnt = offHeapEntriesCnt;
c.swapSize = swapSize;
c.swapKeys = swapKeys;
c.partitions = partitions;
c.primaryPartitions = Collections.emptyList();
c.backupPartitions = Collections.emptyList();
c.metrics = metrics;
}

return c;
}

/**
* @return New instance suitable to store in history.
*/
public VisorCache history() {
VisorCache c = new VisorCache();

initHistory(c);

return c;
return initHistory(new VisorCache());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ private static String[] compactClasses(Class<?>[] clss) {
* @return Fill data transfer object with cache query configuration data.
*/
public VisorCacheQueryConfiguration from(CacheConfiguration ccfg) {
VisorCacheQueryConfiguration cfg = new VisorCacheQueryConfiguration();
sqlFuncClss = compactClasses(ccfg.getSqlFunctionClasses());
longQryWarnTimeout = ccfg.getLongQueryWarningTimeout();
sqlEscapeAll = ccfg.isSqlEscapeAll();
indexedTypes = compactClasses(ccfg.getIndexedTypes());
sqlOnheapRowCacheSize = ccfg.getSqlOnheapRowCacheSize();

cfg.sqlFuncClss = compactClasses(ccfg.getSqlFunctionClasses());
cfg.longQryWarnTimeout = ccfg.getLongQueryWarningTimeout();
cfg.sqlEscapeAll = ccfg.isSqlEscapeAll();
cfg.indexedTypes = compactClasses(ccfg.getIndexedTypes());
cfg.sqlOnheapRowCacheSize = ccfg.getSqlOnheapRowCacheSize();

return cfg;
return this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,25 @@ public class VisorCacheStoreConfiguration implements Serializable {
* @return Data transfer object for cache store configuration properties.
*/
public VisorCacheStoreConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) {
VisorCacheStoreConfiguration cfg = new VisorCacheStoreConfiguration();

IgniteCacheProxy<Object, Object> c = ignite.context().cache().jcache(ccfg.getName());

CacheStore store = c != null && c.context().started() ? c.context().store().configuredStore() : null;
CacheStore cstore = c != null && c.context().started() ? c.context().store().configuredStore() : null;

cfg.jdbcStore = store instanceof CacheAbstractJdbcStore;
jdbcStore = cstore instanceof CacheAbstractJdbcStore;

cfg.store = compactClass(store);
cfg.storeFactory = compactClass(ccfg.getCacheStoreFactory());
store = compactClass(cstore);
storeFactory = compactClass(ccfg.getCacheStoreFactory());

cfg.readThrough = ccfg.isReadThrough();
cfg.writeThrough = ccfg.isWriteThrough();
readThrough = ccfg.isReadThrough();
writeThrough = ccfg.isWriteThrough();

cfg.writeBehindEnabled = ccfg.isWriteBehindEnabled();
cfg.batchSz = ccfg.getWriteBehindBatchSize();
cfg.flushFreq = ccfg.getWriteBehindFlushFrequency();
cfg.flushSz = ccfg.getWriteBehindFlushSize();
cfg.flushThreadCnt = ccfg.getWriteBehindFlushThreadCount();
writeBehindEnabled = ccfg.isWriteBehindEnabled();
batchSz = ccfg.getWriteBehindBatchSize();
flushFreq = ccfg.getWriteBehindFlushFrequency();
flushSz = ccfg.getWriteBehindFlushSize();
flushThreadCnt = ccfg.getWriteBehindFlushThreadCount();

return cfg;
return this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,32 @@ public class VisorCacheV2 extends VisorCache {

/** {@inheritDoc} */
@Override public VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException {
super.from(ignite, cacheName, sample);
VisorCache c = super.from(ignite, cacheName, sample);

GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);
if (c != null && c instanceof VisorCacheV2) {
GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);

// Cache was not started.
if (ca != null && ca.context().started())
near = ca.context().isNear();
// Cache was not started.
if (ca != null && ca.context().started())
((VisorCacheV2)c).near = ca.context().isNear();
}

return this;
return c;
}

/** {@inheritDoc} */
@Override public void initHistory(VisorCache c) {
@Override protected VisorCache initHistory(VisorCache c) {
super.initHistory(c);

if (c instanceof VisorCacheV2)
((VisorCacheV2) c).near = near;

return c;
}

/** {@inheritDoc} */
@Override public VisorCache history() {
return initHistory(new VisorCacheV2());
}

/**
Expand Down
15 changes: 9 additions & 6 deletions modules/core/src/main/resources/META-INF/classnames.properties
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ org.apache.ignite.internal.IgniteSchedulerImpl
org.apache.ignite.internal.IgniteServicesImpl
org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance$1
org.apache.ignite.internal.NodeStoppingException
org.apache.ignite.internal.binary.BinaryContext
org.apache.ignite.internal.binary.BinaryEnumObjectImpl
org.apache.ignite.internal.binary.BinaryMetadata
org.apache.ignite.internal.binary.BinaryObjectEx
Expand Down Expand Up @@ -452,12 +451,12 @@ org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$6
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$7
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeFutureSet
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$MessageHandler
org.apache.ignite.internal.processors.cache.GridCacheProcessor$2
org.apache.ignite.internal.processors.cache.GridCacheProcessor$1
org.apache.ignite.internal.processors.cache.GridCacheProcessor$3
org.apache.ignite.internal.processors.cache.GridCacheProcessor$4
org.apache.ignite.internal.processors.cache.GridCacheProcessor$5
org.apache.ignite.internal.processors.cache.GridCacheProcessor$6
org.apache.ignite.internal.processors.cache.GridCacheProcessor$7
org.apache.ignite.internal.processors.cache.GridCacheProcessor$9
org.apache.ignite.internal.processors.cache.GridCacheProcessor$8
org.apache.ignite.internal.processors.cache.GridCacheProcessor$LocalAffinityFunction
org.apache.ignite.internal.processors.cache.GridCacheProxyImpl
org.apache.ignite.internal.processors.cache.GridCacheReturn
Expand Down Expand Up @@ -496,7 +495,6 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$2
org.apache.ignite.internal.processors.cache.GridCacheUtils$20
org.apache.ignite.internal.processors.cache.GridCacheUtils$21
org.apache.ignite.internal.processors.cache.GridCacheUtils$23
org.apache.ignite.internal.processors.cache.GridCacheUtils$24
org.apache.ignite.internal.processors.cache.GridCacheUtils$3
org.apache.ignite.internal.processors.cache.GridCacheUtils$4
org.apache.ignite.internal.processors.cache.GridCacheUtils$5
Expand Down Expand Up @@ -722,6 +720,7 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$3
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$4
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse
Expand Down Expand Up @@ -1113,7 +1112,7 @@ org.apache.ignite.internal.processors.platform.compute.PlatformBroadcastingMulti
org.apache.ignite.internal.processors.platform.compute.PlatformBroadcastingSingleClosureTask
org.apache.ignite.internal.processors.platform.compute.PlatformClosureJob
org.apache.ignite.internal.processors.platform.compute.PlatformCompute$1
org.apache.ignite.internal.processors.platform.compute.PlatformCompute$2
org.apache.ignite.internal.processors.platform.compute.PlatformCompute$ComputeConvertingFuture$1
org.apache.ignite.internal.processors.platform.compute.PlatformFullJob
org.apache.ignite.internal.processors.platform.compute.PlatformFullTask
org.apache.ignite.internal.processors.platform.compute.PlatformJob
Expand Down Expand Up @@ -1165,6 +1164,7 @@ org.apache.ignite.internal.processors.rest.GridRestProcessor$3
org.apache.ignite.internal.processors.rest.GridRestResponse
org.apache.ignite.internal.processors.rest.client.message.GridClientAbstractMessage
org.apache.ignite.internal.processors.rest.client.message.GridClientAuthenticationRequest
org.apache.ignite.internal.processors.rest.client.message.GridClientCacheBean
org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest
org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest$GridCacheOperation
org.apache.ignite.internal.processors.rest.client.message.GridClientHandshakeRequest
Expand Down Expand Up @@ -1548,6 +1548,7 @@ org.apache.ignite.internal.visor.cache.VisorCacheNearConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask$VisorCacheNodesJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfigurationV2
org.apache.ignite.internal.visor.cache.VisorCacheQueryMetrics
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask
Expand All @@ -1560,10 +1561,12 @@ org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartJob
org.apache.ignite.internal.visor.cache.VisorCacheStopTask
org.apache.ignite.internal.visor.cache.VisorCacheStopTask$VisorCacheStopJob
org.apache.ignite.internal.visor.cache.VisorCacheStoreConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheStoreConfigurationV2
org.apache.ignite.internal.visor.cache.VisorCacheSwapBackupsTask
org.apache.ignite.internal.visor.cache.VisorCacheSwapBackupsTask$VisorCachesSwapBackupsJob
org.apache.ignite.internal.visor.cache.VisorCacheTypeFieldMetadata
org.apache.ignite.internal.visor.cache.VisorCacheTypeMetadata
org.apache.ignite.internal.visor.cache.VisorCacheV2
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask$VisorComputeCancelSessionsJob
org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask
Expand Down

0 comments on commit 50be063

Please sign in to comment.