Skip to content

Commit

Permalink
Removed deprecated code. Updated VisorCache metrics.
Browse files Browse the repository at this point in the history
  • Loading branch information
akuznetsov-gridgain committed Dec 13, 2016
1 parent 962daa8 commit eec3456
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 466 deletions.
Expand Up @@ -72,7 +72,6 @@
import org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask; import org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask;
import org.apache.ignite.internal.visor.cache.VisorCacheStartTask; import org.apache.ignite.internal.visor.cache.VisorCacheStartTask;
import org.apache.ignite.internal.visor.cache.VisorCacheStopTask; import org.apache.ignite.internal.visor.cache.VisorCacheStopTask;
import org.apache.ignite.internal.visor.cache.VisorCacheSwapBackupsTask;
import org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask; import org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask;
import org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask; import org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask;
import org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask; import org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask;
Expand Down Expand Up @@ -1286,14 +1285,6 @@ public void testVisorGateway() throws Exception {


jsonTaskResult(ret); jsonTaskResult(ret);


ret = content(new VisorGatewayArgument(VisorCacheSwapBackupsTask.class)
.forNode(locNode)
.set(String.class, "person"));

info("VisorCacheSwapBackupsTask result: " + ret);

jsonTaskResult(ret);

ret = content(new VisorGatewayArgument(VisorCacheRebalanceTask.class) ret = content(new VisorGatewayArgument(VisorCacheRebalanceTask.class)
.forNode(locNode) .forNode(locNode)
.set(String.class, "person")); .set(String.class, "person"));
Expand Down Expand Up @@ -1522,7 +1513,7 @@ public void testVisorGateway() throws Exception {


jsonTaskResult(ret); jsonTaskResult(ret);


/** Spring XML to start cache via Visor task. */ // Spring XML to start cache via Visor task.
final String START_CACHE = final String START_CACHE =
"<beans xmlns=\"http://www.springframework.org/schema/beans\"\n" + "<beans xmlns=\"http://www.springframework.org/schema/beans\"\n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
Expand Down
Expand Up @@ -67,28 +67,19 @@ public class VisorCache implements Serializable, LessNamingBean {
private long indexesSize; private long indexesSize;


/** Number of all entries in cache. */ /** Number of all entries in cache. */
private int size; private long size;


/** Number of all entries in near cache. */ /** Number of all entries in near cache. */
private int nearSize; private int nearSize;


/** Number of all entries in DHT cache. */
private int dhtSize;

/** Number of primary entries in cache. */ /** Number of primary entries in cache. */
private int primarySize; private long primarySize;

/** Memory size allocated in off-heap. */
private long offHeapAllocatedSize;


/** Number of cache entries stored in off-heap memory. */ /** Number of backup entries in cache. */
private long offHeapEntriesCnt; private long backupSize;


/** Size in bytes for swap space. */ /** Number of cache entries stored in heap memory. */
private long swapSize; private long onHeapEntriesCnt;

/** Number of cache entries stored in swap space. */
private long swapKeys;


/** Number of partitions. */ /** Number of partitions. */
private int partitions; private int partitions;
Expand Down Expand Up @@ -140,19 +131,17 @@ else if (ca instanceof GridDhtCacheAdapter)
if (dca != null) { if (dca != null) {
GridDhtPartitionTopology top = dca.topology(); GridDhtPartitionTopology top = dca.topology();


if (cfg.getCacheMode() != CacheMode.LOCAL && cfg.getBackups() > 0) { if (cfg.getCacheMode() != CacheMode.LOCAL && cfg.getBackups() > 0)
partitionsMap = top.localPartitionMap(); partitionsMap = top.localPartitionMap();
}
} }
} }


dynamicDeploymentId = cctx.dynamicDeploymentId(); dynamicDeploymentId = cctx.dynamicDeploymentId();
size = ca.localSize(PEEK_NO_NEAR); size = ca.localSizeLong(PEEK_NO_NEAR);
primarySize = ca.primarySize(); primarySize = ca.primarySizeLong();
dhtSize = size - nearSize; // This is backup size. backupSize = size - primarySize; // This is backup size.
nearSize = ca.nearSize(); nearSize = ca.nearSize();
offHeapAllocatedSize = 0; // Memory is allocated globally. onHeapEntriesCnt = 0; // TODO GG-11148 Need to rename on ON-heap entries count, see
offHeapEntriesCnt = 0; // Need to rename on ON-heap entries count, see GG-11148
partitions = ca.affinity().partitions(); partitions = ca.affinity().partitions();
metrics = new VisorCacheMetrics().from(ignite, cacheName); metrics = new VisorCacheMetrics().from(ignite, cacheName);
near = cctx.isNear(); near = cctx.isNear();
Expand All @@ -171,6 +160,7 @@ else if (ca instanceof GridDhtCacheAdapter)
* @throws IgniteCheckedException If estimation failed. * @throws IgniteCheckedException If estimation failed.
*/ */
protected void estimateMemorySize(IgniteEx ignite, GridCacheAdapter ca, int sample) throws IgniteCheckedException { protected void estimateMemorySize(IgniteEx ignite, GridCacheAdapter ca, int sample) throws IgniteCheckedException {
/* TODO Fix after GG-11739 implemented.
int size = ca.size(); int size = ca.size();
Iterable<GridCacheEntryEx> set = ca.context().isNear() Iterable<GridCacheEntryEx> set = ca.context().isNear()
Expand All @@ -195,6 +185,8 @@ protected void estimateMemorySize(IgniteEx ignite, GridCacheAdapter ca, int samp
memSz = (long)((double)memSz / cnt * size); memSz = (long)((double)memSz / cnt * size);
memorySize = memSz; memorySize = memSz;
*/
memorySize = 0;
} }


/** /**
Expand All @@ -209,12 +201,9 @@ public VisorCache history() {
c.indexesSize = indexesSize; c.indexesSize = indexesSize;
c.size = size; c.size = size;
c.nearSize = nearSize; c.nearSize = nearSize;
c.dhtSize = dhtSize; c.backupSize = backupSize;
c.primarySize = primarySize; c.primarySize = primarySize;
c.offHeapAllocatedSize = offHeapAllocatedSize; c.onHeapEntriesCnt = onHeapEntriesCnt;
c.offHeapEntriesCnt = offHeapEntriesCnt;
c.swapSize = swapSize;
c.swapKeys = swapKeys;
c.partitions = partitions; c.partitions = partitions;
c.metrics = metrics; c.metrics = metrics;
c.near = near; c.near = near;
Expand Down Expand Up @@ -269,7 +258,7 @@ public long indexesSize() {
/** /**
* @return Number of all entries in cache. * @return Number of all entries in cache.
*/ */
public int size() { public long size() {
return size; return size;
} }


Expand All @@ -281,45 +270,24 @@ public int nearSize() {
} }


