You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/02/17 20:09:51 UTC

[GitHub] [incubator-pinot] jtao15 opened a new pull request #6586: Server `queriesDisabled` metric:

jtao15 opened a new pull request #6586:
URL: https://github.com/apache/incubator-pinot/pull/6586


     1. Periodically check instance config, and send metric whether the server is queries disabled or not.
     2. Update instance api to set `queriesDsiabled` field.
   
   Manual tested by setting up local cluster, updating server instance config through rest api and checking jmx mbean values.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] codecov-io edited a comment on pull request #6586: Adding Pinot server metric: `queriesDisabled`

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #6586:
URL: https://github.com/apache/incubator-pinot/pull/6586#issuecomment-781011841


   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=h1) Report
   > Merging [#6586](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=desc) (3cefd35) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/1beaab59b73f26c4e35f3b9bc856b03806cddf5a?el=desc) (1beaab5) will **increase** coverage by `7.15%`.
   > The diff coverage is `80.37%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/6586/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz)](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #6586      +/-   ##
   ==========================================
   + Coverage   66.44%   73.60%   +7.15%     
   ==========================================
     Files        1075     1352     +277     
     Lines       54773    66423   +11650     
     Branches     8168     9692    +1524     
   ==========================================
   + Hits        36396    48888   +12492     
   + Misses      15700    14333    -1367     
   - Partials     2677     3202     +525     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | integration | `43.89% <42.70%> (?)` | |
   | unittests | `65.59% <62.57%> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...ot/broker/broker/AllowAllAccessControlFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYnJva2VyL0FsbG93QWxsQWNjZXNzQ29udHJvbEZhY3RvcnkuamF2YQ==) | `100.00% <ø> (ø)` | |
   | [.../helix/BrokerUserDefinedMessageHandlerFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYnJva2VyL2hlbGl4L0Jyb2tlclVzZXJEZWZpbmVkTWVzc2FnZUhhbmRsZXJGYWN0b3J5LmphdmE=) | `52.83% <0.00%> (-13.84%)` | :arrow_down: |
   | [...ker/routing/instanceselector/InstanceSelector.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy9pbnN0YW5jZXNlbGVjdG9yL0luc3RhbmNlU2VsZWN0b3IuamF2YQ==) | `100.00% <ø> (ø)` | |
   | [...ava/org/apache/pinot/client/AbstractResultSet.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0Fic3RyYWN0UmVzdWx0U2V0LmphdmE=) | `73.33% <ø> (+16.19%)` | :arrow_up: |
   | [...n/java/org/apache/pinot/client/BrokerResponse.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0Jyb2tlclJlc3BvbnNlLmphdmE=) | `100.00% <ø> (ø)` | |
   | [.../main/java/org/apache/pinot/client/Connection.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0Nvbm5lY3Rpb24uamF2YQ==) | `44.44% <ø> (-4.40%)` | :arrow_down: |
   | [...org/apache/pinot/client/DynamicBrokerSelector.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0R5bmFtaWNCcm9rZXJTZWxlY3Rvci5qYXZh) | `88.57% <ø> (+15.84%)` | :arrow_up: |
   | [...n/java/org/apache/pinot/client/ExecutionStats.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0V4ZWN1dGlvblN0YXRzLmphdmE=) | `68.88% <ø> (ø)` | |
   | [...va/org/apache/pinot/client/ExternalViewReader.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0V4dGVybmFsVmlld1JlYWRlci5qYXZh) | `81.69% <ø> (+31.69%)` | :arrow_up: |
   | [...inot/client/JsonAsyncHttpPinotClientTransport.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0pzb25Bc3luY0h0dHBQaW5vdENsaWVudFRyYW5zcG9ydC5qYXZh) | `56.36% <ø> (-5.64%)` | :arrow_down: |
   | ... and [1170 more](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=footer). Last update [d6fd42d...a5ebcf4](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] Jackie-Jiang commented on a change in pull request #6586: Server `queriesDisabled` metric:

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #6586:
URL: https://github.com/apache/incubator-pinot/pull/6586#discussion_r577930388



##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/config/instance/Instance.java
##########
@@ -98,4 +101,8 @@ public InstanceType getType() {
   public int getGrpcPort() {
     return _grpcPort;
   }
+
+  public boolean getQueriesDisabled() {

Review comment:
       ```suggestion
     public boolean isQueriesDisabled() {
   ```

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -431,6 +435,7 @@ public synchronized PinotResourceManagerResponse updateInstance(String instanceI
       return PinotResourceManagerResponse.failure("Instance " + instanceIdToUpdate + " does not exists");
     } else {
       InstanceConfig newConfig = InstanceUtils.toHelixInstanceConfig(newInstance);
+      newConfig.getRecord().setBooleanField(Helix.QUERIES_DISABLED, newInstance.getQueriesDisabled());

Review comment:
       Only set `Helix.QUERIES_DISABLED` when queries are disabled to be consistent with `addInstance()`

##########
File path: pinot-server/src/main/java/org/apache/pinot/server/starter/ServerQueriesDisabledTracker.java
##########
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.server.starter;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.helix.HelixManager;
+import org.apache.helix.ZNRecord;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.utils.CommonConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A class to track if the server is queries disabled.
+ */
+public class ServerQueriesDisabledTracker {
+  private static final Logger LOGGER = LoggerFactory.getLogger(ServerQueriesDisabledTracker.class);
+  private static final long FETCH_INTERVAL_MINS = 10L;
+  private static ServerQueriesDisabledTracker _singletonInstance;
+
+  private final ScheduledExecutorService _executorService = Executors.newSingleThreadScheduledExecutor();
+  private final HelixManager _helixManager;
+  private final ServerMetrics _serverMetrics;
+  private final String _clusterName;
+  private final String _instanceId;
+  private AtomicBoolean _queriesDisabled = new AtomicBoolean();
+
+  private ServerQueriesDisabledTracker(
+      String helixClusterName, String instanceId, HelixManager helixManager, ServerMetrics serverMetrics) {
+    _helixManager = helixManager;
+    _serverMetrics = serverMetrics;
+    _clusterName = helixClusterName;
+    _instanceId = instanceId;
+  }
+
+  public static synchronized void init(
+      String helixClusterName, String instanceId, HelixManager helixManager, ServerMetrics serverMetrics) {
+    if (_singletonInstance == null) {
+        _singletonInstance = new ServerQueriesDisabledTracker(helixClusterName, instanceId, helixManager, serverMetrics);
+    }
+  }
+
+  public static synchronized ServerQueriesDisabledTracker getInstance() {
+    if (_singletonInstance == null) {
+      throw new RuntimeException(ServerQueriesDisabledTracker.class.getName() + " has not been initialized.");
+    }
+    return _singletonInstance;
+  }
+
+  public void start() {
+    _serverMetrics.addCallbackGauge(CommonConstants.Helix.QUERIES_DISABLED, () -> _queriesDisabled.get() ? 1L : 0L);
+    LOGGER.info("Tracking server queries disabled.");
+    _executorService.scheduleWithFixedDelay(() -> {
+      ZNRecord instanceConfigZNRecord = _helixManager.getConfigAccessor().getInstanceConfig(_clusterName, _instanceId).getRecord();
+      if (instanceConfigZNRecord == null) {
+        LOGGER.error("Failed to get instance config: {} in {} from zookeeper" , _instanceId, _clusterName);
+      } else {
+        if ("true".equals(instanceConfigZNRecord.getSimpleField(CommonConstants.Helix.QUERIES_DISABLED))) {
+          _queriesDisabled.set(true);
+        } else {
+          _queriesDisabled.set(false);
+        }

Review comment:
       ```suggestion
           _queriesDisabled.set(instanceConfigZNRecord.getBooleanField(CommonConstants.Helix.QUERIES_DISABLED, false));
   ```

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -418,7 +418,11 @@ public synchronized PinotResourceManagerResponse addInstance(Instance instance)
     if (instances.contains(instanceIdToAdd)) {
       return PinotResourceManagerResponse.failure("Instance " + instanceIdToAdd + " already exists");
     } else {
-      _helixAdmin.addInstance(_helixClusterName, InstanceUtils.toHelixInstanceConfig(instance));
+      InstanceConfig instanceConfig = InstanceUtils.toHelixInstanceConfig(instance);
+      if (instance.getQueriesDisabled()) {
+        instanceConfig.getRecord().setBooleanField(Helix.QUERIES_DISABLED, instance.getQueriesDisabled());

Review comment:
       (nit)
   ```suggestion
           instanceConfig.getRecord().setBooleanField(Helix.QUERIES_DISABLED, true);
   ```

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java
##########
@@ -104,6 +105,10 @@ public String getInstance(
     response.set("tags", JsonUtils.objectToJsonNode(instanceConfig.getTags()));
     response.set("pools", JsonUtils.objectToJsonNode(instanceConfig.getRecord().getMapField(InstanceUtils.POOL_KEY)));
     response.put("grpcPort", getGrpcPort(instanceConfig));
+    String queriesDisabled = instanceConfig.getRecord().getSimpleField(CommonConstants.Helix.QUERIES_DISABLED);
+    if ("true".equals(queriesDisabled) || "false".equals(queriesDisabled)) {

Review comment:
       Suggest adding it only when `queriesDisabled` is true




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #6586: Server `queriesDisabled` metric:

Posted by GitBox <gi...@apache.org>.
fx19880617 commented on a change in pull request #6586:
URL: https://github.com/apache/incubator-pinot/pull/6586#discussion_r578824199



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java
##########
@@ -104,19 +105,34 @@ public String getInstance(
     response.set("tags", JsonUtils.objectToJsonNode(instanceConfig.getTags()));
     response.set("pools", JsonUtils.objectToJsonNode(instanceConfig.getRecord().getMapField(InstanceUtils.POOL_KEY)));
     response.put("grpcPort", getGrpcPort(instanceConfig));
+    response.put("adminPort", getAdminPort(instanceConfig));
+    String queriesDisabled = instanceConfig.getRecord().getSimpleField(CommonConstants.Helix.QUERIES_DISABLED);
+    if ("true".equalsIgnoreCase(queriesDisabled)) {
+      response.put(CommonConstants.Helix.QUERIES_DISABLED, "true");
+    }
     return response.toString();
   }
 
   private int getGrpcPort(InstanceConfig instanceConfig) {
     int grpcPort;
     try {
-      grpcPort = Integer.parseInt(instanceConfig.getRecord().getSimpleField(InstanceUtils.GRPC_PORT_KEY));
+      grpcPort = Integer.parseInt(instanceConfig.getRecord().getSimpleField(CommonConstants.Helix.Instance.GRPC_PORT_KEY));
     } catch (Exception e) {
       grpcPort = Instance.NOT_SET_GRPC_PORT_VALUE;
     }
     return grpcPort;
   }
 
+  private int getAdminPort(InstanceConfig instanceConfig) {
+    int adminPort;
+    try {
+      adminPort = Integer.parseInt(instanceConfig.getRecord().getSimpleField(CommonConstants.Helix.Instance.ADMIN_PORT_KEY));
+    } catch (Exception e) {
+      adminPort = Instance.NOT_SET_ADMIN_PORT_VALUE;

Review comment:
       log this exception




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] snleee commented on a change in pull request #6586: Server `queriesDisabled` metric:

Posted by GitBox <gi...@apache.org>.
snleee commented on a change in pull request #6586:
URL: https://github.com/apache/incubator-pinot/pull/6586#discussion_r578016471



##########
File path: pinot-server/src/main/java/org/apache/pinot/server/starter/ServerQueriesDisabledTracker.java
##########
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.server.starter;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.helix.HelixManager;
+import org.apache.helix.ZNRecord;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.utils.CommonConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A class to track if the server is queries disabled.
+ */
+public class ServerQueriesDisabledTracker {
+  private static final Logger LOGGER = LoggerFactory.getLogger(ServerQueriesDisabledTracker.class);
+  private static final long FETCH_INTERVAL_MINS = 10L;
+  private static ServerQueriesDisabledTracker _singletonInstance;
+
+  private final ScheduledExecutorService _executorService = Executors.newSingleThreadScheduledExecutor();
+  private final HelixManager _helixManager;
+  private final ServerMetrics _serverMetrics;
+  private final String _clusterName;
+  private final String _instanceId;
+  private AtomicBoolean _queriesDisabled = new AtomicBoolean();
+
+  private ServerQueriesDisabledTracker(
+      String helixClusterName, String instanceId, HelixManager helixManager, ServerMetrics serverMetrics) {
+    _helixManager = helixManager;
+    _serverMetrics = serverMetrics;
+    _clusterName = helixClusterName;
+    _instanceId = instanceId;
+  }
+
+  public static synchronized void init(

Review comment:
       Do we need `synchronized` ? I think that only a single thread will make calls on this class.

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -418,7 +418,11 @@ public synchronized PinotResourceManagerResponse addInstance(Instance instance)
     if (instances.contains(instanceIdToAdd)) {
       return PinotResourceManagerResponse.failure("Instance " + instanceIdToAdd + " already exists");
     } else {
-      _helixAdmin.addInstance(_helixClusterName, InstanceUtils.toHelixInstanceConfig(instance));
+      InstanceConfig instanceConfig = InstanceUtils.toHelixInstanceConfig(instance);
+      if (instance.isQueriesDisabled()) {

Review comment:
       Can you move this part into `InstanceUtils.toHelixInstanceConfig()` so that all the conversion happens in a single place?

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java
##########
@@ -104,6 +105,10 @@ public String getInstance(
     response.set("tags", JsonUtils.objectToJsonNode(instanceConfig.getTags()));
     response.set("pools", JsonUtils.objectToJsonNode(instanceConfig.getRecord().getMapField(InstanceUtils.POOL_KEY)));
     response.put("grpcPort", getGrpcPort(instanceConfig));
+    String queriesDisabled = instanceConfig.getRecord().getSimpleField(CommonConstants.Helix.QUERIES_DISABLED);
+    if ("true".equals(queriesDisabled)) {

Review comment:
       I think that it's better to handle upper/lower cases:
   ```
   e.g.
   
   queriesDisabled = true
   queriesDisabled = True <- By default, Python uses this pattern for boolean and we had an issue with this once. 
   queriesDisabled = TRUE
   ...
   ```

##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/config/instance/Instance.java
##########
@@ -52,13 +52,15 @@
   private final List<String> _tags;
   private final Map<String, Integer> _pools;
   private final int _grpcPort;
+  private final boolean _queriesDisabled;
 
   @JsonCreator
   public Instance(@JsonProperty(value = "host", required = true) String host,
       @JsonProperty(value = "port", required = true) int port,
       @JsonProperty(value = "type", required = true) InstanceType type,
       @JsonProperty("tags") @Nullable List<String> tags, @JsonProperty("pools") @Nullable Map<String, Integer> pools,
-      @JsonProperty("grpcPort") int grpcPort) {
+      @JsonProperty("grpcPort") int grpcPort,
+      @JsonProperty("queriesDisabled") boolean queriesDisabled) {

Review comment:
       Let's also add `adminPort`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] jtao15 commented on a change in pull request #6586: Server `queriesDisabled` metric:

Posted by GitBox <gi...@apache.org>.
jtao15 commented on a change in pull request #6586:
URL: https://github.com/apache/incubator-pinot/pull/6586#discussion_r578083713



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java
##########
@@ -104,6 +105,10 @@ public String getInstance(
     response.set("tags", JsonUtils.objectToJsonNode(instanceConfig.getTags()));
     response.set("pools", JsonUtils.objectToJsonNode(instanceConfig.getRecord().getMapField(InstanceUtils.POOL_KEY)));
     response.put("grpcPort", getGrpcPort(instanceConfig));
+    String queriesDisabled = instanceConfig.getRecord().getSimpleField(CommonConstants.Helix.QUERIES_DISABLED);
+    if ("true".equals(queriesDisabled)) {

Review comment:
       I'll update it with `equalsIgnoreCase()` to make it more robust.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] jtao15 commented on a change in pull request #6586: Server `queriesDisabled` metric:

Posted by GitBox <gi...@apache.org>.
jtao15 commented on a change in pull request #6586:
URL: https://github.com/apache/incubator-pinot/pull/6586#discussion_r578083481



##########
File path: pinot-server/src/main/java/org/apache/pinot/server/starter/ServerQueriesDisabledTracker.java
##########
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.server.starter;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.helix.HelixManager;
+import org.apache.helix.ZNRecord;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.common.utils.CommonConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A class to track if the server is queries disabled.
+ */
+public class ServerQueriesDisabledTracker {
+  private static final Logger LOGGER = LoggerFactory.getLogger(ServerQueriesDisabledTracker.class);
+  private static final long FETCH_INTERVAL_MINS = 10L;
+  private static ServerQueriesDisabledTracker _singletonInstance;
+
+  private final ScheduledExecutorService _executorService = Executors.newSingleThreadScheduledExecutor();
+  private final HelixManager _helixManager;
+  private final ServerMetrics _serverMetrics;
+  private final String _clusterName;
+  private final String _instanceId;
+  private AtomicBoolean _queriesDisabled = new AtomicBoolean();
+
+  private ServerQueriesDisabledTracker(
+      String helixClusterName, String instanceId, HelixManager helixManager, ServerMetrics serverMetrics) {
+    _helixManager = helixManager;
+    _serverMetrics = serverMetrics;
+    _clusterName = helixClusterName;
+    _instanceId = instanceId;
+  }
+
+  public static synchronized void init(

Review comment:
       Since we only use this in one place, I'll remove the singleton pattern, and the `synchronized` is not needed anymore.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] snleee merged pull request #6586: Adding Pinot server metric: `queriesDisabled`

Posted by GitBox <gi...@apache.org>.
snleee merged pull request #6586:
URL: https://github.com/apache/incubator-pinot/pull/6586


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] codecov-io commented on pull request #6586: Server `queriesDisabled` metric:

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #6586:
URL: https://github.com/apache/incubator-pinot/pull/6586#issuecomment-781011841


   # [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=h1) Report
   > Merging [#6586](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=desc) (43b8973) into [master](https://codecov.io/gh/apache/incubator-pinot/commit/1beaab59b73f26c4e35f3b9bc856b03806cddf5a?el=desc) (1beaab5) will **decrease** coverage by `0.81%`.
   > The diff coverage is `62.57%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-pinot/pull/6586/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz)](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #6586      +/-   ##
   ==========================================
   - Coverage   66.44%   65.63%   -0.82%     
   ==========================================
     Files        1075     1346     +271     
     Lines       54773    66178   +11405     
     Branches     8168     9647    +1479     
   ==========================================
   + Hits        36396    43434    +7038     
   - Misses      15700    19647    +3947     
   - Partials     2677     3097     +420     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | unittests | `65.63% <62.57%> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...e/pinot/broker/api/resources/PinotBrokerDebug.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYXBpL3Jlc291cmNlcy9QaW5vdEJyb2tlckRlYnVnLmphdmE=) | `0.00% <0.00%> (-79.32%)` | :arrow_down: |
   | [...pinot/broker/api/resources/PinotClientRequest.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYXBpL3Jlc291cmNlcy9QaW5vdENsaWVudFJlcXVlc3QuamF2YQ==) | `0.00% <0.00%> (-27.28%)` | :arrow_down: |
   | [...ot/broker/broker/AllowAllAccessControlFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYnJva2VyL0FsbG93QWxsQWNjZXNzQ29udHJvbEZhY3RvcnkuamF2YQ==) | `71.42% <ø> (-28.58%)` | :arrow_down: |
   | [.../helix/BrokerUserDefinedMessageHandlerFactory.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvYnJva2VyL2hlbGl4L0Jyb2tlclVzZXJEZWZpbmVkTWVzc2FnZUhhbmRsZXJGYWN0b3J5LmphdmE=) | `33.96% <0.00%> (-32.71%)` | :arrow_down: |
   | [...ker/routing/instanceselector/InstanceSelector.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtYnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9icm9rZXIvcm91dGluZy9pbnN0YW5jZXNlbGVjdG9yL0luc3RhbmNlU2VsZWN0b3IuamF2YQ==) | `100.00% <ø> (ø)` | |
   | [...ava/org/apache/pinot/client/AbstractResultSet.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0Fic3RyYWN0UmVzdWx0U2V0LmphdmE=) | `66.66% <ø> (+9.52%)` | :arrow_up: |
   | [...n/java/org/apache/pinot/client/BrokerResponse.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0Jyb2tlclJlc3BvbnNlLmphdmE=) | `100.00% <ø> (ø)` | |
   | [.../main/java/org/apache/pinot/client/Connection.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0Nvbm5lY3Rpb24uamF2YQ==) | `35.55% <ø> (-13.29%)` | :arrow_down: |
   | [...org/apache/pinot/client/DynamicBrokerSelector.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0R5bmFtaWNCcm9rZXJTZWxlY3Rvci5qYXZh) | `82.85% <ø> (+10.12%)` | :arrow_up: |
   | [...n/java/org/apache/pinot/client/ExecutionStats.java](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree#diff-cGlub3QtY2xpZW50cy9waW5vdC1qYXZhLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2xpZW50L0V4ZWN1dGlvblN0YXRzLmphdmE=) | `68.88% <ø> (ø)` | |
   | ... and [1206 more](https://codecov.io/gh/apache/incubator-pinot/pull/6586/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=footer). Last update [5225ce8...43b8973](https://codecov.io/gh/apache/incubator-pinot/pull/6586?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org