Skip to content
Permalink
Browse files
DRILL-6459: Unable to view profile of a running query
Fixes the missing text component of the QueryId that causes lookups to fail in `WorkManager.queries` map.
This got introduced with the fix (#1265) for DRILL-5305

Reverting change to QueryIdHelper and DRILL-5305

Removing the changes done, based on inputs from @vrozov and @sohami . The correct approach would be to have this as part of the profile to avoid serialization of the queryIdText for each RPC making use of the QueryId

UX Changes
Set the query ID string and display in WebUI

closes #1301
  • Loading branch information
kkhatua authored and sohami committed Jun 11, 2018
1 parent 26f0f1e commit 1820d466c61e2f2519f72e7cb4d4057b91ed8364
Show file tree
Hide file tree
Showing 10 changed files with 525 additions and 384 deletions.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more.

@@ -63,7 +63,7 @@ public class ProfileWrapper {

public ProfileWrapper(final QueryProfile profile, DrillConfig drillConfig) {
this.profile = profile;
this.id = profile.getId().hasText() ? profile.getId().getText() : QueryIdHelper.getQueryId(profile.getId());
this.id = profile.hasQueryId() ? profile.getQueryId() : QueryIdHelper.getQueryId(profile.getId());
//Generating Operator Name map (DRILL-6140)
String profileTextPlan = profile.hasPlan() ? profile.getPlan() : "" ;
generateOpMap(profileTextPlan);
@@ -348,6 +348,7 @@ private QueryProfile getQueryProfile(UserException ex) {
.setUser(foreman.getQueryContext().getQueryUserName())
.setType(runQuery.getType())
.setId(queryId)
.setQueryId(QueryIdHelper.getQueryId(queryId))
.setState(foreman.getState())
.setForeman(foreman.getQueryContext().getCurrentEndpoint())
.setStart(startTime)
@@ -17,7 +17,6 @@
*/
package org.apache.drill.exec.work.user;

import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;

import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
@@ -69,9 +68,7 @@ private static QueryId queryIdGenerator() {
final long time = (int) (System.currentTimeMillis()/1000);
final long p1 = ((Integer.MAX_VALUE - time) << 32) + r.nextInt();
final long p2 = r.nextLong();
final QueryId id = QueryId.newBuilder().setPart1(p1).setPart2(p2)
.setText((new UUID(p1, p2)).toString())
.build();
final QueryId id = QueryId.newBuilder().setPart1(p1).setPart2(p2).build();
return id;
}

@@ -150,8 +150,6 @@ public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.ex
output.writeSFixed64(1, message.getPart1(), false);
if(message.hasPart2())
output.writeSFixed64(2, message.getPart2(), false);
if(message.hasText())
output.writeString(3, message.getText(), false);
}
public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.QueryId message)
{
@@ -197,9 +195,6 @@ public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.ex
case 2:
builder.setPart2(input.readSFixed64());
break;
case 3:
builder.setText(input.readString());
break;
default:
input.handleUnknownField(number, this);
}
@@ -242,7 +237,6 @@ public static java.lang.String getFieldName(int number)
{
case 1: return "part1";
case 2: return "part2";
case 3: return "text";
default: return null;
}
}
@@ -256,7 +250,6 @@ public static int getFieldNumber(java.lang.String name)
{
fieldMap.put("part1", 1);
fieldMap.put("part2", 2);
fieldMap.put("text", 3);
}
}

@@ -1819,6 +1812,8 @@ public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.ex
output.writeDouble(20, message.getTotalCost(), false);
if(message.hasQueueName())
output.writeString(21, message.getQueueName(), false);
if(message.hasQueryId())
output.writeString(22, message.getQueryId(), false);
}
public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.QueryProfile message)
{
@@ -1924,6 +1919,9 @@ public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.ex
case 21:
builder.setQueueName(input.readString());
break;
case 22:
builder.setQueryId(input.readString());
break;
default:
input.handleUnknownField(number, this);
}
@@ -1985,6 +1983,7 @@ public static java.lang.String getFieldName(int number)
case 19: return "queueWaitEnd";
case 20: return "totalCost";
case 21: return "queueName";
case 22: return "queryId";
default: return null;
}
}
@@ -2017,6 +2016,7 @@ public static int getFieldNumber(java.lang.String name)
fieldMap.put("queueWaitEnd", 19);
fieldMap.put("totalCost", 20);
fieldMap.put("queueName", 21);
fieldMap.put("queryId", 22);
}
}

0 comments on commit 1820d46

Please sign in to comment.