-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Live query and indexing #225
Comments
Thanks for reporting, I'll dive into it asap! |
Thanks, I did some more testing. I was able to catch another error. The setup is the same as above:
This corrupts 'status' index and I see this error message: Lock "./acebase_xxxxxxx3v_2.acebase/items-status.idx" timed out! lock.release() was not called in a timely fashion |
@TELECI-PROJECT I managed to reproduce the issue, looking into it now |
I spent the entire day on this issue, I am pretty sure #226 fixes it! |
Hi, thanks, I don't see any errors anymore. What I noticed is there is an issue with the live query events emission. When index on 'status' is enabled, live query is not emitting 'change' events. It seems 'remove' events are working fine. (I don't use 'add' event). Everything works fine when there is no index on 'status'. |
Are you sure this is not the right behavior? If you have a query with a filter on The fact that you mention in works differently without the index in place does require further investigation on my end though! |
Ok, I will think of the code reproduction soon. It seems I was wrong about remove event. I have two live queries, one is listening to status == 1, the other is listening to status == 2. (events on CHANGE and on REMOVE). Test 1: Test 2: |
Hi, please find information about my tests below: This is the test code was using: I was running it on Nodejs v18.14.0. The database folder was removed for every test. Testing results: TEST 1 There were no events fired by Acebase live query TEST 2 Acebase live query was firing events as expected Conclusion: The following two test scenario won’t work either (meaning the live query won’t emit any events): OR |
Hi! I’m facing the following issue. It seems it is related to live queries and index updates.
I did some testing, my setup was working well when indexing by keys that are not included as parameters in live queries.
As I indexed my data by key/keys included in a live query my node script started
This is my system setup:
acebase-server@1.16.2
acebase-client@1.20.1
acebase@1.28.3
This is what works well:
I have data objects stored in ‘items’ folder, each one has unique ID.
Item/uniqueid/{category: category1, location: location1, status: 1}
Item/uniqueid/{category: category2, location: location1, status: 3}
Item/uniqueid/{..}
Etc.
Then I have two indexes set up:
Index(‘item’, ‘category’);
Index(‘item’, ‘location);
Also, I have a running a live query listening to changes on ‘status’ property (on my app client).
I’m adding new items, then updating them (status is updated) and later some items are removed. Data removal is done periodically (every 10min). All updates are done sequentially.
This is what not working well:
I have the same setup as above:
The difference is: now I have added an index:
Index(‘item’, ‘status);
I still have a running live query listening to changes on ‘status’ property as before (on my app client).
This works well until the data removal script has started to remove items.
Now I see the following error and node script restarts:
/loc1/xxx/xxxx/nodejs/node_modules/acebase-client/dist/cjs/request/index.js:89
reject(new error_1.AceBaseRequestError(request, null, err.code || err.name, err.message));
^
AceBaseRequestError: connect ECONNRESET XXXXXXXXXXXXXXXXXXX:1234
at ClientRequest. (/loc1/xxx/xxxx/nodejs/node_modules/acebase-client/dist/cjs/request/index.js:89:20)
at ClientRequest.emit (node:events:390:28)
at TLSSocket.socketErrorListener (node:_http_client:447:9)
at TLSSocket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
request: {
method: 'PUT',
protocol: 'https:',
host: 'xxxxxxxxx',
port: '1234',
path: '/data/acebase_test/items/1197171',
headers: {
'AceBase-Context': '{"skipProcess":true,"acebase_mutation":{"client_id":"xxxxxxxxx","id":"xxxxxxxxxxxxx","op":"set","path":"items/1197171","flow":"server"}}',
'Content-Type': 'application/json',
'Content-Length': 12,
Authorization: 'Bearer xxxxxxxxxx=='
},
body: undefined
},
response: null,
code: 'ECONNRESET'
}
I don’t see any errors when my data removal script is disabled.
It seems deletion process interferes with the index. The index (on status key) gets corrupted and I have to recreate it. I have tried deleting data items using delete query as well.
The text was updated successfully, but these errors were encountered: