teldrive: DB Migration issues: Invalid path error on certain directories & my-drive homepage wouldn't load

Ever since migrating to the PGroonga database along with all its recent changes, i have noticed that atleast 10% of my directories display this error when trying to open them. The size column displays 0B for such directories. All of the other files and directories show up totally fine. Its happening only in certain directories/paths

image

db: groonga/pgroonga:latest-debian-16 (previously on postgres 16 latest image which uses debain by default) teldrive: v1.4.11

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 37 (10 by maintainers)

Most upvoted comments

select * from teldrive.get_file_from_path(‘/test’, tguserid)

Getting this response from SQL - SQL Error [P0001]: ERROR: file not found for path: /Media/Animated Movies/Mortal Kombat Legends Battle of the Realms (2021) [tmdbid-841755] Where: PL/pgSQL function teldrive.get_file_from_path(text,bigint) line 43 at RAISE

Here’s the whole log from teldrive when opening that directory if it helps

2024/07/15 13:30:48 goose: no migrations to run. current version: 20240715001936
15/07/2024 01:30 PM  INFO  Started server http://localhost:8080
15/07/2024 01:32 PM  INFO    {"status": 200, "method": "GET", "path": "/api/files", "query": "page=1&limit=500&order=asc&sort=name&path=%2FMedia%2FAnimated+Movies", "ip": "103.44.106.30", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0", "latency": 0.110719102, "time": "2024-07-15T13:32:59Z"}
15/07/2024 01:33 PM  ERROR  [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: file not found for path: /Media/Animated Movies/Mortal Kombat Legends Battle of the Realms (2021) [tmdbid-841755] (SQLSTATE P0001)
[38.313ms] [rows:-] WITH "ranked_scores" AS (SELECT "name",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY name ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6362481266 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/Media/Animated Movies/Mortal Kombat Legends Battle of the Realms (2021) [tmdbid-841755]', 6362481266))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE name >= (SELECT name FROM ranked_scores WHERE rank = 1) AND (user_id = 6362481266 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/Media/Animated Movies/Mortal Kombat Legends Battle of the Realms (2021) [tmdbid-841755]', 6362481266))) ORDER BY "name" LIMIT 500
15/07/2024 01:33 PM  ERROR  record not found
15/07/2024 01:33 PM  INFO    {"status": 404, "method": "GET", "path": "/api/files", "query": "page=1&limit=500&order=asc&sort=name&path=%2FMedia%2FAnimated+Movies%2FMortal+Kombat+Legends+Battle+of+the+Realms+%282021%29+%5Btmdbid-841755%5D", "ip": "103.44.106.30", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0", "latency": 0.03868104, "time": "2024-07-15T13:33:05Z"}
15/07/2024 01:33 PM  ERROR  [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: file not found for path: /Media/Animated Movies/Mortal Kombat Legends Battle of the Realms (2021) [tmdbid-841755] (SQLSTATE P0001)
[39.331ms] [rows:-] WITH "ranked_scores" AS (SELECT "name",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY name ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6362481266 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/Media/Animated Movies/Mortal Kombat Legends Battle of the Realms (2021) [tmdbid-841755]', 6362481266))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE name >= (SELECT name FROM ranked_scores WHERE rank = 1) AND (user_id = 6362481266 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/Media/Animated Movies/Mortal Kombat Legends Battle of the Realms (2021) [tmdbid-841755]', 6362481266))) ORDER BY "name" LIMIT 500
15/07/2024 01:33 PM  ERROR  record not found

These are not new files/directories but pretty old and their files are still present on the telegram channel, only started happening after the recent update