-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
1b3ec00
to
29c3d61
Compare
pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java
Outdated
Show resolved
Hide resolved
|
||
public MinionTaskZkMetadataManager(HelixManager helixManager) { | ||
public MinionTaskZkMetadataManager(HelixManager helixManager, int endReplaceSegmentsSocketTimeoutMs) { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
29c3d61
to
c4f9a4d
Compare
…config instead of task config.
c4f9a4d
to
761e28c
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
…config instead of task config. (apache#7516)
Move
END_REPLACE_SEGMENTS_SOCKET_TIMEOUT_MS
to minion config instead of task config.