Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

CORTX-33673: Improvement for lock-unlock interface with lock end time… #869

Merged
merged 11 commits into from
Aug 12, 2022

Conversation

tanujashinde0405
Copy link
Contributor

@tanujashinde0405 tanujashinde0405 commented Aug 5, 2022

… implementation

Signed-off-by: Tanuja Shinde tanuja.shinde@seagate.com

Problem Statement

  • Improve lock unlock interfaces code written in utils by adding the duration of lock to be acquired by a thread.

Design

Added new parameter in lock as duration which will update for how much time a thread can acquire lock.
if a new thread wants to acquire the lock, test_lock() interface will check if the lock_end time which is calculated by duration is less than current time and if the new thread can acquire the lock or not.

Test Cases

from cortx.utils.conf_store import Conf
Conf.load('p0', 'consul://ssc-vm-g3-rhev4-3306.colo.seagate.com/conf8')
Conf.load('p1', 'consul://ssc-vm-g3-rhev4-3306.colo.seagate.com/conf8')
Conf.load('p2', 'consul://ssc-vm-g3-rhev4-3306.colo.seagate.com/conf8')

  1. test "lock" interface

Conf.lock('p0', owner='p0', domain='prov', duration=30)
True

  1. test "test_lock" interface

Conf.test_lock('p1', owner='p1', domain='prov')
False

  1. test "unlock" interface

Conf.unlock('p0', owner='p0', domain='prov')
True

  1. test "lock" repeat

Conf.lock('p0', owner='p0', domain='prov', duration=30)
True
Conf.lock('p0', owner='p0', domain='prov', duration=30)
True
Conf.lock('p1', owner='p1', domain='prov', duration=30)
False
Conf.lock('p0', owner='p0', domain='prov', duration=30)
True

  1. lock at one thread and test “lock” from a different thread

Conf.lock('p0', owner='p0', domain='prov', duration=30)
True
Conf.lock('p1', owner='p1', domain='prov', duration=30)
False

  1. lock at one thread and test “unlock” from a different thread

Conf.lock('p0', owner='p0', domain='prov', duration=30)
True
Conf.unlock('p1', owner='p1', domain='prov')
False

  1. test “unlock” repeat

Conf.unlock('p1', owner='p1', domain='prov')
False
Conf.unlock('p1', owner='p1', domain='prov')
False
Conf.unlock('p1', owner='p1', domain='prov')
False

  1. lock with two different domains

Conf.lock('p0', owner='p0', domain='prov', duration=30)
True
Conf.lock('p0', owner='p0', domain='hare', duration=30)
True

  1. lock from one thread and test “unlock with force=true” from another thread

Conf.lock('p0', owner='p0', domain='prov', duration=30)
True
Conf.unlock('p1', owner='p1', domain='prov', force=True)
True

  1. unlock from one thread and test “lock” from another

Conf.unlock('p1', owner='p1', domain='prov', force=True)
True
Conf.lock('p0', owner='p0', domain='prov', duration=30)
True

Coding

  • Coding conventions are followed and code is consistent [Y/N]:
  • Confirm All CODACY errors are resolved [Y/N]:

Testing

  • Are test cases updated along with code changes due to Enhancements/Bugs [Y/N]:
  • Confirm that new test cases are added to regression and sanity plan files and relevant feature plan files [Y/N]:
  • Confirm that Test Cases are added for new features added [Y/N]:
  • Confirm Test Cases cover Happy Path, Non-Happy Path and Scalability [Y/N]:
  • Confirm Testing was performed with installed RPM/K8s deployment [Y/N]:

Review Checklist

Before posting the PR please ensure:

  • PR is self reviewed
  • Is there a change in filename/package/module or signature [Y/N]:
  • If yes for above point, Is a notification sent to all other cortx components [Y/N]
  • New package/s added to setup.py?
  • Jira is updated
  • Check if the description is clear and explained.
  • Check Acceptance Criterion is defined.
  • All the tests performed should be mentioned before Resolving a JIRA.
  • Verification needs to be done before marked as Closed/Verified.

KVstore/Confstore feature (changes/fixes) checklist

Confirm changes are made for:

  • ConfStore
  • KVStore
  • ConfCli
  • Test cases added for all above 3
  • changes done in all the KVpayloads (ConsulKvPayload, IniKvPayload, KvPayload)

Documentation

  • Changes done to WIKI / Confluence page

… implementation

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>
@hessio hessio added the Status: Waiting to be Reviewed PR is waiting for reviewers to review the PR label Aug 8, 2022
py-utils/src/utils/conf_store/conf_store.py Outdated Show resolved Hide resolved
py-utils/src/utils/conf_store/conf_store.py Outdated Show resolved Hide resolved
py-utils/src/utils/conf_store/conf_store.py Outdated Show resolved Hide resolved
py-utils/src/utils/conf_store/conf_store.py Outdated Show resolved Hide resolved
py-utils/src/utils/const.py Outdated Show resolved Hide resolved
py-utils/src/utils/conf_store/conf_store.py Outdated Show resolved Hide resolved
py-utils/src/utils/conf_store/conf_store.py Outdated Show resolved Hide resolved
py-utils/src/utils/conf_store/conf_store.py Show resolved Hide resolved
py-utils/src/utils/conf_store/conf_store.py Outdated Show resolved Hide resolved
py-utils/src/utils/conf_store/conf_store.py Show resolved Hide resolved
Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>
@tanujashinde0405 tanujashinde0405 force-pushed the CORTX-33673 branch 2 times, most recently from 7fc947a to 81d7a1d Compare August 9, 2022 17:38
Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>
Copy link

@nitin-seagate nitin-seagate left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>
Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>
@tanujashinde0405 tanujashinde0405 force-pushed the CORTX-33673 branch 2 times, most recently from b3ceb74 to 6680ba7 Compare August 11, 2022 08:18
@tanujashinde0405 tanujashinde0405 force-pushed the CORTX-33673 branch 2 times, most recently from 3357ac0 to e84db05 Compare August 11, 2022 08:45
Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>
Copy link
Contributor Author

@tanujashinde0405 tanujashinde0405 left a comment

Choose a reason for hiding this comment

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

5 Node deployment successful with utils and provisioner feature branch:
https://eos-jenkins.colo.seagate.com/job/Cortx-Automation/job/RGW/job/setup-cortx-rgw-cluster/10825/

@sachinpunadikar sachinpunadikar changed the title [WIP] CORTX-33673: Improvement for lock-unlock interface with lock end time… CORTX-33673: Improvement for lock-unlock interface with lock end time… Aug 12, 2022
@sachinpunadikar sachinpunadikar merged commit 933fb0d into main Aug 12, 2022
@sachinpunadikar sachinpunadikar deleted the CORTX-33673 branch August 12, 2022 05:58
lakshita-jain pushed a commit that referenced this pull request Aug 22, 2022
#869)

* CORTX-33673: Improvement for lock-unlock interface with lock end time implementation

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>

* CORTX-33673: updated setattr

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>

* CORTX-33673: updated lock unlock interfaces

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>

* CORTX-33673: updated lock unlock interfaces

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>

* CORTX-33673: push multi thread testing program in test folder

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>

* CORTX-33673: push multi thread testing program in test folder

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>

* CORTX-33673: push multi thread testing program in test folder

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>

Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>
Signed-off-by: Lakshita Jain <lakshita.jain@seagate.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Status: Waiting to be Reviewed PR is waiting for reviewers to review the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants