Skip to content

Disable stats importation when the trackers starts #1510

Closed

Description

@josecelano

I was working on this issue:

And one of the problems is that the downloads counter (for all torrents) is not initialised with the latest value when the tracker starts. The current way to keep the counter is to load from the database the number of downloads per torrent. It was implemented only when the torrent is added to the tracker but not when the tracker starts. This gives you a wrong general counter because inactive torrent downloads are not counted. I changed the code to fix it in this PR:

But after deploying the patch to the demo tracker, the server could not start (unhealthy tracker container).

The reason was that there are 1.893.901.614 torrents!!! in the demo tracker. The database is 17G:

ls -alh storage/tracker/lib/database/sqlite3.db
-rwxrwx--- 1 torrust torrust 17G May  8 17:53 storage/tracker/lib/database/sqlite3.db

That was probably the reason why the function to import torrents from the database (pub fn import_persistent(&self, persistent_torrents: &PersistentTorrents)) was not being used. Maybe it was disabled at some point because we realised it was not feasible with many torrents. However, when it was disabled, we didn't realise that it affected the downloads counter when the tracker is restarted.

I will disable it. Anyway, I was planning to implement an alternative solution here. The alternative solution does not work either because we have to run a query to sum up torrents, which will probably be costly. I guess we need to store directly the global counter (persistent metric). I will think of a new solution and update that issue.

cc @da2ce7

Activity

  1. self-assigned this
    on May 9, 2025
  2. added
    Bug
    on May 9, 2025
  3. added 2 commits that reference this issue on May 9, 2025
  4. linked a pull request that will close this issueDisable torrent stats importation at start #1511on May 9, 2025
  5. added a commit that references this issue on May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions