You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/04/08 23:51:11 UTC
[GitHub] [druid] maytasm opened a new pull request #11084: Add feature to automatically remove audit logs and task logs based on number of entry and time
maytasm opened a new pull request #11084:
URL: https://github.com/apache/druid/pull/11084
Add feature to automatically remove audit logs and task logs based on number of entry and time
### Description
We currently already have a tasklog auto cleanup based on duration (time to retained) introduced in https://github.com/apache/druid/pull/3677. This PR adds auto cleanup (using the same framework) based on size (number of entry to retained). This new functionality can be use alone or together with the existing duration configs.
This PR also introduce both the auto cleanup functionality described above for the audit table.
This is useful when Druid user has a high churn of task / datasource in a short amount of time. This spike in tasklogs and audit logs can occurs immediately/recently and cannot be handle by the duration (time to retained), causing the metadata store size to grow uncontrollably.
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] suneet-s commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
suneet-s commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r616967504
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinatorConfig.java
##########
@@ -51,6 +55,14 @@
@Default("0")
public abstract int getCoordinatorKillMaxSegments();
+ @Config("druid.coordinator.kill.audit.period")
+ @Default("P1D")
+ public abstract Duration getCoordinatorAuditKillPeriod();
+
+ @Config("druid.coordinator.kill.audit.durationToRetain")
+ @Default("PT-1s")
Review comment:
These defaults don't seem to match the documented defaults above
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r616973160
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinatorConfig.java
##########
@@ -51,6 +55,14 @@
@Default("0")
public abstract int getCoordinatorKillMaxSegments();
+ @Config("druid.coordinator.kill.audit.period")
+ @Default("P1D")
+ public abstract Duration getCoordinatorAuditKillPeriod();
+
+ @Config("druid.coordinator.kill.audit.durationToRetain")
+ @Default("PT-1s")
Review comment:
Fixed the docs.
`druid.coordinator.kill.audit.period` is not required. And the default value is P1D
`druid.coordinator.kill.audit.durationToRetain` is required. The default value which is -1 which causes the precondition check to fail. User should set it to a positive value. Instead of putting in the docs that the default value is -1 and that Coordinator will fail if value is negative, for simplicity, I just documented that default value is None and user must set this value.
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] jihoonson commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
jihoonson commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r615061914
##########
File path: docs/operations/metrics.md
##########
@@ -256,6 +256,8 @@ These metrics are for the Druid Coordinator and are reset each time the Coordina
|`interval/skipCompact/count`|Total number of intervals of this datasource that are skipped (not eligible for auto compaction) by the auto compaction.|datasource.|Varies.|
|`coordinator/time`|Approximate Coordinator duty runtime in milliseconds. The duty dimension is the string alias of the Duty that is being run.|duty.|Varies.|
|`coordinator/global/time`|Approximate runtime of a full coordination cycle in milliseconds. The `dutyGroup` dimension indicates what type of coordination this run was. i.e. Historical Management vs Indexing|`dutyGroup`|Varies.|
+|`metadata/kill/audit/count`|Total number of audit logs deleted from metadata store audit table.| |Varies.|
Review comment:
How is this metric supposed to be used?
BTW, do we also need a metric for the current size (maybe in rows) of the audit logs? This should be done in a separate PR if needed.
##########
File path: docs/configuration/index.md
##########
@@ -742,6 +742,15 @@ These Coordinator static configurations can be defined in the `coordinator/runti
|`druid.coordinator.asOverlord.enabled`|Boolean value for whether this Coordinator process should act like an Overlord as well. This configuration allows users to simplify a druid cluster by not having to deploy any standalone Overlord processes. If set to true, then Overlord console is available at `http://coordinator-host:port/console.html` and be sure to set `druid.coordinator.asOverlord.overlordService` also. See next.|false|
|`druid.coordinator.asOverlord.overlordService`| Required, if `druid.coordinator.asOverlord.enabled` is `true`. This must be same value as `druid.service` on standalone Overlord processes and `druid.selectors.indexing.serviceName` on Middle Managers.|NULL|
+##### Metadata Management
+
+|Property|Description|Required?|Default|
+|--------|-----------|---------|-------|
+|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks. |No |PT3600S (1 hour)|
+|`druid.coordinator.kill.audit.on`| Boolean value for whether to enable automatic deletion of audit logs. If set to true, Coordinator will periodically remove audit logs from the audit table entries in metadata storage.| No | False|
+|`druid.coordinator.kill.audit.period`| How often to do automatic deletion of audit logs. Value must be greater than `druid.coordinator.period.metadataStoreManagementPeriod`. Only applies if `druid.coordinator.kill.audit.on` is set to True.| Yes if `druid.coordinator.kill.audit.on` is set to True| None|
+|`druid.coordinator.kill.audit.durationToRetain`| In milliseconds, audit logs to be retained created in last x milliseconds. Only applies if `druid.coordinator.kill.audit.on` is set to True.| Yes if `druid.coordinator.kill.audit.on` is set to True| None|
Review comment:
Hmm seems like this config supports the ISO 8601 notation? Please update the doc to mention what notation is supported.
##########
File path: docs/configuration/index.md
##########
@@ -742,6 +742,15 @@ These Coordinator static configurations can be defined in the `coordinator/runti
|`druid.coordinator.asOverlord.enabled`|Boolean value for whether this Coordinator process should act like an Overlord as well. This configuration allows users to simplify a druid cluster by not having to deploy any standalone Overlord processes. If set to true, then Overlord console is available at `http://coordinator-host:port/console.html` and be sure to set `druid.coordinator.asOverlord.overlordService` also. See next.|false|
|`druid.coordinator.asOverlord.overlordService`| Required, if `druid.coordinator.asOverlord.enabled` is `true`. This must be same value as `druid.service` on standalone Overlord processes and `druid.selectors.indexing.serviceName` on Middle Managers.|NULL|
+##### Metadata Management
+
+|Property|Description|Required?|Default|
+|--------|-----------|---------|-------|
+|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks. |No |PT3600S (1 hour)|
Review comment:
nit: `PT1H` seems clearer.
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/duty/KillAuditLog.java
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.druid.server.coordinator.duty;
+
+import com.google.common.base.Preconditions;
+import com.google.inject.Inject;
+import org.apache.druid.audit.AuditManager;
+import org.apache.druid.java.util.common.logger.Logger;
+import org.apache.druid.java.util.emitter.service.ServiceEmitter;
+import org.apache.druid.java.util.emitter.service.ServiceMetricEvent;
+import org.apache.druid.server.coordinator.DruidCoordinatorConfig;
+import org.apache.druid.server.coordinator.DruidCoordinatorRuntimeParams;
+
+public class KillAuditLog implements CoordinatorDuty
+{
+ private static final Logger log = new Logger(KillAuditLog.class);
+
+ private final long period;
+ private final long retainDuration;
+ private long lastKillTime = 0;
+
+ private final AuditManager auditManager;
+
+ @Inject
+ public KillAuditLog(
+ AuditManager auditManager,
+ DruidCoordinatorConfig config
+ )
+ {
+ this.period = config.getCoordinatorAuditKillPeriod().getMillis();
+ Preconditions.checkArgument(
+ this.period >= config.getCoordinatorMetadataStoreManagementPeriod().getMillis(),
+ "coordinator audit kill period must be >= druid.coordinator.period.metadataStoreManagementPeriod"
+ );
+ this.retainDuration = config.getCoordinatorAuditKillDurationToRetain().getMillis();
+ Preconditions.checkArgument(this.retainDuration >= 0, "coordinator audit kill retainDuration must be >= 0");
+ log.info(
+ "Audit Kill Task scheduling enabled with period [%s], retainDuration [%s]",
+ this.period,
+ this.retainDuration
+ );
+ this.auditManager = auditManager;
+ }
+
+ @Override
+ public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params)
+ {
+ if ((lastKillTime + period) < System.currentTimeMillis()) {
+ log.info("Running KillAuditLog duty");
Review comment:
This logging doesn't say much except that this duty is running. Maybe better to print how many logs are deleted (`auditRemoved`) in this run?
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java
##########
@@ -743,13 +756,26 @@ private void stopBeingLeader()
// CompactSegmentsDuty should be the last duty as it can take a long time to complete
duties.addAll(makeCompactSegmentsDuty());
- log.debug(
+ log.info(
Review comment:
Is change intentional? If so, can you describe why it is better to be info? I think this was changed to debug to reduce the amount of coordinator logs.
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/duty/KillAuditLog.java
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.druid.server.coordinator.duty;
+
+import com.google.common.base.Preconditions;
+import com.google.inject.Inject;
+import org.apache.druid.audit.AuditManager;
+import org.apache.druid.java.util.common.logger.Logger;
+import org.apache.druid.java.util.emitter.service.ServiceEmitter;
+import org.apache.druid.java.util.emitter.service.ServiceMetricEvent;
+import org.apache.druid.server.coordinator.DruidCoordinatorConfig;
+import org.apache.druid.server.coordinator.DruidCoordinatorRuntimeParams;
+
+public class KillAuditLog implements CoordinatorDuty
+{
+ private static final Logger log = new Logger(KillAuditLog.class);
+
+ private final long period;
+ private final long retainDuration;
+ private long lastKillTime = 0;
+
+ private final AuditManager auditManager;
+
+ @Inject
+ public KillAuditLog(
+ AuditManager auditManager,
+ DruidCoordinatorConfig config
+ )
+ {
+ this.period = config.getCoordinatorAuditKillPeriod().getMillis();
+ Preconditions.checkArgument(
+ this.period >= config.getCoordinatorMetadataStoreManagementPeriod().getMillis(),
+ "coordinator audit kill period must be >= druid.coordinator.period.metadataStoreManagementPeriod"
+ );
+ this.retainDuration = config.getCoordinatorAuditKillDurationToRetain().getMillis();
+ Preconditions.checkArgument(this.retainDuration >= 0, "coordinator audit kill retainDuration must be >= 0");
+ log.info(
Review comment:
Similarly, maybe debug?
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java
##########
@@ -743,13 +756,26 @@ private void stopBeingLeader()
// CompactSegmentsDuty should be the last duty as it can take a long time to complete
duties.addAll(makeCompactSegmentsDuty());
- log.debug(
+ log.info(
"Done making indexing service duties %s",
duties.stream().map(duty -> duty.getClass().getName()).collect(Collectors.toList())
);
return ImmutableList.copyOf(duties);
}
+ private List<CoordinatorDuty> makeMetadataStoreManagementDuties()
+ {
+ List<CoordinatorDuty> duties = ImmutableList.<CoordinatorDuty>builder()
+ .addAll(metadataStoreManagementDuties)
+ .build();
+
+ log.info(
Review comment:
Similarly, does this log need to be info? Coordinator prints a lot of logs and it's better to reduce them if possible.
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r616969033
##########
File path: docs/configuration/index.md
##########
@@ -742,6 +742,15 @@ These Coordinator static configurations can be defined in the `coordinator/runti
|`druid.coordinator.asOverlord.enabled`|Boolean value for whether this Coordinator process should act like an Overlord as well. This configuration allows users to simplify a druid cluster by not having to deploy any standalone Overlord processes. If set to true, then Overlord console is available at `http://coordinator-host:port/console.html` and be sure to set `druid.coordinator.asOverlord.overlordService` also. See next.|false|
|`druid.coordinator.asOverlord.overlordService`| Required, if `druid.coordinator.asOverlord.enabled` is `true`. This must be same value as `druid.service` on standalone Overlord processes and `druid.selectors.indexing.serviceName` on Middle Managers.|NULL|
+##### Metadata Management
+
+|Property|Description|Required?|Default|
+|--------|-----------|---------|-------|
+|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format. |No | `PT1H`|
+|`druid.coordinator.kill.audit.on`| Boolean value for whether to enable automatic deletion of audit logs. If set to true, Coordinator will periodically remove audit logs from the audit table entries in metadata storage.| No | False|
+|`druid.coordinator.kill.audit.period`| How often to do automatic deletion of audit logs in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format. Value must be greater than `druid.coordinator.period.metadataStoreManagementPeriod`. Only applies if `druid.coordinator.kill.audit.on` is set to True.| Yes if `druid.coordinator.kill.audit.on` is set to True| None|
+|`druid.coordinator.kill.audit.durationToRetain`| Duration of audit logs to be retained from created time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format. Only applies if `druid.coordinator.kill.audit.on` is set to True.| Yes if `druid.coordinator.kill.audit.on` is set to True| None|
Review comment:
Both of these fields are very different. `druid.coordinator.kill.audit.period` controls the frequency (how often) the duty runs, while `druid.coordinator.kill.audit.durationToRetain` controls how many audit logs the user wants to keep.
`druid.coordinator.kill.audit.period` is actually not required. Let me fix the docs
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm merged pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm merged pull request #11084:
URL: https://github.com/apache/druid/pull/11084
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r615145767
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java
##########
@@ -743,13 +756,26 @@ private void stopBeingLeader()
// CompactSegmentsDuty should be the last duty as it can take a long time to complete
duties.addAll(makeCompactSegmentsDuty());
- log.debug(
+ log.info(
"Done making indexing service duties %s",
duties.stream().map(duty -> duty.getClass().getName()).collect(Collectors.toList())
);
return ImmutableList.copyOf(duties);
}
+ private List<CoordinatorDuty> makeMetadataStoreManagementDuties()
+ {
+ List<CoordinatorDuty> duties = ImmutableList.<CoordinatorDuty>builder()
+ .addAll(metadataStoreManagementDuties)
+ .build();
+
+ log.info(
Review comment:
Changed back to debug.
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r615145686
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java
##########
@@ -743,13 +756,26 @@ private void stopBeingLeader()
// CompactSegmentsDuty should be the last duty as it can take a long time to complete
duties.addAll(makeCompactSegmentsDuty());
- log.debug(
+ log.info(
Review comment:
Changed back to debug.
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r615144436
##########
File path: docs/configuration/index.md
##########
@@ -742,6 +742,15 @@ These Coordinator static configurations can be defined in the `coordinator/runti
|`druid.coordinator.asOverlord.enabled`|Boolean value for whether this Coordinator process should act like an Overlord as well. This configuration allows users to simplify a druid cluster by not having to deploy any standalone Overlord processes. If set to true, then Overlord console is available at `http://coordinator-host:port/console.html` and be sure to set `druid.coordinator.asOverlord.overlordService` also. See next.|false|
|`druid.coordinator.asOverlord.overlordService`| Required, if `druid.coordinator.asOverlord.enabled` is `true`. This must be same value as `druid.service` on standalone Overlord processes and `druid.selectors.indexing.serviceName` on Middle Managers.|NULL|
+##### Metadata Management
+
+|Property|Description|Required?|Default|
+|--------|-----------|---------|-------|
+|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks. |No |PT3600S (1 hour)|
Review comment:
Done
##########
File path: docs/configuration/index.md
##########
@@ -742,6 +742,15 @@ These Coordinator static configurations can be defined in the `coordinator/runti
|`druid.coordinator.asOverlord.enabled`|Boolean value for whether this Coordinator process should act like an Overlord as well. This configuration allows users to simplify a druid cluster by not having to deploy any standalone Overlord processes. If set to true, then Overlord console is available at `http://coordinator-host:port/console.html` and be sure to set `druid.coordinator.asOverlord.overlordService` also. See next.|false|
|`druid.coordinator.asOverlord.overlordService`| Required, if `druid.coordinator.asOverlord.enabled` is `true`. This must be same value as `druid.service` on standalone Overlord processes and `druid.selectors.indexing.serviceName` on Middle Managers.|NULL|
+##### Metadata Management
+
+|Property|Description|Required?|Default|
+|--------|-----------|---------|-------|
+|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks. |No |PT3600S (1 hour)|
+|`druid.coordinator.kill.audit.on`| Boolean value for whether to enable automatic deletion of audit logs. If set to true, Coordinator will periodically remove audit logs from the audit table entries in metadata storage.| No | False|
+|`druid.coordinator.kill.audit.period`| How often to do automatic deletion of audit logs. Value must be greater than `druid.coordinator.period.metadataStoreManagementPeriod`. Only applies if `druid.coordinator.kill.audit.on` is set to True.| Yes if `druid.coordinator.kill.audit.on` is set to True| None|
+|`druid.coordinator.kill.audit.durationToRetain`| In milliseconds, audit logs to be retained created in last x milliseconds. Only applies if `druid.coordinator.kill.audit.on` is set to True.| Yes if `druid.coordinator.kill.audit.on` is set to True| None|
Review comment:
Done
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r615145963
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/duty/KillAuditLog.java
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.druid.server.coordinator.duty;
+
+import com.google.common.base.Preconditions;
+import com.google.inject.Inject;
+import org.apache.druid.audit.AuditManager;
+import org.apache.druid.java.util.common.logger.Logger;
+import org.apache.druid.java.util.emitter.service.ServiceEmitter;
+import org.apache.druid.java.util.emitter.service.ServiceMetricEvent;
+import org.apache.druid.server.coordinator.DruidCoordinatorConfig;
+import org.apache.druid.server.coordinator.DruidCoordinatorRuntimeParams;
+
+public class KillAuditLog implements CoordinatorDuty
+{
+ private static final Logger log = new Logger(KillAuditLog.class);
+
+ private final long period;
+ private final long retainDuration;
+ private long lastKillTime = 0;
+
+ private final AuditManager auditManager;
+
+ @Inject
+ public KillAuditLog(
+ AuditManager auditManager,
+ DruidCoordinatorConfig config
+ )
+ {
+ this.period = config.getCoordinatorAuditKillPeriod().getMillis();
+ Preconditions.checkArgument(
+ this.period >= config.getCoordinatorMetadataStoreManagementPeriod().getMillis(),
+ "coordinator audit kill period must be >= druid.coordinator.period.metadataStoreManagementPeriod"
+ );
+ this.retainDuration = config.getCoordinatorAuditKillDurationToRetain().getMillis();
+ Preconditions.checkArgument(this.retainDuration >= 0, "coordinator audit kill retainDuration must be >= 0");
+ log.info(
+ "Audit Kill Task scheduling enabled with period [%s], retainDuration [%s]",
+ this.period,
+ this.retainDuration
+ );
+ this.auditManager = auditManager;
+ }
+
+ @Override
+ public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params)
+ {
+ if ((lastKillTime + period) < System.currentTimeMillis()) {
+ log.info("Running KillAuditLog duty");
Review comment:
Good idea. Changed
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] jihoonson commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
jihoonson commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r616059755
##########
File path: docs/operations/metrics.md
##########
@@ -256,6 +256,8 @@ These metrics are for the Druid Coordinator and are reset each time the Coordina
|`interval/skipCompact/count`|Total number of intervals of this datasource that are skipped (not eligible for auto compaction) by the auto compaction.|datasource.|Varies.|
|`coordinator/time`|Approximate Coordinator duty runtime in milliseconds. The duty dimension is the string alias of the Duty that is being run.|duty.|Varies.|
|`coordinator/global/time`|Approximate runtime of a full coordination cycle in milliseconds. The `dutyGroup` dimension indicates what type of coordination this run was. i.e. Historical Management vs Indexing|`dutyGroup`|Varies.|
+|`metadata/kill/audit/count`|Total number of audit logs deleted from metadata store audit table.| |Varies.|
Review comment:
> The metric can give the user an idea of how many audit logs are being automatically deleted. Basically how many audit logs do they have within the duration configured. This can help them get a sense if they want to increase or decrease the durationToRetain.
Thanks for the explanation. Could you please explain this in the doc as well? Also please mention that this metric is emitted only when `druid.coordinator.kill.audit.on` is set to true.
##########
File path: docs/configuration/index.md
##########
@@ -746,10 +746,10 @@ These Coordinator static configurations can be defined in the `coordinator/runti
|Property|Description|Required?|Default|
|--------|-----------|---------|-------|
-|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks. |No |PT3600S (1 hour)|
+|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format. |No | PT1H|
Review comment:
The doc CI fails because of `PT1H`. One way to avoid the spell check for such variables is wrapping them with backticks (`` ` ``).
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] suneet-s commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
suneet-s commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r616963152
##########
File path: docs/configuration/index.md
##########
@@ -742,6 +742,15 @@ These Coordinator static configurations can be defined in the `coordinator/runti
|`druid.coordinator.asOverlord.enabled`|Boolean value for whether this Coordinator process should act like an Overlord as well. This configuration allows users to simplify a druid cluster by not having to deploy any standalone Overlord processes. If set to true, then Overlord console is available at `http://coordinator-host:port/console.html` and be sure to set `druid.coordinator.asOverlord.overlordService` also. See next.|false|
|`druid.coordinator.asOverlord.overlordService`| Required, if `druid.coordinator.asOverlord.enabled` is `true`. This must be same value as `druid.service` on standalone Overlord processes and `druid.selectors.indexing.serviceName` on Middle Managers.|NULL|
+##### Metadata Management
+
+|Property|Description|Required?|Default|
+|--------|-----------|---------|-------|
+|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format. |No | `PT1H`|
+|`druid.coordinator.kill.audit.on`| Boolean value for whether to enable automatic deletion of audit logs. If set to true, Coordinator will periodically remove audit logs from the audit table entries in metadata storage.| No | False|
+|`druid.coordinator.kill.audit.period`| How often to do automatic deletion of audit logs in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format. Value must be greater than `druid.coordinator.period.metadataStoreManagementPeriod`. Only applies if `druid.coordinator.kill.audit.on` is set to True.| Yes if `druid.coordinator.kill.audit.on` is set to True| None|
+|`druid.coordinator.kill.audit.durationToRetain`| Duration of audit logs to be retained from created time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format. Only applies if `druid.coordinator.kill.audit.on` is set to True.| Yes if `druid.coordinator.kill.audit.on` is set to True| None|
Review comment:
It looks like both of these fields are required. Can you describe how a user should think about setting both of these fields so they work together. Is there a reason we don't allow users to just set one or the other?
Will this affect upgrades if someone has `druid.coordinator.kill.audit.period` set but `druid.coordinator.kill.audit.durationToRetain` unset?
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r615145613
##########
File path: docs/operations/metrics.md
##########
@@ -256,6 +256,8 @@ These metrics are for the Druid Coordinator and are reset each time the Coordina
|`interval/skipCompact/count`|Total number of intervals of this datasource that are skipped (not eligible for auto compaction) by the auto compaction.|datasource.|Varies.|
|`coordinator/time`|Approximate Coordinator duty runtime in milliseconds. The duty dimension is the string alias of the Duty that is being run.|duty.|Varies.|
|`coordinator/global/time`|Approximate runtime of a full coordination cycle in milliseconds. The `dutyGroup` dimension indicates what type of coordination this run was. i.e. Historical Management vs Indexing|`dutyGroup`|Varies.|
+|`metadata/kill/audit/count`|Total number of audit logs deleted from metadata store audit table.| |Varies.|
Review comment:
The metric can give the user an idea of how many audit logs are being automatically deleted. Basically how many audit logs do they have within the duration configured. This can help them get a sense if they want to increase or decrease the durationToRetain. I think we should also have a metric for the current size (in rows) of the audit logs. Both of these metrics can be used together. You will be able to compare the current size (in rows) vs the kill size per run (in rows) and see if you want to increase or decrease durationToRetain.
I will add a metric for the current size (in rows) of the audit logs in a separate PR
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r616267849
##########
File path: docs/configuration/index.md
##########
@@ -746,10 +746,10 @@ These Coordinator static configurations can be defined in the `coordinator/runti
|Property|Description|Required?|Default|
|--------|-----------|---------|-------|
-|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks. |No |PT3600S (1 hour)|
+|`druid.coordinator.period.metadataStoreManagementPeriod`|How often to run metadata management tasks in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) duration format. |No | PT1H|
Review comment:
Done
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r616973160
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinatorConfig.java
##########
@@ -51,6 +55,14 @@
@Default("0")
public abstract int getCoordinatorKillMaxSegments();
+ @Config("druid.coordinator.kill.audit.period")
+ @Default("P1D")
+ public abstract Duration getCoordinatorAuditKillPeriod();
+
+ @Config("druid.coordinator.kill.audit.durationToRetain")
+ @Default("PT-1s")
Review comment:
Fixed the docs.
`druid.coordinator.kill.audit.period` is not required. And the default value is P1D
`druid.coordinator.kill.audit.durationToRetain` is required. The default value which is -1 which causes the precondition check to fail. User should set it to a positive value.
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] maytasm commented on a change in pull request #11084: Add feature to automatically remove audit logs based on retention period
Posted by GitBox <gi...@apache.org>.
maytasm commented on a change in pull request #11084:
URL: https://github.com/apache/druid/pull/11084#discussion_r615145857
##########
File path: server/src/main/java/org/apache/druid/server/coordinator/duty/KillAuditLog.java
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.druid.server.coordinator.duty;
+
+import com.google.common.base.Preconditions;
+import com.google.inject.Inject;
+import org.apache.druid.audit.AuditManager;
+import org.apache.druid.java.util.common.logger.Logger;
+import org.apache.druid.java.util.emitter.service.ServiceEmitter;
+import org.apache.druid.java.util.emitter.service.ServiceMetricEvent;
+import org.apache.druid.server.coordinator.DruidCoordinatorConfig;
+import org.apache.druid.server.coordinator.DruidCoordinatorRuntimeParams;
+
+public class KillAuditLog implements CoordinatorDuty
+{
+ private static final Logger log = new Logger(KillAuditLog.class);
+
+ private final long period;
+ private final long retainDuration;
+ private long lastKillTime = 0;
+
+ private final AuditManager auditManager;
+
+ @Inject
+ public KillAuditLog(
+ AuditManager auditManager,
+ DruidCoordinatorConfig config
+ )
+ {
+ this.period = config.getCoordinatorAuditKillPeriod().getMillis();
+ Preconditions.checkArgument(
+ this.period >= config.getCoordinatorMetadataStoreManagementPeriod().getMillis(),
+ "coordinator audit kill period must be >= druid.coordinator.period.metadataStoreManagementPeriod"
+ );
+ this.retainDuration = config.getCoordinatorAuditKillDurationToRetain().getMillis();
+ Preconditions.checkArgument(this.retainDuration >= 0, "coordinator audit kill retainDuration must be >= 0");
+ log.info(
Review comment:
Changed to debug.
--
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@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org