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

Roll back the write transaction on schema init if nothing changed #1281

Merged
merged 1 commit into from
Jan 16, 2015

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Dec 30, 2014

Eliminates spurious change notifications when opening a Realm flle in multiple processes.

@alazier
Copy link
Contributor

alazier commented Dec 31, 2014

I think I would prefer the simpler approach if possible rather than trying to change a bunch of stuff at once. I think I see at least one place where there could now be a race condition if initializing a Realm from multiple threads simultaneously, and I'm not convinced that we aren't breaking things by changing where and how our synchronization blocks/mutexes/exclusive writes are used.

I'm also not thrilled with the new factoring, and if we want to go ahead with these changes we may want to move/rename some stuff so that the initialization code is more consolidated an the logic is more compact.

@tgoyne tgoyne force-pushed the tg-interprocess-init branch from 4e5f4a5 to 597ab4f Compare January 16, 2015 22:51
@tgoyne tgoyne changed the title Fix race conditions when multiple processes initialize a Realm file at the same time Roll back the write transaction on schema init if nothing changed Jan 16, 2015
@tgoyne
Copy link
Member Author

tgoyne commented Jan 16, 2015

Now does way less stuff since all the other bits have been done better in different PRs.

}
}

if (oldVersion != newVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the same as migrating. This should be combined with the previous block, with if (migrationBlock) in a nested code block.

@alazier
Copy link
Contributor

alazier commented Jan 16, 2015

Other than the code factoring issues 👍

@tgoyne tgoyne force-pushed the tg-interprocess-init branch from 597ab4f to 5a99bb0 Compare January 16, 2015 23:26
Eliminates spurious change notifications when opening a Realm flle in multiple
processes.
tgoyne added a commit that referenced this pull request Jan 16, 2015
Roll back the write transaction on schema init if nothing changed
@tgoyne tgoyne merged commit 89e3f87 into master Jan 16, 2015
@tgoyne tgoyne deleted the tg-interprocess-init branch January 16, 2015 23:53
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
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.

2 participants