Different session count: API vs DB records

Home Forums Conduit: AEP Model Different session count: API vs DB records

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #28271
    Yordan Georgiev
    Participant

    My 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.

    #28276
    Jason Reiss
    Keymaster

    The 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 backup

    Now 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 start

    List all session
    $ lora-query -x sessions list json

    See available options
    $ lora-query -x help

    #28277
    Yordan Georgiev
    Participant

    Yep 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.

    #28279
    Yordan Georgiev
    Participant

    Actually @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.

    #28280
    Jason Reiss
    Keymaster

    Do 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.

    #28281
    Yordan Georgiev
    Participant

    Weird, 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.

    #28284
    Yordan Georgiev
    Participant

    Oh 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.

    #28287
    Yordan 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.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.