realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

fix wait_for_download behaviour with permission schema

Open nhachicha opened this issue 7 years ago • 6 comments

After the fix in Sync we should no longer need the hack that registers a subscription and wait for Update to be triggered in order to start locking the schema. It should only require an asyncOpen with a waitForInitialData for the Realm to synchronise the permission schema from Sync (the one that includes the correction without duplicates), we can then start modifying it to lock the schema for instance.

However, this was not working in Android as opposed to iOS. Basically we were doing a waitForDownload on an empty schema, this causes the local Realm to not upload the local Realm with the default permissions populated from the ObjectStore to Sync which will apply the permissions corrections. (i.e waitForInitialData was useless after at this level.)

This PR, moved waitForInitialData to be performed on the Realm opened with the full schema.

Since this is the next-major I removed the workarounds we had on different old versions 0.8x & 2.x (PK migration, index etc ..)

nhachicha avatar Mar 02 '18 23:03 nhachicha

Isn't it necessary to wait for the initial download with an empty schema in order to support opening synced Realms that the user has read-only access to?

bdash avatar Mar 03 '18 06:03 bdash

Does that mean that if you follow one of those silly tutorials from the internet that tells you to use 0.82.2 then Realm no longer automatically upgrades the Realm to a compatible format from 5.0.0+?

Zhuinden avatar Mar 03 '18 10:03 Zhuinden

@Zhuinden Yes, but most of the bugs where only relevant if you attempted to read a Realm file created by Cocoa, so I doubt it will affect anyone.

cmelchior avatar Mar 05 '18 11:03 cmelchior

Ah, that's super-rare at this point, you are right.

Zhuinden avatar Mar 05 '18 11:03 Zhuinden

This will be revisited once https://github.com/realm/realm-java/issues/5812 is implemented to solve the Readonly use case highlighted in https://github.com/realm/realm-java/pull/5791#issuecomment-370124297

nhachicha avatar Mar 07 '18 12:03 nhachicha

@nhachicha I imagine this can be closed now?

bmunkholm avatar Feb 22 '22 12:02 bmunkholm