Skip to content
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

exits with "no such table" #64

Closed
HarHarLinks opened this issue Feb 25, 2023 · 5 comments
Closed

exits with "no such table" #64

HarHarLinks opened this issue Feb 25, 2023 · 5 comments

Comments

@HarHarLinks
Copy link
Contributor

i'm running with docker compose.

tonight at the scheduled prefetch time, pacoloco exited with code 1.

this is the end of the log:

pacoloco  | prefetch.go:255: Starting prefetching routine...
pacoloco  | prefetch.go:182: Cleaning the db...
pacoloco  | prefetch.go:217: Db cleaned.
pacoloco  | prefetch.go:261: Starting prefetching packages...
pacoloco  | prefetch_db.go:196: no such table: mirror_packages
@Focshole
Copy link
Contributor

What did your pacoloco.yaml contain? I cannot figure out what happened otherwise.
I'd guess it was due to a prefetch routine with no previous packages requests ever but I don't know. Maybe that issue is due to the fact that the db had not been created this far.

@HarHarLinks
Copy link
Contributor Author

pacoloco.yaml:

port: 9129
cache_dir: /var/cache/pacoloco
purge_files_after: 360000 # 360000 seconds or 100 hours, 0 to disable
download_timeout: 3600 # download will timeout after 3600 seconds
repos:
  archlinux:
    urls:
      - [snip]
      - http://mirrors.kernel.org/archlinux
  quarry:
    url: http://pkgbuild.com/~anatolik/quarry/x86_64
  sublime:
    url: https://download.sublimetext.com/arch/stable/x86_64
  herecura:
    url: https://repo.herecura.eu/herecura/x86_64
#  archlinux-reflector:
#    mirrorlist: /etc/pacman.d/reflector_mirrorlist # Be careful! Check that pacoloco URL is NOT included in that file!
# http_proxy: http://foo.company.com:8989
user_agent: Pacoloco/1.2
prefetch: # optional section, add it if you want to enable prefetching
  cron: 0 0 3 * * * * # standard cron expression (https://en.wikipedia.org/wiki/Cron#CRON_expression) to define how frequently prefetch, see https://github.com/gorhill/cronexpr#implementation for documentation.
  ttl_unaccessed_in_days: 30  # defaults to 30, set it to a higher value than the number of consecutive days you don't update your systems
  # It deletes and stop prefetch packages(and db links) when not downloaded after ttl_unaccessed_in_days days that it had been updated.
  ttl_unupdated_in_days: 300 # defaults to 300, it deletes and stop prefetch packages which hadn't been either updated upstream or requested for ttl_unupdated_in_days.

cache/sqlite-pkg-cache.db:

sqlite> .schema
CREATE TABLE `packages` (`package_name` text NOT NULL,`version` text NOT NULL,`arch` text NOT NULL,`repo_name` text NOT NULL,`last_time_downloaded` datetime NOT NULL,`last_time_repo_updated` datetime NOT NULL,PRIMARY KEY (`package_name`,`arch`,`repo_name`));
CREATE TABLE `mirror_dbs` (`url` text NOT NULL,`repo_name` text NOT NULL,`last_time_downloaded` datetime NOT NULL,PRIMARY KEY (`url`,`repo_name`));

I did previously update once through pacoloco successfully, some files exist in cache/pkgs.

@Focshole
Copy link
Contributor

Ok, I see what happened. The prefetching routine got invoked with no saved mirrors. Could you please check that you had no entries in mirror_dbs?

Focshole added a commit to Focshole/pacoloco that referenced this issue Feb 25, 2023
@Focshole
Copy link
Contributor

Ok, it is probably ok to fail in this situation, it shouldn't do a fatal failure. Updated to do a soft failure (aka, just end the prefetching).

@HarHarLinks
Copy link
Contributor Author

HarHarLinks commented Feb 25, 2023

Ok, I see what happened. The prefetching routine got invoked with no saved mirrors. Could you please check that you had no entries in mirror_dbs?

it's currently not empty:

sqlite> select * from mirror_dbs;
/repo/herecura/herecura.db|herecura|2023-02-25 17:24:14.52841227+01:00
/repo/archlinux/core/os/x86_64/core.db|archlinux|2023-02-25 17:29:38.402540223+01:00
/repo/archlinux/multilib/os/x86_64/multilib.db|archlinux|2023-02-25 17:29:38.422815185+01:00
/repo/archlinux/extra/os/x86_64/extra.db|archlinux|2023-02-25 17:29:38.482848738+01:00
/repo/archlinux/community/os/x86_64/community.db|archlinux|2023-02-25 17:29:38.591550906+01:00

i set the prefetch cron to just now to test with your branch plus #66 and it succeeded.

I'll reopen should I notice it failing again.

Focshole added a commit to Focshole/pacoloco that referenced this issue Feb 25, 2023
anatol pushed a commit to Focshole/pacoloco that referenced this issue Mar 9, 2023
Do not throw fatal error on failed prefetch. It may happen in a very early setup
if prefetch is called with no packages upstream and it should be ok.

Fixes anatol#64
anatol pushed a commit that referenced this issue Mar 9, 2023
Do not throw fatal error on failed prefetch. It may happen in a very early setup
if prefetch is called with no packages upstream and it should be ok.

Fixes #64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants