Different session count: API vs DB records
Home › Forums › Conduit: AEP Model › Different session count: API vs DB records
- This topic has 7 replies, 2 voices, and was last updated 5 years, 8 months ago by
Yordan Georgiev.
-
AuthorPosts
-
July 29, 2019 at 7:30 am #28271
Yordan Georgiev
ParticipantMy hardware: Conduit AEP with fw 1.6.4
My goal:
I need to fetch all(or some) sessions from gateway “x” and move them to gateway “y” (improving end nodes reception). I have it working now and it looks great but here’s my problem:
Difference between the number of sessions in lora-network-server.db and the number of sessions i get from API (~800 vs ~120).
Also while fetching the sessions from API i can see the sessions number to change in time, what’s the fetch criteria?
So when i want to move particular session for given deveui sometimes i can’t fetch it from API even the device and its session exists in db.
Is there any way i can fetch all sessions from db via api and/or fetch particular session for given dev eui. (i already double checked the docs and i can’t find solution)Thank you for your quick response, Yordan.
-
This topic was modified 5 years, 8 months ago by
Yordan Georgiev.
-
This topic was modified 5 years, 8 months ago by
Yordan Georgiev.
-
This topic was modified 5 years, 8 months ago by
Yordan Georgiev.
-
This topic was modified 5 years, 8 months ago by
Yordan Georgiev.
July 29, 2019 at 7:43 am #28276Jason Reiss
KeymasterThe network server manages the database in /var/run/lora/ directory in RAM. It is backed up periodically to flash in /var/config/lora/ directory.
To force a backup to flash
$ lora-query -x database backupNow the /var/config/lora/lora-network-server.db file will be in sync.
Move the file to another conduit.$ /etc/init.d/lora-network-server stop
$ cp lora-network-server.db /var/config/lora/lora-network-server.db
$ /etc/init.d/lora-network-server startList all session
$ lora-query -x sessions list jsonSee available options
$ lora-query -x helpJuly 29, 2019 at 7:58 am #28277Yordan Georgiev
ParticipantYep i’m aware of the backup flow, and i know it stashes the RAM changes in flash (1h basis by default) but still after couple of hours (so it’s couple of syncs) the session count is different and there’s no way for me to fetch the full list of sessions via API. Even after soft restart (when the backup will be forced to be applied). Also lora-query is not my preferred way of doing it because it’s an automation tool which will move the sessions (i want to avoid programmatically ssh to Conduit).
Also i don’t want to move the whole db from gateway 1 to gateway 2, i only need to move specific deveui(s) so scp or cp-ing the db to different location is not an option. After i successfully move the session + device i remove the device from source gateway.
I also believe that fetching the full list of sessions is overkill and when we have huge collection of sessions we might cross some response length limitations. So is there API query option by field or at least filtering the sessions by deveui so i can properly target the sessions i’m interested in?Any ideas will be appreciated.
-
This reply was modified 5 years, 8 months ago by
Yordan Georgiev.
July 29, 2019 at 8:49 am #28279Yordan Georgiev
ParticipantActually @Jason you’re right i just checked table “sessions” from /var/config/lora/lora-network-server.db and /var/run/lora/lora-network-server.db and they are identical currently having 496 sessions each, the thing is that when i check /api/lora/sessions i got as result array with 373 items (the last one is null) i guess the list is truncated because of some sort of limitation as you can see here.
July 29, 2019 at 8:59 am #28280Jason Reiss
KeymasterDo you get the full list if you use lora-query directly or is it truncated the same as the API?
The API will call lora-query in the background.
I wonder if there is a difference in the next session record that may cause the JSON to stop the list or if there is a timeout.
July 29, 2019 at 9:06 am #28281Yordan Georgiev
ParticipantWeird, we have 470 sessions fetched from lora-query.I inspected the session for which we have null from API and i can’t see any difference as structure, also the values seem valid. So nothing tells me that it’s parsing error.
I hope this helps identifying the issue.-
This reply was modified 5 years, 8 months ago by
Yordan Georgiev.
-
This reply was modified 5 years, 8 months ago by
Yordan Georgiev.
-
This reply was modified 5 years, 8 months ago by
Yordan Georgiev.
-
This reply was modified 5 years, 8 months ago by
Yordan Georgiev.
July 29, 2019 at 9:38 am #28284Yordan Georgiev
ParticipantOh wait one more thing to clarify, in both stashed and in memory db we have 496 sessions, but issuing lora-query i got 470 sessions fetched, and from API 372 valid + last one NULL. So now i’m more confused even before opening the topic.
July 30, 2019 at 1:55 am #28287Yordan Georgiev
Participant@Jason please let me know if you find the root of the problems. Meanwhile i’ll implement ssh -> lora-query.
Thank you in advance. -
This topic was modified 5 years, 8 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.