-
Notifications
You must be signed in to change notification settings - Fork 13
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
check if current user still holds the write lock when upload changes #819
base: main
Are you sure you want to change the base?
check if current user still holds the write lock when upload changes #819
Conversation
If CloudSqlite throws an exception and the operation fails (unable to upload changes), it is likely that iModelDb will execute abandonChanges(). However, the CloudSqlite local cache may still contain changed blocks. If an exception is thrown and the application exits, then restarts with the same iModel, the local cache might still have dirty pages. To abandon changes in the local cache when abandoning changes on the iModel, you would need to ensure that the local cache is also cleared or synchronized to reflect the abandonment of changes. Is there a method on ClouldSqlite that i can call in SchemaSync to discard any changes after sync operation but before upload? |
Not sure if I understand this correctly, but there is another abandonChanges() in CloudContainer(JsCloudSqlite.cpp/IModelJsNative/JsCloudContainer/AbandonChanges()) which is used to abandon/revert all changes in the local cache. In SchemaSync we have nativeDb object so we can all nativeDb.cloudContainer?.abandonChanges() to discard all changes in local cache. |
Thanks for pointing me to that method. I will update schema import code to call it when schema import fails. |
…iteLock() now sets m_writeLockHeld to false.
iTwin/itwinjs-backlog#1170
There is a possible scenario that two users try to upload local changes to the same cloud container:
However, if there are no other users grab the write lock after User1, we allow User1 to upload changes(and refresh the write lock) even if the write lock has expired.
Tests are added in itwinjs-core
itwinjs-core: iTwin/itwinjs-core#7000