-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Introduce Redis and Zookeeper locking modules. #1382
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1382 +/- ##
============================================
+ Coverage 64.19% 64.25% +0.05%
- Complexity 2847 2927 +80
============================================
Files 241 251 +10
Lines 14354 14736 +382
Branches 1406 1458 +52
============================================
+ Hits 9214 9468 +254
- Misses 4366 4484 +118
- Partials 774 784 +10
Continue to review full report at Codecov.
|
@@ -0,0 +1,18 @@ | |||
package com.netflix.conductor.core.config; |
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.
Maybe move this into a separate package.
@@ -49,11 +49,13 @@ | |||
import com.netflix.conductor.core.execution.tasks.WorkflowSystemTask; | |||
import com.netflix.conductor.core.metadata.MetadataMapperService; | |||
import com.netflix.conductor.core.orchestration.ExecutionDAOFacade; | |||
import com.netflix.conductor.core.utils.ExternalPayloadStorageUtils; |
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.
Remove unused import.
@@ -193,6 +193,7 @@ public String createWorkflow(Workflow workflow) { | |||
* @param workflow the workflow tp be updated | |||
* @return the id of the updated workflow | |||
*/ | |||
//TODO: include version in workflow object |
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 this TODO to be resolved as part of this PR?
@@ -0,0 +1,24 @@ | |||
package com.netflix.conductor.core.utils; |
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.
Add license
boolean acquireLock(String lockId, long timeToTry, TimeUnit unit); | ||
|
||
/** | ||
* acquires a re-entrant lock on lockId, blocks for timeToTry duration before giving up |
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.
Consider adding a description about usage of leaseTIme
to the javadoc. The difference between this API and the one above is not clear.
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.
Maybe rename the first one to waitForLock?
import org.apache.curator.framework.CuratorFrameworkFactory; | ||
|
||
public interface ZookeeperConfiguration extends Configuration { | ||
String ZK_CONNECTION = "zk.connection"; |
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.
workflow.zookeeper.lock.connection
|
||
public interface ZookeeperConfiguration extends Configuration { | ||
String ZK_CONNECTION = "zk.connection"; | ||
String ZK_SESSIONTIMEOUT_MS = "zk.sessionTimeoutMs"; |
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.
workflow.zookeeper.lock.session.timeout.ms
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.
sessionTimeoutMs
is a Zookeeper property we're passing through. Keeping it as workflow.zookeeper.lock.sessionTimeoutMs
.
public interface ZookeeperConfiguration extends Configuration { | ||
String ZK_CONNECTION = "zk.connection"; | ||
String ZK_SESSIONTIMEOUT_MS = "zk.sessionTimeoutMs"; | ||
String ZK_CONNECTIONTIMEOUT_MS = "zk.connectionTimeoutMs"; |
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.
workflow.zookeeper.lock.connection.timeout.ms
@@ -0,0 +1,20 @@ | |||
package com.netflix.conductor.zookeeper.config; |
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.
Add license
@@ -0,0 +1,179 @@ | |||
package com.netflix.conductor.zookeeper; |
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.
Add license
|
||
String IGNORE_LOCKING_EXCEPTIONS_PROPERTY_NAME = "locking.exceptions.ignore"; | ||
boolean IGNORE_LOCKING_EXCEPTIONS_DEFAULT_VALUE = false; | ||
|
||
//TODO add constants for input/output external payload related properties. |
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.
do you need to add this?
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.
This helps to optionally ignore the locking exceptions (not the failures to obtain lock though) and not impact workflow executions.
workflow.decider.locking.enabled=false | ||
workflow.decider.locking.namespace= | ||
workflow.decider.locking.server=noop_lock | ||
workflow.decider.locking.leaseTimeInSeconds=60 |
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.
Maybe rename to workflow.decider.locking.lease.time.seconds
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.
Please squash and merge.
* Added configurable timeouts for Zookeeper. * Rename config parameters.
…ontinue execution.
bb643f7
to
b25f608
Compare
Introduce Redis and Zookeeper locking modules.
https://netflix.github.io/conductor/technicaldetails/#maintaining-workflow-consistency-with-distributed-locking-and-fencing-tokens