/** /**
* @return Number of all entries in DHT cache. * @return Number of backup entries in cache.
*/ */
public int dhtSize() { public long backupSize() {
return dhtSize; return backupSize;
} }


/** /**
* @return Number of primary entries in cache. * @return Number of primary entries in cache.
*/ */
public int primarySize() { public long primarySize() {
return primarySize; return primarySize;
} }


/** /**
* @return Memory size allocated in off-heap. * @return Number of cache entries stored in heap memory.
*/
public long offHeapAllocatedSize() {
return offHeapAllocatedSize;
}

/**
* @return Number of cache entries stored in off-heap memory.
*/
public long offHeapEntriesCount() {
return offHeapEntriesCnt;
}

/**
* @return Size in bytes for swap space.
*/
public long swapSize() {
return swapSize;
}

/**
* @return Number of cache entries stored in swap space.
*/ */
public long swapKeys() { public long onHeapEntriesCount() {
return swapKeys; return onHeapEntriesCnt;
} }


/** /**
Expand Down
Expand Up @@ -37,22 +37,17 @@ public class VisorCachePartition implements Serializable, LessNamingBean {
/** */ /** */
private long offheap; private long offheap;


/** */
private long swap;

/** /**
* Full constructor. * Full constructor.
* *
* @param part Partition id. * @param part Partition id.
* @param heap Number of keys in heap. * @param heap Number of keys in heap.
* @param offheap Number of keys in offheap. * @param offheap Number of keys in offheap.
* @param swap Number of keys in swap.
*/ */
public VisorCachePartition(int part, int heap, long offheap, long swap) { public VisorCachePartition(int part, int heap, long offheap) {
this.part = part; this.part = part;
this.heap = heap; this.heap = heap;
this.offheap = offheap; this.offheap = offheap;
this.swap = swap;
} }


