0.142版本研究:通过tcpdump抓包来分析交互流程

先抓包来理解整个流程。

---通过客户端执行2条命令,然后抓包。

1)系统启动时,cli界面主动发起HTTP请求到Coordinator,报文如下:

0.142版本研究:通过tcpdump抓包来分析交互流程_第1张图片

2)服务器返回响应

0.142版本研究:通过tcpdump抓包来分析交互流程_第2张图片

这里要稍微解释下:

{
"id":"20160401_024509_00000_w8xvm",---本次任务ID
"infoUri":"http://Coordinator的IP:8080/v1/query/20160401_024509_00000_w8xvm",-----查询的URL
"nextUri":"http://Coordinator的IP:8080/v1/statement/20160401_024509_00000_w8xvm/1",//下次请发起这个请求
"stats":
     {"state":"QUEUED",---已经塞入线程池了,等待执行
   "scheduled":false,---是否调度了?
    "nodes":0,
     "totalSplits":0,
  "queuedSplits":0,
  "runningSplits":0,
  "completedSplits":0,
  "userTimeMillis":0,
  "cpuTimeMillis":0,
  "wallTimeMillis":0,
  "processedRows":0,
  "processedBytes":0
 }
}

目前最主要的就是分配了一个任务ID.

---

3)CLI接着发出请求

看到了吧,这个URI跟上面的nextUri是一致的!

4)@Path("{queryId}/{token}")---token为1的响应为

0.142版本研究:通过tcpdump抓包来分析交互流程_第3张图片

 

 解释如下:

{
  "id":"20160401_024509_00000_w8xvm",
  "infoUri":"http://x.x.x.x:8080/v1/query/20160401_024509_00000_w8xvm",
  "nextUri":"http://x.x.x.:8080/v1/statement/20160401_024509_00000_w8xvm/2",---下一个URL
  "stats":
  {
    "state":"PLANNING",---已经在分析当中了
  "scheduled":false,---还未调度
  "nodes":0,---还未分发到其它节点
  "totalSplits":0,
  "queuedSplits":0,
  "runningSplits":0,
  "completedSplits":0,
  "userTimeMillis":0,
  "cpuTimeMillis":0,
  "wallTimeMillis":0,
  "processedRows":0,
  "processedBytes":0
  }
  }

5)接着发出请求

注意:这里{token}")---为2

6)响应如下:

 {
"id":"20160401_024509_00000_w8xvm",
"infoUri":"http://x.x.x.x:8080/v1/query/20160401_024509_00000_w8xvm",
"nextUri":"http://x.x.x.x:8080/v1/statement/20160401_024509_00000_w8xvm/3",---下一个TOKEN为3
"stats":{
   "state":"PLANNING",---别急,还在计划中
   "scheduled":false,----未调度
   "nodes":0,---参与节点为0
   "totalSplits":0,
   "queuedSplits":0,
   "runningSplits":0,
   "completedSplits":0,
   "userTimeMillis":0,
   "cpuTimeMillis":0,
   "wallTimeMillis":0,
   "processedRows":0,
   "processedBytes":0
  }
}

7)发出token为3的请求

GET /v1/statement/20160401_024509_00000_w8xvm/3 HTTP/1.1
User-Agent: StatementClient/0.142

8)响应如下:

{
"id":"20160401_024509_00000_w8xvm",
"infoUri":"http://x.x.x.x:8080/v1/query/20160401_024509_00000_w8xvm",
"partialCancelUri":"http://x.x.x.x:8080/v1/stage/20160401_024509_00000_w8xvm.0",
"nextUri":"http://x.x.x.x:8080/v1/statement/20160401_024509_00000_w8xvm/4",
"columns":
       [
      {
   "name":"Function",
   "type":"varchar(31)",
   "typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":31}]}
   },
   {
    "name":"Return Type",
    "type":"varchar(24)",
    "typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":24}]}
    },
    {
     "name":"Argument Types",
     "type":"varchar(78)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":78}]}
     },
     {
     "name":"Function Type","type":"varchar(9)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":9}]}
     },
     {
     "name":"Deterministic","type":"boolean","typeSignature":{"rawType":"boolean","typeArguments":[],"literalArguments":[],"arguments":[]}
     },
     {
     "name":"Description","type":"varchar(102)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":102}]}
     }
  ],
  "stats":
    {
    "state":"RUNNING",
    "scheduled":false,
    "nodes":1,
    "totalSplits":0,
    "queuedSplits":0,
    "runningSplits":0,
    "completedSplits":0,
    "userTimeMillis":0,
    "cpuTimeMillis":0,
    "wallTimeMillis":0,
    "processedRows":0,
    "processedBytes":0,
    "rootStage":
      {
     "stageId":"0",
    "state":"SCHEDULED",
    "done":false,
    "nodes":1,
    "totalSplits":0,
    "queuedSplits":0,
    "runningSplits":0,
    "completedSplits":0,
    "userTimeMillis":0,
    "cpuTimeMillis":0,
    "wallTimeMillis":0,
    "processedRows":0,
    "processedBytes":0,
    "subStages":[]
   }
  }
}

 

 9)继续发请求token=4

GET /v1/statement/20160401_024509_00000_w8xvm/4 HTTP/1.1
User-Agent: StatementClient/0.142

 

