-
Notifications
You must be signed in to change notification settings - Fork 202
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
fix(DataStore): Store larger than 32-bit values in Int64 over Int #3367
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Nov 17, 2023
harsh62
approved these changes
Nov 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #
#3220
Table of Contents
Description
This PR is one of the changes necessary get DataStore working on watchOS. Currently, there are two issues with running DataStore on watchOS:
This PR addresses the first issue, as a pre-requisite to the second issue. We do this change first to make sure there are no regressions with existing use cases, and gives us a clean slate to work with. As well, it should be easier to get this change through the pipeline as it only involves internal implementation details of DataStore and have no customer impacting changes.
Int is replaced with Int64 when we know that the values we are storing are larger than 32-bit. In DataStore, ModelMetadata and MutationSyncMetadata tables have columns storing
lastSync
andlastChangedAt
. The values are, for example, 1,699,631,281,107 which is much larger than the largest 32-bit value of 2,147,483,647.DataStore uses a local SQLite database, and have no changes to the local table generation, continue to store the values as integer, which supports 4B (32 bit) or 8B (64 bits).
https://www.sqlite.org/datatype3.html
When creating a new watchOS app, the Architecture is set with “Standard Architectures (arm64, arm7k, arm64_32)”. (Xcode 15+).
https://stackoverflow.com/questions/67042548/watchos-multiple-build-targets-any-watchos-device-vs-armv7k-arm64-32
While the issue seems counter to the statement:
https://developer.apple.com/documentation/swift/int
Setting things up with the latest Xcode (15.1), Apple Watch Series 9 running watchOS 10.1, the
Int
type is observed to be 32-bit size, crashing on the error above.General Checklist
Given When Then
inline code documentation and are named accordinglytestThing_condition_expectation()
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.