You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "findingrish (via GitHub)" <gi...@apache.org> on 2024/08/09 05:51:07 UTC

[PR] [bugfix] Run cold schema refresh thread periodically (druid)

findingrish opened a new pull request, #16873:
URL: https://github.com/apache/druid/pull/16873

   ### Issue 
   Schema from cold segments wasn't getting reflected in the datasource schema.
   The problem turned out to be in the refresh thread, it ran only once instead of running periodically. 
   
   Apart from fixing the issue and adding UTs, this PR also adds some metrics to monitor cold schema refresh process. 
   
   ### Release Notes 
   
   Add followings metrics to monitor cold schema refresh. 
   ```
   metadatacache/cold/segment/count -> Number of cold segment per datasource. 
   metadatacache/cold/refresh/count -> Number of cold segments with cached schema per datasource. 
   metadatacache/cold/process/time -> Time taken in milliseconds to process cold segments. 
   ```
   
   This PR has:
   
   - [X] 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.
   - [ ] a release note entry in the PR description.
   - [ ] 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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

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


Re: [PR] [bugfix] Run cold schema refresh thread periodically (druid)

Posted by "findingrish (via GitHub)" <gi...@apache.org>.
findingrish commented on code in PR #16873:
URL: https://github.com/apache/druid/pull/16873#discussion_r1711246502


##########
docs/operations/metrics.md:
##########
@@ -382,6 +382,9 @@ These metrics are emitted by the Druid Coordinator in every run of the correspon
 |`metadatacache/finalizedSchemaPayload/count`|Number of finalized segment schema cached.||Depends on the number of distinct schema in the cluster.|
 |`metadatacache/temporaryMetadataQueryResults/count`|Number of segments for which schema was fetched by executing segment metadata query.||Eventually it should be 0.|
 |`metadatacache/temporaryPublishedMetadataQueryResults/count`|Number of segments for which schema is cached after back filling in the database.||This value gets reset after each database poll. Eventually it should be 0.|
+|`metadatacache/cold/segment/count`|Number of cold segments.|`dataSource`||
+|`metadatacache/cold/refresh/count`|Number of cold segments with cached schema.|`dataSource`||

Review Comment:
   > It would be better to use a term that is more easily relatable.
   
   I don't find much references for such segments, do you have any suggestions? 
   
   > Since this feature is still nascent, I would advise we revisit all the metric names for this feature and categorize them nicely with proper prefixes. 
   
   Are you suggesting to use a different prefix than `metadatacache`? How about `cds`? 
   



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

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


Re: [PR] [bugfix] Run cold schema refresh thread periodically (druid)

Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe commented on code in PR #16873:
URL: https://github.com/apache/druid/pull/16873#discussion_r1710825428


##########
server/src/main/java/org/apache/druid/segment/metadata/CoordinatorSegmentMetadataCache.java:
##########
@@ -580,36 +585,61 @@ protected void coldDatasourceSchemaExec()
         if (optionalSchema.isPresent()) {
           RowSignature rowSignature = optionalSchema.get().getSchemaPayload().getRowSignature();
           mergeRowSignature(columnTypes, rowSignature);
+          coldSegmentWithSchema++;
         }
-        segments++;
+        coldSegments++;
       }
 
-      if (columnTypes.isEmpty()) {
+      if (coldSegments == 0) {
         // this datasource doesn't have any cold segment
         continue;
       }
 
+      totalColdSegments += coldSegments;
+
+      String dataSourceName = dataSource.getName();
+
+      ServiceMetricEvent.Builder metricBuilder =
+          new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSourceName);
+
+      emitter.emit(metricBuilder.setMetric("metadatacache/cold/segment/count", coldSegments));

Review Comment:
   Nit: Use a prefix for `metadatacache/cold/segment/`



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

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


Re: [PR] [bugfix] Run cold schema refresh thread periodically (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #16873:
URL: https://github.com/apache/druid/pull/16873#discussion_r1710859680


##########
docs/operations/metrics.md:
##########
@@ -382,6 +382,9 @@ These metrics are emitted by the Druid Coordinator in every run of the correspon
 |`metadatacache/finalizedSchemaPayload/count`|Number of finalized segment schema cached.||Depends on the number of distinct schema in the cluster.|
 |`metadatacache/temporaryMetadataQueryResults/count`|Number of segments for which schema was fetched by executing segment metadata query.||Eventually it should be 0.|
 |`metadatacache/temporaryPublishedMetadataQueryResults/count`|Number of segments for which schema is cached after back filling in the database.||This value gets reset after each database poll. Eventually it should be 0.|
+|`metadatacache/cold/segment/count`|Number of cold segments.|`dataSource`||
+|`metadatacache/cold/refresh/count`|Number of cold segments with cached schema.|`dataSource`||

Review Comment:
   "cold segment" is not a term that exists anywhere outside of `CoordinatorSegmentMetadataCache`.
   It would be better to use a term that is more easily relatable.
   
   Also, the metadatacache metrics seems all over the place with their prefixes. It is unavoidable for metrics across multiple features to not have a consistent naming scheme. But metrics within the same feature should be consistent. Since this feature is still nascent, I would advise we revisit all the metric names for this feature and categorize them nicely with proper prefixes. (not necessarily in this PR)
   
   cc: @cryptoe 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

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


Re: [PR] [bugfix] Run cold schema refresh thread periodically (druid)

Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe merged PR #16873:
URL: https://github.com/apache/druid/pull/16873


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

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


Re: [PR] [bugfix] Run cold schema refresh thread periodically (druid)

Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe commented on code in PR #16873:
URL: https://github.com/apache/druid/pull/16873#discussion_r1713204053


##########
docs/operations/metrics.md:
##########
@@ -382,6 +382,9 @@ These metrics are emitted by the Druid Coordinator in every run of the correspon
 |`metadatacache/finalizedSchemaPayload/count`|Number of finalized segment schema cached.||Depends on the number of distinct schema in the cluster.|
 |`metadatacache/temporaryMetadataQueryResults/count`|Number of segments for which schema was fetched by executing segment metadata query.||Eventually it should be 0.|
 |`metadatacache/temporaryPublishedMetadataQueryResults/count`|Number of segments for which schema is cached after back filling in the database.||This value gets reset after each database poll. Eventually it should be 0.|
+|`metadatacache/cold/segment/count`|Number of cold segments.|`dataSource`||
+|`metadatacache/cold/refresh/count`|Number of cold segments with cached schema.|`dataSource`||

Review Comment:
   Yes lets change the wording from `cold` to  `deepstorageonly`. 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

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