You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/04/08 15:44:48 UTC
[15/50] incubator-ignite git commit: Merge branches 'ignite-639' and
'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-639
Merge branches 'ignite-639' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Conflicts:
modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f600e7e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f600e7e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f600e7e8
Branch: refs/heads/ignite-437-sqltests-p2
Commit: f600e7e833055e9965209dcd8cdfc933b9cfe01a
Parents: f1eaf29 e144a68
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 11:29:54 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 11:29:54 2015 +0700
----------------------------------------------------------------------
.../ignite/internal/visor/cache/VisorCache.java | 17 ++++-
.../VisorCacheConfigurationCollectorJob.java | 76 ++++++++++++++++++++
.../VisorCacheConfigurationCollectorTask.java | 39 ++++++++++
.../VisorIgfsProfilerUniformityCounters.java | 6 +-
.../visor/node/VisorGridConfiguration.java | 38 ----------
.../visor/node/VisorIgfsConfiguration.java | 2 +-
.../visor/node/VisorRestConfiguration.java | 1 +
.../internal/visor/util/VisorTaskUtils.java | 3 +-
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../commands/cache/VisorCacheCommand.scala | 20 +++---
.../config/VisorConfigurationCommand.scala | 15 ++--
.../visor/commands/gc/VisorGcCommand.scala | 15 ++--
.../scala/org/apache/ignite/visor/visor.scala | 34 +++++++--
13 files changed, 191 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f600e7e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f600e7e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --cc modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 4d35b35,91317c9..055931b
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@@ -214,229 -200,202 +214,229 @@@ class VisorCacheCommand
* @param args Command arguments.
*/
def cache(args: String) {
- breakable {
- if (!isConnected)
- adviseToConnect()
- else {
- var argLst = parseArgs(args)
-
- if (hasArgFlag("i", argLst)) {
- askForNode("Select node from:") match {
- case Some(nid) => ask("Detailed statistics (y/n) [n]: ", "n") match {
- case "n" | "N" => nl(); cache("-id=" + nid).^^
- case "y" | "Y" => nl(); cache("-a -id=" + nid).^^
- case x => nl(); warn("Invalid answer: " + x).^^
- }
- case None => break()
+ if (!isConnected)
+ adviseToConnect()
+ else {
+ var argLst = parseArgs(args)
+
+ if (hasArgFlag("i", argLst)) {
+ askForNode("Select node from:") match {
+ case Some(nid) => ask("Detailed statistics (y/n) [n]: ", "n") match {
+ case "n" | "N" => nl(); cache("-id=" + nid).^^
+ case "y" | "Y" => nl(); cache("-a -id=" + nid).^^
+ case x => nl(); warn("Invalid answer: " + x).^^
}
-
- break()
+ case None => return
}
- val node = parseNode(argLst) match {
- case Left(msg) =>
- scold(msg)
-
- break()
-
- case Right(n) => n
- }
+ return
+ }
- val cacheName = argValue("c", argLst) match {
- case Some(dfltName) if dfltName == DFLT_CACHE_KEY || dfltName == DFLT_CACHE_NAME =>
- argLst = argLst.filter(_._1 != "c") ++ Seq("c" -> null)
+ val node = parseNode(argLst) match {
+ case Left(msg) =>
+ scold(msg)
- Some(null)
+ return
- case cn => cn
- }
+ case Right(n) => n
+ }
- if (Seq("clear", "swap", "scan").exists(hasArgFlag(_, argLst))) {
- if (cacheName.isEmpty)
- askForCache("Select cache from:", node) match {
- case Some(name) => argLst = argLst ++ Seq("c" -> name)
- case None => break()
- }
+ val showSystem = hasArgFlag("system", argLst)
- if (hasArgFlag("clear", argLst))
- VisorCacheClearCommand().clear(argLst, node)
- else if (hasArgFlag("swap", argLst))
- VisorCacheSwapCommand().swap(argLst, node)
- else if (hasArgFlag("scan", argLst))
- VisorCacheScanCommand().scan(argLst, node)
+ var cacheName = argValue("c", argLst) match {
+ case Some(dfltName) if dfltName == DFLT_CACHE_KEY || dfltName == DFLT_CACHE_NAME =>
+ argLst = argLst.filter(_._1 != "c") ++ Seq("c" -> null)
- break()
- }
+ Some(null)
- val all = hasArgFlag("a", argLst)
-
- val sortType = argValue("s", argLst)
- val reversed = hasArgName("r", argLst)
+ case cn => cn
+ }
- if (sortType.isDefined && !isValidSortType(sortType.get))
- scold("Invalid '-s' argument in: " + args).^^
+ /** Check that argument list has flag from list. */
+ def hasArgFlagIn(flags: String *) = {
+ flags.exists(hasArgFlag(_, argLst))
+ }
- // Get cache stats data from all nodes.
- val aggrData = cacheData(node, cacheName)
+ // Get cache stats data from all nodes.
+ val aggrData = cacheData(node, cacheName, showSystem)
- if (aggrData.isEmpty)
- scold("No caches found.").^^
+ if (hasArgFlagIn("clear", "swap", "scan", "stop")) {
+ if (cacheName.isEmpty)
+ askForCache("Select cache from:", node, showSystem && !hasArgFlagIn("clear", "swap", "stop"),
+ aggrData) match {
+ case Some(name) =>
+ argLst = argLst ++ Seq("c" -> name)
- println("Time of the snapshot: " + formatDateTime(System.currentTimeMillis))
+ cacheName = Some(name)
- val sumT = VisorTextTable()
+ case None => return
+ }
- sumT #= ("Name(@)", "Nodes", "Entries", "Hits", "Misses", "Reads", "Writes")
+ cacheName.foreach(name => {
+ if (hasArgFlag("scan", argLst))
+ VisorCacheScanCommand().scan(argLst, node)
+ else {
+ if (!aggrData.exists(cache => safeEquals(cache.name(), name) && cache.system())) {
+ if (hasArgFlag("clear", argLst))
+ VisorCacheClearCommand().clear(argLst, node)
+ else if (hasArgFlag("swap", argLst))
+ VisorCacheSwapCommand().swap(argLst, node)
+ else if (hasArgFlag("stop", argLst))
+ VisorCacheStopCommand().scan(argLst, node)
+ }
+ else {
+ if (hasArgFlag("clear", argLst))
+ warn("Clearing of system cache is not allowed: " + name)
+ else if (hasArgFlag("swap", argLst))
+ warn("Backup swapping of system cache is not allowed: " + name)
+ else if (hasArgFlag("stop", argLst))
+ warn("Stopping of system cache is not allowed: " + name)
+ }
+ }
+ })
- sortAggregatedData(aggrData, sortType.getOrElse("cn"), reversed).foreach(
- ad => {
- // Add cache host as visor variable.
- registerCacheName(ad.cacheName)
+ return
+ }
- sumT += (
- mkCacheName(ad.cacheName),
- ad.nodes,
- (
- "min: " + ad.minimumSize,
- "avg: " + formatDouble(ad.averageSize),
- "max: " + ad.maximumSize
- ),
- (
- "min: " + ad.minimumHits,
- "avg: " + formatDouble(ad.averageHits),
- "max: " + ad.maximumHits
- ),
- (
- "min: " + ad.minimumMisses,
- "avg: " + formatDouble(ad.averageMisses),
- "max: " + ad.maximumMisses
- ),
- (
- "min: " + ad.minimumReads,
- "avg: " + formatDouble(ad.averageReads),
- "max: " + ad.maximumReads
- ),
- (
- "min: " + ad.minimumWrites,
- "avg: " + formatDouble(ad.averageWrites),
- "max: " + ad.maximumWrites
- )
+ val all = hasArgFlag("a", argLst)
+
+ val sortType = argValue("s", argLst)
+ val reversed = hasArgName("r", argLst)
+
+ if (sortType.isDefined && !isValidSortType(sortType.get))
+ scold("Invalid '-s' argument in: " + args).^^
+
+ if (aggrData.isEmpty)
+ scold("No caches found.").^^
+
+ println("Time of the snapshot: " + formatDateTime(System.currentTimeMillis))
+
+ val sumT = VisorTextTable()
+
+ sumT #= ("Name(@)", "Mode", "Nodes", "Entries", "Hits", "Misses", "Reads", "Writes")
+
+ sortAggregatedData(aggrData, sortType.getOrElse("cn"), reversed).foreach(
+ ad => {
+ // Add cache host as visor variable.
+ registerCacheName(ad.name())
+
+ sumT += (
+ mkCacheName(ad.name()),
+ ad.mode(),
+ ad.nodes,
+ (
+ "min: " + ad.minimumSize,
+ "avg: " + formatDouble(ad.averageSize),
+ "max: " + ad.maximumSize
+ ),
+ (
+ "min: " + ad.minimumHits,
+ "avg: " + formatDouble(ad.averageHits),
+ "max: " + ad.maximumHits
+ ),
+ (
+ "min: " + ad.minimumMisses,
+ "avg: " + formatDouble(ad.averageMisses),
+ "max: " + ad.maximumMisses
+ ),
+ (
+ "min: " + ad.minimumReads,
+ "avg: " + formatDouble(ad.averageReads),
+ "max: " + ad.maximumReads
+ ),
+ (
+ "min: " + ad.minimumWrites,
+ "avg: " + formatDouble(ad.averageWrites),
+ "max: " + ad.maximumWrites
)
- }
- )
+ )
+ }
+ )
- sumT.render()
+ sumT.render()
- if (all) {
- val sorted = aggrData.sortWith((k1, k2) => {
- if (k1.cacheName == null)
- true
- else if (k2.cacheName == null)
- false
- else k1.cacheName.compareTo(k2.cacheName) < 0
- })
+ if (all) {
+ val sorted = aggrData.sortWith((k1, k2) => {
+ if (k1.name() == null)
+ true
+ else if (k2.name() == null)
+ false
+ else k1.name().compareTo(k2.name()) < 0
+ })
- val gCfg = node.map(config).collect {
- case cfg if cfg != null => cfg
- }
+ val gCfg = node.map(config).collect {
+ case cfg if cfg != null => cfg
+ }
- sorted.foreach(ad => {
- val cacheNameVar = mkCacheName(ad.cacheName)
+ sorted.foreach(ad => {
+ val cacheNameVar = mkCacheName(ad.name())
- println("\nCache '" + cacheNameVar + "':")
+ println("\nCache '" + cacheNameVar + "':")
- val m = ad.metrics()
+ val m = ad.metrics()
- val csT = VisorTextTable()
+ val csT = VisorTextTable()
- csT += ("Name(@)", cacheNameVar)
- csT += ("Nodes", m.size())
- csT += ("Size Min/Avg/Max", ad.minimumSize + " / " + formatDouble(ad.averageSize) + " / " + ad.maximumSize)
+ csT += ("Name(@)", cacheNameVar)
+ csT += ("Nodes", m.size())
+ csT += ("Size Min/Avg/Max", ad.minimumSize + " / " + formatDouble(ad.averageSize) + " / " + ad.maximumSize)
- val ciT = VisorTextTable()
+ val ciT = VisorTextTable()
- ciT #= ("Node ID8(@), IP", "CPUs", "Heap Used", "CPU Load", "Up Time", "Size", "Hi/Mi/Rd/Wr")
+ ciT #= ("Node ID8(@), IP", "CPUs", "Heap Used", "CPU Load", "Up Time", "Size", "Hi/Mi/Rd/Wr")
- sortData(m.toMap, sortType.getOrElse("hi"), reversed).foreach { case (nid, cm) =>
- val nm = ignite.cluster.node(nid).metrics()
+ sortData(m.toMap, sortType.getOrElse("hi"), reversed).foreach { case (nid, cm) =>
+ val nm = ignite.cluster.node(nid).metrics()
- ciT += (
- nodeId8Addr(nid),
- nm.getTotalCpus,
- formatDouble(100d * nm.getHeapMemoryUsed / nm.getHeapMemoryMaximum) + " %",
+ ciT += (
+ nodeId8Addr(nid),
+ nm.getTotalCpus,
+ formatDouble(100d * nm.getHeapMemoryUsed / nm.getHeapMemoryMaximum) + " %",
- formatDouble(nm.getCurrentCpuLoad * 100d) + " %",
- X.timeSpan2HMSM(nm.getUpTime),
- cm.keySize(),
- (
- "Hi: " + cm.hits(),
- "Mi: " + cm.misses(),
- "Rd: " + cm.reads(),
- "Wr: " + cm.writes()
- )
+ formatDouble(nm.getCurrentCpuLoad * 100d) + " %",
+ X.timeSpan2HMSM(nm.getUpTime),
+ cm.keySize(),
+ (
+ "Hi: " + cm.hits(),
+ "Mi: " + cm.misses(),
+ "Rd: " + cm.reads(),
+ "Wr: " + cm.writes()
)
- }
+ )
+ }
- csT.render()
+ csT.render()
- nl()
- println("Nodes for: " + cacheNameVar)
+ nl()
+ println("Nodes for: " + cacheNameVar)
- ciT.render()
+ ciT.render()
- // Print footnote.
- println("'Hi' - Number of cache hits.")
- println("'Mi' - Number of cache misses.")
- println("'Rd' - number of cache reads.")
- println("'Wr' - Number of cache writes.")
+ // Print footnote.
+ println("'Hi' - Number of cache hits.")
+ println("'Mi' - Number of cache misses.")
+ println("'Rd' - number of cache reads.")
+ println("'Wr' - Number of cache writes.")
- // Print metrics.
- nl()
- println("Aggregated queries metrics:")
- println(" Minimum execution time: " + X.timeSpan2HMSM(ad.minimumQueryTime()))
- println(" Maximum execution time: " + X.timeSpan2HMSM(ad.maximumQueryTime))
- println(" Average execution time: " + X.timeSpan2HMSM(ad.averageQueryTime.toLong))
- println(" Total number of executions: " + ad.execsQuery)
- println(" Total number of failures: " + ad.failsQuery)
+ // Print metrics.
+ nl()
+ println("Aggregated queries metrics:")
+ println(" Minimum execution time: " + X.timeSpan2HMSM(ad.minimumQueryTime()))
+ println(" Maximum execution time: " + X.timeSpan2HMSM(ad.maximumQueryTime))
+ println(" Average execution time: " + X.timeSpan2HMSM(ad.averageQueryTime.toLong))
+ println(" Total number of executions: " + ad.execsQuery)
+ println(" Total number of failures: " + ad.failsQuery)
- gCfg.foreach(_.caches().find(_.name() == ad.name()).foreach(cfg => {
- nl()
- gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(), ad.cacheName()))
- .foreach(ccfg => {
- nl()
++ gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(), ad.name()))
++ .foreach(ccfg => {
++ nl()
- showCacheConfiguration("Cache configuration:", cfg)
- showCacheConfiguration("Cache configuration:", ccfg)
- }))
- })
- }
- else
- println("\nUse \"-a\" flag to see detailed statistics.")
++ showCacheConfiguration("Cache configuration:", ccfg)
+ }))
+ })
-
}
+ else
+ println("\nUse \"-a\" flag to see detailed statistics.")
}
}
@@@ -506,15 -459,15 +506,15 @@@
}
/**
- * Gets configuration of grid from specified node for callecting of node cache's configuration.
+ * Gets configuration of grid from specified node for collecting of node cache's configuration.
*
* @param node Specified node.
- * @return Grid configuration for specified node.
+ * @return Cache configurations for specified node.
*/
- private def config(node: ClusterNode): VisorGridConfiguration = {
- try
- ignite.compute(ignite.cluster.forNode(node)).withNoFailover()
- .execute(classOf[VisorNodeConfigurationCollectorTask], emptyTaskArgument(node.id()))
+ private def config(node: ClusterNode): JavaCollection[VisorCacheConfiguration] = {
+ try {
+ cacheConfigurations(node.id())
+ }
catch {
case e: IgniteException =>
scold(e.getMessage)