Add test with graphql and sqlite storage#6786
Add test with graphql and sqlite storage#6786mapineaultvooban wants to merge 1 commit intopubkey:masterfrom
Conversation
this is from commit 9f85889 (rxdb 15.39 -> 16)
|
Hi @mapineaultvooban console.log('in the _attachments assert:');
console.dir(firstRow);Shouldnt this test be green for the memory storage? |
|
Ok fixed this by adding |
|
@mapineaultvooban I ran the exact same test with the SQLite storage and it does not fail. |
|
Hello Daniel, We are running our react-native app with expo using the newest sdk50 and soon 52 which is using now EDIT: I will try to debug the sqlite wrapper on my spare time and find where the |
|
Does it only fail with Expo SQLite or also with other SQLite libs like in node.js? |
|
we upgraded to rxdb v16 and it still happens, but yes, it happens on expo-sqlite v15 using the expo-sqlite async refact, on previous version it was named expo-sqlite/next and the edit : btw on expo, rxdb v16 is crashing even for a memory storage with a database using keyCompression, until you attach to the database creator import * as ExpoCrypto from 'expo-crypto';
await createRxDatabase({
// ...
hashFunction: (input: string) => ExpoCrypto.digestStringAsync(ExpoCrypto.CryptoDigestAlgorithm.SHA256, input)
}); |
|
Are you using the latest expo version? |
libs versiontried to update to v16we tried rxdb v16, and the assumed master state does not update anymore when the server responds with the body when the second push occurs on the same collection, the server will return conflicted entities because the assumedMasterState is not accurate, it was not updated with the payload that this client sent just a minute before. we even try ios which does not use the same native sqlite, we tried the memory storage and even remove all conflict handlers, and this occurs in dev build or production build. we are also using hooks, preSave, preInsert, just to bump the anyway we went back to v15... we will try to open an expo snack example with rxdb 16 classic to show what happen maybe using for the server the retesting the issue on rxdb v15so for the issue on rxdb 15, I tried the ios expo-sqlite version since it uses a different native sqlite (still wrapped with expo-sqlite), and the issue still happens, with or without our conflict handlers, and with or without the hooks (preSave, preInsert). I don't know what to do next for that issue, changing for another sqlite package will require to many changes |
|
Is this a differerent problem? Can you make test case for the replication problem so we can fix that first? |
|
Yes it's a different problem. We tried to upgrade to see if this error was fixed, but we got more issues by upgrading. Right now, we will stay on v15, v15 is working fine if we filter out all rxdb private keys, meta, rev and attachments. So you can close that issue. We will probably work again on it in the summer. We would love to see a LTS version of rxdb in the future. |
|
Ok, closing this. I would still love to fix this for you, but I need a reproduction. |
this is a copy of pull request (#6782). This pull request uses RxDB 16 instead of 15.39. If possible, we would like the fix to be in 15.39.
This PR contains:
A unit test that executes a migration on a database with a sqlite storage. Then a graphql server sends an update with leaked property (assumedMasterState contains the _attachments property). I wrote some comments in the test, because I don't have access to the premium package (RxStorageSQLite) in this repository.
When we use a different storage (e.g in memory or another default storage in the public package), the test passed.
Describe the problem you have without this PR
In our project, we use a RxDatabase with
In one of our schemas, we add a new migration. when executed, it seems that the _attachments property is followed. When a user updates a property in an entity, the graphQL server push the update to our backend, causing an error in the serialization (input -> classes).
Here is a payload of one of our shemas with the problem. In the entity's masterState, we can see that the _attachments property is leaked.
Here is our database setup
Todos