Skip to content

build: create distinct history db for each store#48565

Merged
thaJeztah merged 1 commit intomoby:masterfrom
crazy-max:build-split-history-db
Oct 17, 2024
Merged

build: create distinct history db for each store#48565
thaJeztah merged 1 commit intomoby:masterfrom
crazy-max:build-split-history-db

Conversation

@crazy-max
Copy link
Copy Markdown
Member

@crazy-max crazy-max commented Oct 1, 2024

- What I did

Update build controller logic so it's using a distinct db for each type of store:

  • history.db for graphdriver
  • history_c8d.db for containerd snapshotter

As follow-up in BuildKit we should prune records that have missing blobs.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@crazy-max crazy-max marked this pull request as ready for review October 1, 2024 13:09
@crazy-max crazy-max requested a review from tonistiigi as a code owner October 1, 2024 13:09
Copy link
Copy Markdown
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should do this migration. Nothing else is doing the migration. For switching to the containerd storage, migrating images and layers should be the priority, not build history records or even build cache. As that can be easily recreated.

@crazy-max
Copy link
Copy Markdown
Member Author

I don't think we should do this migration. Nothing else is doing the migration. For switching to the containerd storage, migrating images and layers should be the priority, not build history records or even build cache. As that can be easily recreated.

What should we do for people that have unreachable build records that can't be opened or removed? Should this be part of history API GC instead?

@tonistiigi
Copy link
Copy Markdown
Member

Should this be part of history API GC instead?

GC may remove records that have missing blobs indeed.

What should we do for people that have unreachable build records that can't be opened or removed?

This is only issue with people switching from containerd storage to graphdriver storage, what should not really happen. Containerd storage is experimental, weird things may happen.

@crazy-max crazy-max force-pushed the build-split-history-db branch 2 times, most recently from dee11af to 5f7c398 Compare October 1, 2024 15:07
@crazy-max
Copy link
Copy Markdown
Member Author

Updated to just split history db, will do the follow-up in BuildKit to prune erroneous records.

@crazy-max crazy-max force-pushed the build-split-history-db branch from 5f7c398 to ee23b04 Compare October 2, 2024 13:46
@thaJeztah thaJeztah added area/builder Build containerd-integration Issues and PRs related to containerd integration labels Oct 2, 2024
@thaJeztah thaJeztah added this to the 28.0.0 milestone Oct 3, 2024
Comment thread builder/builder-next/controller.go Outdated
}

historyDB, historyConf, err := openHistoryDB(opt.Root, opt.BuilderConfig.History)
historyDB, historyConf, err := openHistoryDB(opt.Root, "history_ctd.db", opt.BuilderConfig.History)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight nit; I think we more commonly use c8d as short form for containerd (isnteead of ctd)

Does the cache.db below also depend on which backend is used? I'm wondering if the alternative would be to pass a different opt.Root when initialising? Looks like we hard-code root to be /buildkit (which probably is fine), but perhaps it could use a subdirectory based on what driver is used?

Root: filepath.Join(config.Root, "buildkit"),

Perhaps even buildkit/<snapshotterName> (of this information is tied to the snapshotter used)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight nit; I think we more commonly use c8d as short form for containerd (isnteead of ctd)

Sure! Better to be consistent.

Does the cache.db below also depend on which backend is used? I'm wondering if the alternative would be to pass a different opt.Root when initialising? Looks like we hard-code root to be /buildkit (which probably is fine), but perhaps it could use a subdirectory based on what driver is used?

For cache blobs this is not needed afaik (cc @tonistiigi)

@crazy-max crazy-max force-pushed the build-split-history-db branch from ee23b04 to d497c21 Compare October 4, 2024 11:29
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

4 participants