/** /**
Expand All @@ -76,13 +71,6 @@ public long offheap() {
return offheap; return offheap;
} }


/**
* @return Number of keys in swap.
*/
public long swap() {
return swap;
}

/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public String toString() { @Override public String toString() {
return S.toString(VisorCachePartition.class, this); return S.toString(VisorCachePartition.class, this);
Expand Down
Expand Up @@ -50,10 +50,9 @@ public VisorCachePartitions() {
* @param part Partition id. * @param part Partition id.
* @param heap Number of primary keys in heap. * @param heap Number of primary keys in heap.
* @param offheap Number of primary keys in offheap. * @param offheap Number of primary keys in offheap.
* @param swap Number of primary keys in swap.
*/ */
public void addPrimary(int part, int heap, long offheap, long swap) { public void addPrimary(int part, int heap, long offheap) {
primary.add(new VisorCachePartition(part, heap, offheap, swap)); primary.add(new VisorCachePartition(part, heap, offheap));
} }


/** /**
Expand All @@ -62,10 +61,9 @@ public void addPrimary(int part, int heap, long offheap, long swap) {
* @param part Partition id. * @param part Partition id.
* @param heap Number of backup keys in heap. * @param heap Number of backup keys in heap.
* @param offheap Number of backup keys in offheap. * @param offheap Number of backup keys in offheap.
* @param swap Number of backup keys in swap.
*/ */
public void addBackup(int part, int heap, long offheap, long swap) { public void addBackup(int part, int heap, long offheap) {
backup.add(new VisorCachePartition(part, heap, offheap, swap)); backup.add(new VisorCachePartition(part, heap, offheap));
} }


/** /**
Expand Down
Expand Up @@ -125,9 +125,9 @@ else if (ca instanceof GridDhtCacheAdapter)


// Pass -1 as topology version in order not to wait for topology version. // Pass -1 as topology version in order not to wait for topology version.
if (part.primary(AffinityTopologyVersion.NONE)) if (part.primary(AffinityTopologyVersion.NONE))
parts.addPrimary(p, sz, 0, 0); parts.addPrimary(p, sz, 0);
else if (part.state() == GridDhtPartitionState.OWNING && part.backup(AffinityTopologyVersion.NONE)) else if (part.state() == GridDhtPartitionState.OWNING && part.backup(AffinityTopologyVersion.NONE))
parts.addBackup(p, sz, 0, 0); parts.addBackup(p, sz, 0);
} }
} }
} }
Expand Down

This file was deleted.

Expand Up @@ -64,7 +64,6 @@ class VisorConsole {
org.apache.ignite.visor.commands.cache.VisorCacheClearCommand org.apache.ignite.visor.commands.cache.VisorCacheClearCommand
org.apache.ignite.visor.commands.cache.VisorCacheResetCommand org.apache.ignite.visor.commands.cache.VisorCacheResetCommand
org.apache.ignite.visor.commands.cache.VisorCacheCommand org.apache.ignite.visor.commands.cache.VisorCacheCommand
org.apache.ignite.visor.commands.cache.VisorCacheSwapCommand
org.apache.ignite.visor.commands.config.VisorConfigurationCommand org.apache.ignite.visor.commands.config.VisorConfigurationCommand
org.apache.ignite.visor.commands.deploy.VisorDeployCommand org.apache.ignite.visor.commands.deploy.VisorDeployCommand
org.apache.ignite.visor.commands.disco.VisorDiscoveryCommand org.apache.ignite.visor.commands.disco.VisorDiscoveryCommand
Expand Down

0 comments on commit eec3456

Please sign in to comment.