Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1DBAC200BCB for ; Thu, 24 Nov 2016 18:23:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1C931160AFB; Thu, 24 Nov 2016 17:23:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 45E38160B24 for ; Thu, 24 Nov 2016 18:23:00 +0100 (CET) Received: (qmail 7044 invoked by uid 500); 24 Nov 2016 17:22:59 -0000 Mailing-List: contact issues-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list issues@drill.apache.org Received: (qmail 6786 invoked by uid 99); 24 Nov 2016 17:22:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Nov 2016 17:22:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id A07E82C03F2 for ; Thu, 24 Nov 2016 17:22:58 +0000 (UTC) Date: Thu, 24 Nov 2016 17:22:58 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-4604) Generate warning on Web UI if drillbits version mismatch is detected MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 24 Nov 2016 17:23:01 -0000 [ https://issues.apache.org/jira/browse/DRILL-4604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15693824#comment-15693824 ] ASF GitHub Bot commented on DRILL-4604: --------------------------------------- Github user arina-ielchiieva commented on a diff in the pull request: https://github.com/apache/drill/pull/482#discussion_r89306479 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java --- @@ -55,44 +59,89 @@ public Viewable getStats() { @GET @Path("/stats.json") @Produces(MediaType.APPLICATION_JSON) - public List getStatsJSON() { - List stats = Lists.newLinkedList(); - stats.add(new Stat("Number of Drill Bits", work.getContext().getBits().size())); - int number = 0; - for (CoordinationProtos.DrillbitEndpoint bit : work.getContext().getBits()) { - String initialized = bit.isInitialized() ? " initialized" : " not initialized"; - stats.add(new Stat("Bit #" + number, bit.getAddress() + initialized)); - ++number; + public Stats getStatsJSON() { + final String version = work.getContext().getOptionManager().getOption(ExecConstants.CLUSTER_VERSION).string_val; + + final Map props = Maps.newLinkedHashMap(); + props.put("Cluster Version", version); + props.put("Number of Drillbits", work.getContext().getBits().size()); + CoordinationProtos.DrillbitEndpoint currentEndpoint = work.getContext().getEndpoint(); + final String address = currentEndpoint.getAddress(); + props.put("Data Port Address", address + ":" + currentEndpoint.getDataPort()); + props.put("User Port Address", address + ":" + currentEndpoint.getUserPort()); + props.put("Control Port Address", address + ":" + currentEndpoint.getControlPort()); + props.put("Maximum Direct Memory", DrillConfig.getMaxDirectMemory()); + + return new Stats(props, collectDrillbits(version)); + } + + private Collection collectDrillbits(String version) { + Set drillbits = Sets.newTreeSet(); + for (CoordinationProtos.DrillbitEndpoint endpoint : work.getContext().getBits()) { + boolean versionMatch = version.equals(endpoint.getVersion()); + DrillbitInfo drillbit = new DrillbitInfo(endpoint.getAddress(), endpoint.isInitialized(), endpoint.getVersion(), versionMatch); + drillbits.add(drillbit); } - stats.add(new Stat("Data Port Address", work.getContext().getEndpoint().getAddress() + - ":" + work.getContext().getEndpoint().getDataPort())); - stats.add(new Stat("User Port Address", work.getContext().getEndpoint().getAddress() + - ":" + work.getContext().getEndpoint().getUserPort())); - stats.add(new Stat("Control Port Address", work.getContext().getEndpoint().getAddress() + - ":" + work.getContext().getEndpoint().getControlPort())); - stats.add(new Stat("Maximum Direct Memory", DrillConfig.getMaxDirectMemory())); - - return stats; + return drillbits; } @XmlRootElement - public class Stat { - private String name; - private Object value; + public static class Stats { + private final Map props; + private final Collection drillbits; @JsonCreator - public Stat(String name, Object value) { - this.name = name; - this.value = value; + public Stats(Map props, Collection drillbits) { + this.props = props; + this.drillbits = drillbits; + } + + public Map getProps() { + return props; } - public String getName() { - return name; + public Collection getDrillbits() { + return drillbits; } + } + + public static class DrillbitInfo implements Comparable { + private final String address; + private final boolean initialized; + private final String version; + private final boolean versionMatch; - public Object getValue() { - return value; + @JsonCreator + public DrillbitInfo(String address, boolean initialized, String version, boolean versionMatch) { + this.address = address; + this.initialized = initialized; + this.version = version; + this.versionMatch = versionMatch; } + public String getAddress() { + return address; + } + + public String isInitialized() { + return initialized ? "initialized" : "not initialized"; + } + + public String getVersion() { + return version; + } + + public boolean isVersionMatch() { + return versionMatch; + } + + @Override + public int compareTo(DrillbitInfo o) { --- End diff -- We store all drillbits in Set, we need compareTo method so they are displayed sorted. First we display current drillbit, then all drillbits with version match and then all drillbits with version mismatch. I'll add appropriate comments. > Generate warning on Web UI if drillbits version mismatch is detected > -------------------------------------------------------------------- > > Key: DRILL-4604 > URL: https://issues.apache.org/jira/browse/DRILL-4604 > Project: Apache Drill > Issue Type: Improvement > Affects Versions: 1.6.0 > Reporter: Arina Ielchiieva > Assignee: Arina Ielchiieva > Labels: doc-impacting > Fix For: Future > > Attachments: index_page.JPG, index_page_mismatch.JPG, screenshots_with_different_states.docx > > > Display drillbit version on web UI. If any of drillbits version doesn't match with current drillbit, generate warning. > Screenshots - screenshots_with_different_states.docx. -- This message was sent by Atlassian JIRA (v6.3.4#6332)