10)响应如下:

 {
 "id":"20160401_024509_00000_w8xvm",
 "infoUri":"http://x.x.x.x:8080/v1/query/20160401_024509_00000_w8xvm",
 "partialCancelUri":"http://x.x.x.x:8080/v1/stage/20160401_024509_00000_w8xvm.0",
 "nextUri":"http://x.x.x.x:8080/v1/statement/20160401_024509_00000_w8xvm/5",
 "columns":[{"name":"Function","type":"varchar(31)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":31}]}},{"name":"Return Type","type":"varchar(24)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":24}]}},{"name":"Argument Types","type":"varchar(78)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":78}]}},{"name":"Function Type","type":"varchar(9)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":9}]}},{"name":"Deterministic","type":"boolean","typeSignature":{"rawType":"boolean","typeArguments":[],"literalArguments":[],"arguments":[]}},{"name":"Description","type":"varchar(102)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":102}]}}],
 "stats":{
 "state":"RUNNING",
 "scheduled":false,
 "nodes":1,
 "totalSplits":0,
 "queuedSplits":0,
 "runningSplits":0,
 "completedSplits":0,
 "userTimeMillis":0,
 "cpuTimeMillis":0,
 "wallTimeMillis":0,
 "processedRows":0,
 "processedBytes":0,
 "rootStage":
   {
     "stageId":"0",
  "state":"SCHEDULED",
  "done":false,
  "nodes":1,
  "totalSplits":0,
  "queuedSplits":0,
  "runningSplits":0,
  "completedSplits":0,
  "userTimeMillis":0,
  "cpuTimeMillis":0,
  "wallTimeMillis":0,
  "processedRows":0,
  "processedBytes":0,
  "subStages":[]
 }
}
}

 11)发请求,token=5

12)响应如下:

{"id":"20160401_024509_00000_w8xvm",
"infoUri":"http://x.x.x.x:8080/v1/query/20160401_024509_00000_w8xvm",
"partialCancelUri":"http://x.x.x.x:8080/v1/stage/20160401_024509_00000_w8xvm.0",
"nextUri":"http://x.x.x.x:8080/v1/statement/20160401_024509_00000_w8xvm/6",
"columns":[{"name":"Function","type":"varchar(31)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":31}]}},{"name":"Return Type","type":"varchar(24)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":24}]}},{"name":"Argument Types","type":"varchar(78)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":78}]}},{"name":"Function Type","type":"varchar(9)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":9}]}},{"name":"Deterministic","type":"boolean","typeSignature":{"rawType":"boolean","typeArguments":[],"literalArguments":[],"arguments":[]}},{"name":"Description","type":"varchar(102)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":102}]}}],
"stats":{
"state":"RUNNING",
"scheduled":false,
"nodes":1,
"totalSplits":0,
"queuedSplits":0,
"runningSplits":0,
"completedSplits":0,
"userTimeMillis":0,
"cpuTimeMillis":0,
"wallTimeMillis":0,
"processedRows":0,
"processedBytes":0,
"rootStage":
{"stageId":"0",
"state":"SCHEDULED",
"done":false,
"nodes":1,
"totalSplits":0,
"queuedSplits":0,
"runningSplits":0,
"completedSplits":0,
"userTimeMillis":0,
"cpuTimeMillis":0,
"wallTimeMillis":0,
"processedRows":0,
"processedBytes":0,
"subStages":[]
}}}

 13)发请求,token=6

14)响应如下:

{"id":"20160401_024509_00000_w8xvm",
"infoUri":"http://x.x.x.x:8080/v1/query/20160401_024509_00000_w8xvm",
"partialCancelUri":"http://x.x.x.x:8080/v1/stage/20160401_024509_00000_w8xvm.0",
"nextUri":"http://x.x.x.x:8080/v1/statement/20160401_024509_00000_w8xvm/7",
"columns":
[{"name":"Function","type":"varchar(31)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":31}]}},{"name":"Return Type","type":"varchar(24)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":24}]}},{"name":"Argument Types","type":"varchar(78)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":78}]}},{"name":"Function Type","type":"varchar(9)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":9}]}},{"name":"Deterministic","type":"boolean","typeSignature":{"rawType":"boolean","typeArguments":[],"literalArguments":[],"arguments":[]}},{"name":"Description","type":"varchar(102)","typeSignature":{"rawType":"varchar","typeArguments":[],"literalArguments":[],"arguments":[{"kind":"LONG_LITERAL","value":102}]}}],
"stats":
{
"state":"RUNNING",
"scheduled":false,
"nodes":1,
"totalSplits":0,
"queuedSplits":0,
"runningSplits":0,
"completedSplits":0,
"userTimeMillis":0,
"cpuTimeMillis":0,
"wallTimeMillis":0,
"processedRows":0,
"processedBytes":0,
"rootStage":
{"stageId":"0",
"state":"SCHEDULED",
"done":false,
"nodes":1,
"totalSplits":0,
"queuedSplits":0,
"runningSplits":0,
"completedSplits":0,
"userTimeMillis":0,
"cpuTimeMillis":0,
"wallTimeMillis":0,
"processedRows":0,
"processedBytes":0,
"subStages":[]
}
}}

15)发请求,token=7

16)响应如下:

17)发请求token=8,9,10

~~~~~~~~~~~~~~~~~~~~~~~~~下面的是show tables;命令的结果

0.142版本研究:通过tcpdump抓包来分析交互流程_第4张图片

 

 

 

 

 

 

 

你可能感兴趣的:(impala,presto,MPP)