Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move END_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS to minion config instead of task config. #7516

Merged
merged 1 commit into from
Oct 8, 2021

Conversation

jtao15
Copy link
Contributor

@jtao15 jtao15 commented Oct 4, 2021

Move END_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS to minion config instead of task config.

@@ -102,7 +102,12 @@ public void init(PinotConfiguration config)
setupHelixSystemProperties();
_helixManager = new ZKHelixManager(helixClusterName, _instanceId, InstanceType.PARTICIPANT, zkAddress);
MinionTaskZkMetadataManager minionTaskZkMetadataManager = new MinionTaskZkMetadataManager(_helixManager);
_taskExecutorFactoryRegistry = new TaskExecutorFactoryRegistry(minionTaskZkMetadataManager);
int endReplaceSegmentsSocketTimeoutMs =
_config.getProperty(CommonConstants.Minion.END_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS_KEY) != null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any existing method like getOrDefault that you can use to make it clean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, using the getOrDefault function instead.

@@ -26,7 +26,7 @@
/**
* Initializes the task executor factory.
*/
void init(MinionTaskZkMetadataManager zkMetadataManager);
void init(MinionTaskZkMetadataManager zkMetadataManager, int endReplaceSegmentsSocketTimeoutMs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big fan of changing the interface here as this interface is not just used by merge and roll up task. Is it possible to put it inside the zkMetadataManager?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to store the value in zkMetadataManager

@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2021

Codecov Report

Merging #7516 (aaeeb58) into master (f306460) will decrease coverage by 41.95%.
The diff coverage is 100.00%.

❗ Current head aaeeb58 differs from pull request most recent head 29c3d61. Consider uploading reports for the commit 29c3d61 to get more accurate results
Impacted file tree graph

@@              Coverage Diff              @@
##             master    #7516       +/-   ##
=============================================
- Coverage     72.60%   30.65%   -41.96%     
=============================================
  Files          1523     1514        -9     
  Lines         75609    75264      -345     
  Branches      11022    10983       -39     
=============================================
- Hits          54895    23069    -31826     
- Misses        17018    50143    +33125     
+ Partials       3696     2052     -1644     
Flag Coverage Δ
integration1 30.65% <100.00%> (-0.07%) ⬇️
integration2 ?
unittests1 ?
unittests2 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../org/apache/pinot/core/common/MinionConstants.java 0.00% <ø> (ø)
...on/tasks/mergerollup/MergeRollupTaskGenerator.java 75.27% <ø> (-12.46%) ⬇️
...va/org/apache/pinot/spi/utils/CommonConstants.java 0.00% <ø> (-26.32%) ⬇️
...ava/org/apache/pinot/minion/BaseMinionStarter.java 75.43% <100.00%> (-2.24%) ⬇️
...t/minion/executor/MinionTaskZkMetadataManager.java 100.00% <100.00%> (ø)
.../tasks/BaseMultipleSegmentsConversionExecutor.java 87.91% <100.00%> (+1.09%) ⬆️
...ion/tasks/mergerollup/MergeRollupTaskExecutor.java 100.00% <100.00%> (ø)
...ks/mergerollup/MergeRollupTaskExecutorFactory.java 100.00% <100.00%> (ø)
...egments/RealtimeToOfflineSegmentsTaskExecutor.java 92.53% <100.00%> (-1.59%) ⬇️
...c/main/java/org/apache/pinot/common/tier/Tier.java 0.00% <0.00%> (-100.00%) ⬇️
... and 1063 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f306460...29c3d61. Read the comment docs.

@jtao15 jtao15 force-pushed the externalViewOnlineSegmentsTimeout branch 2 times, most recently from 1b3ec00 to 29c3d61 Compare October 5, 2021 00:50

public MinionTaskZkMetadataManager(HelixManager helixManager) {
public MinionTaskZkMetadataManager(HelixManager helixManager, int endReplaceSegmentsSocketTimeoutMs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 that we should not change the interface. However, adding this config to MinionTaskZkMetadataManager looks like a hacky solution to me.
Here's the class definition.

 * An abstraction on top of {@link HelixManager}, created for the {@link PinotTaskExecutor}, restricted to only
 * get/update minion task metadata

Let's brainstorm the better way (e.g. add the new method instead of changing the interface)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, based on the definition, the minion configs should not be maintained by this class. Moved the config into BaseMultipleSegmentsConversionExecutor class. Added new init function in PinotTaskExecutorFactory to make it backward compatible.

@@ -104,7 +104,7 @@ public void setUp()
@Test
public void testConvert()
throws Exception {
MergeRollupTaskExecutor mergeRollupTaskExecutor = new MergeRollupTaskExecutor();
MergeRollupTaskExecutor mergeRollupTaskExecutor = new MergeRollupTaskExecutor(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the minionZkMetadataManager is null, can we just use the default constructor here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the constructor to use MinionConf as input instead. Hmm, this requires to add the default constructor explicitly while the config should be a required field. Maybe we can use new MinionConf() instead cause this field should never be null?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

_config.getProperty(CommonConstants.Minion.END_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS_KEY,
CommonConstants.Minion.DEFAULT_END_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS);
MinionTaskZkMetadataManager minionTaskZkMetadataManager =
new MinionTaskZkMetadataManager(_helixManager, endReplaceSegmentsSocketTimeoutMs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about passing the whole PinotConfiguration to the MinionTaskZkMetadataManager class? By doing so, you don't have to keep adding parameters to the constructor (which is a bad idea) if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! This is also mentioned by @snleee offline. Created the new MinionConf class instead. Based on the definition of MinionTaskZkMetadataManager, moved the configs out of this class.

@jtao15 jtao15 force-pushed the externalViewOnlineSegmentsTimeout branch from 29c3d61 to c4f9a4d Compare October 7, 2021 22:26
@jtao15 jtao15 force-pushed the externalViewOnlineSegmentsTimeout branch from c4f9a4d to 761e28c Compare October 8, 2021 00:31
Copy link
Contributor

@snleee snleee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than the minor comment.

@@ -26,8 +29,14 @@
/**
* Initializes the task executor factory.
*/
@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make sure there's no usage of this within the Pinot code base?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's no usage of this function.

@snleee snleee merged commit 6969b38 into apache:master Oct 8, 2021
kriti-sc pushed a commit to kriti-sc/incubator-pinot that referenced this pull request Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants