Skip to content
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

Export Document Version Property #567

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hyzx86
Copy link
Contributor

@hyzx86 hyzx86 commented May 30, 2024

The purpose of this PR is to export the Version attribute on the document to be used for synchronized lock checking in OC.

Issue associated with the OrchardCore repository was not found,

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 30, 2024

@MikeAlhayek Please approve the workflow check

@hishamco
Copy link
Contributor

What's the issue that you are trying to resolve?

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 31, 2024

What's the issue that you are trying to resolve?

The Version field in the exported database is used to do a sync lock check, e.g. there is now a sync lock in Yessql but not in OC
I want to reuse this field and logic for implementing sync locks in OC to ensure that data submitted by a user is not overwritten by another user

@sebastienros
Copy link
Owner

The Version field in the exported database is used to do a sync lock check, e.g. there is now a sync lock in Yessql but not in OC
I want to reuse this field and logic for implementing sync locks in OC to ensure that data submitted by a user is not overwritten by another user

I am confused because it was added in YesSQL for OC and we do use it in OC already, example:
https://github.com/OrchardCMS/OrchardCore/blob/53ce9d79fa09b7e0bbce147e0a4e5ecf90984633/src/OrchardCore/OrchardCore.OpenId.Core/YesSql/Stores/OpenIdTokenStore.cs#L551-L563

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 31, 2024

Yes, I understand, but I'm talking about a situation where a user is updating content from a page.
For example, if two people open a page at the same time, and user A opens it first, and B opens it later, and then B submits it, and A submits it after that, then B's submission should be overwritten.

@sebastienros
Copy link
Owner

This is exactly the scenario that is covered in my example. By default the second user overwrites the changes from the first user. With the flag on SaveAsync then it will be detected and the second user gets an exception.

@sebastienros
Copy link
Owner

It's called optimistic concurrency.

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 31, 2024

This is exactly the scenario that is covered in my example. By default the second user overwrites the changes from the first user. With the flag on SaveAsync then it will be detected and the second user gets an exception.

However, although we currently have ContentItemVersionId it is not continuous.
if we submit from a web page, we encounter the following scenario

  1. the first user opens the edit page, and the version number is 1
  2. the second user opens the edit page and submits it, the version number is 2
  3. the third user opens the page, gets version 2, modifies it and submits it, and the version number is 3.
  4. the first user finally submits, checking for version expiration.

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 31, 2024

This example is not very appropriate. Can't think of a suitable example for a while 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants