Skip to content

feat: redis based locking mechanism - #662

Merged
jvherweg merged 13 commits into
mainfrom
feat/create-redis-based-locking-mechanism
Apr 19, 2021
Merged

jvherweg merged 13 commits into
mainfrom
feat/create-redis-based-locking-mechanism

Conversation

@BelgianNoise

Copy link
Copy Markdown
Member

No description provided.

@BelgianNoise BelgianNoise self-assigned this Mar 10, 2021
@BelgianNoise BelgianNoise linked an issue Mar 10, 2021 that may be closed by this pull request

@RubenVerborgh RubenVerborgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Going in the right direction, I like it!

Some nits; main thing missing is an integration test along the lines of https://github.com/solid/community-server/blob/594cf27696a7c8a59231b8e3e593089816459811/test/integration/SparqlStorage.test.ts, so we test with an actual Redis.

Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
@BelgianNoise
BelgianNoise marked this pull request as ready for review March 16, 2021 14:37
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
@BelgianNoise
BelgianNoise requested a review from woutermont March 17, 2021 08:19
@woutermont
woutermont requested a review from jvherweg March 19, 2021 09:11
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread package.json Resolved
@BelgianNoise
BelgianNoise requested a review from jvherweg March 30, 2021 10:13

@jvherweg jvherweg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly minor nits and some suggestions on how to improve testing (and make it easier). The other two non-review comments that were made are still relevant of course.

Comment thread src/index.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
Comment thread src/util/locking/RedisResourceLocker.ts Resolved
@BelgianNoise
BelgianNoise requested a review from jvherweg April 8, 2021 12:54

@jvherweg jvherweg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is looking good to me. Most of the comments are small styling issues. The only concern still is the mocking of redlock. After that it should be ready to merge.

@jvherweg

Copy link
Copy Markdown
Member

@BelgianNoise I added mocks in the latest commit. I had missed in my previous reviews that several private fields were also accessed in some tests so some of them had to be changed as well. I also made some changes to the locker code to make it easier to test. The main idea is that you should be able to test everything by testing how the behaviour of the class changes instead of a private field, and if something can only be tested by checking a private field then it might indicate that something is off there. The contents of the maps could have been tested by mocking the Map constructor but that isn't really necessary. The Redlock mock could also have been made more extensive to simulate the actual behaviour more closely but that would have required a bigger rewrite of the tests.

Due to the changes there are some minor behaviour differences so do let me know if you see something that seems wrong (I guess we changed roles now 😄 ).

@BelgianNoise

Copy link
Copy Markdown
Member Author

Due to the changes there are some minor behaviour differences so do let me know if you see something that seems wrong (I guess we changed roles now 😄 ).

I don't immediately see a problem, looks good to me.

@jvherweg

Copy link
Copy Markdown
Member

I don't immediately see a problem, looks good to me.

Ok, will merge and update the Redis issue then.

@jvherweg
jvherweg merged commit 99d0173 into main Apr 19, 2021
@jvherweg
jvherweg deleted the feat/create-redis-based-locking-mechanism branch April 19, 2021 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make redis-based locking mechanism fully multithreaded

4 participants