Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Introduce Redis and Zookeeper locking modules. #1382

Merged
merged 15 commits into from
Nov 13, 2019
Merged

Conversation

@kishorebanala kishorebanala requested review from apanicker-nflx and a user November 8, 2019 02:36
@coveralls
Copy link

coveralls commented Nov 8, 2019

@codecov
Copy link

codecov bot commented Nov 8, 2019

Codecov Report

Merging #1382 into dev will increase coverage by 0.05%.
The diff coverage is 49.4%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
.../com/netflix/conductor/core/config/CoreModule.java 100% <ø> (ø) 21 <0> (ø) ⬇️
...ix/conductor/zookeeper/config/ZookeeperModule.java 0% <0%> (ø) 0 <0> (?)
...n/java/com/netflix/conductor/metrics/Monitors.java 69.37% <0%> (-1.5%) 40 <0> (+3)
...onductor/locking/redis/config/RedisLockModule.java 0% <0%> (ø) 0 <0> (?)
...ava/com/netflix/conductor/core/utils/NoopLock.java 0% <0%> (ø) 0 <0> (?)
...config/SystemPropertiesRedisLockConfiguration.java 100% <100%> (ø) 1 <1> (?)
...uctor/zookeeper/config/ZookeeperConfiguration.java 100% <100%> (ø) 3 <3> (?)
...config/SystemPropertiesZookeeperConfiguration.java 100% <100%> (ø) 1 <1> (?)
...m/netflix/conductor/bootstrap/ModulesProvider.java 42.3% <11.11%> (-9.36%) 4 <0> (ø)
...etflix/conductor/service/ExecutionLockService.java 38.7% <38.7%> (ø) 7 <7> (?)
... and 20 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 27ab532...b25f608. Read the comment docs.

@@ -0,0 +1,18 @@
package com.netflix.conductor.core.config;
Copy link
Collaborator

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;
Copy link
Collaborator

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
Copy link
Collaborator

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;
Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Contributor

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";
Copy link
Collaborator

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";
Copy link
Collaborator

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

Copy link
Contributor Author

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";
Copy link
Collaborator

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;
Copy link
Collaborator

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;
Copy link
Collaborator

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.
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Collaborator

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

Copy link
Collaborator

@apanicker-nflx apanicker-nflx left a 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.

@kishorebanala kishorebanala merged commit bfe3007 into dev Nov 13, 2019
@apanicker-nflx apanicker-nflx deleted the feature/redis-lock branch December 10, 2019 22:00
peterlau pushed a commit that referenced this pull request Sep 1, 2021
Introduce Redis and Zookeeper locking modules.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants