Skip to content

Build names and links at runtime - no more sqlite#16032

Merged
LK4D4 merged 2 commits intomoby:masterfrom
cpuguy83:remove_sqlite_dep
Jan 11, 2016
Merged

Build names and links at runtime - no more sqlite#16032
LK4D4 merged 2 commits intomoby:masterfrom
cpuguy83:remove_sqlite_dep

Conversation

@cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Sep 2, 2015

This stores all names and link info in memory at runtime rather than relying on sqlite.

Please test thoroughly.
I added some tests, but this is a big change!

Fixes #17691

@cpuguy83
Copy link
Member Author

cpuguy83 commented Sep 3, 2015

phew, these rebases are rough.

@cpuguy83
Copy link
Member Author

cpuguy83 commented Sep 3, 2015

And realizing that hostconfig.Links was being set to nil before, so this information is only in sqlite...

@LK4D4
Copy link
Contributor

LK4D4 commented Sep 3, 2015

−158,972

Copy link
Contributor

Choose a reason for hiding this comment

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

something with formatting

@LK4D4
Copy link
Contributor

LK4D4 commented Sep 3, 2015

Looks cool
windows failures might be related though

@tiborvass
Copy link
Contributor

Wow this is epic. Thanks so much @cpuguy83 !

Is there any undesirable side effect you can think of?

@tianon
Copy link
Member

tianon commented Sep 4, 2015

Maybe an obvious question, but does this mean that links won't survive a daemon restart, or were they still stored on-disk somewhere else besides SQLite?

@cpuguy83
Copy link
Member Author

cpuguy83 commented Sep 4, 2015

Adding some context this from IRC convo:
Yes there is an issue here:
Currently hostConfig.Links is wiped out the first time it is processed.
So the only place links info is stored currently is in the sqlite db... so we can't just remove it here, it will require some migration code to insert links back into containers' hostconfig from sqlite.

@swernli
Copy link
Contributor

swernli commented Sep 4, 2015

Confirmed that this works with Windows containers (both existing images after updating just docker.exe and on a fresh install). Not sure why Windows Jenkins run is failing, but it works fine in manual tests.

LGTM

@icecrime
Copy link
Contributor

icecrime commented Oct 8, 2015

Ping @mavenugo @mrjana: can you please look into this in light of your plans regarding links deprecation (or not)?

@icecrime icecrime added the area/networking Networking label Oct 8, 2015
@thaJeztah
Copy link
Member

ping @mavenugo @mrjana could you have a look at #16032 (comment) now that 1.9 has been release (and you hopefully have a bit more time ❤️)

@calavera
Copy link
Contributor

calavera commented Nov 4, 2015

we cannot remove links from one version to the other.

If we're really going to remove links we should deprecated them in 1.10 to completely remove sqlite3 and the code related in 1.12.

If we're going to keep links as they are, we can make the transition to in-memory links in 1.10, loading from sqlite to memory in that version, and remove the dependency in 1.11.

If we're going to keep links with a different implementation under the hood, we should make sure we remove sqlite from the dependencies.

@cpuguy83
Copy link
Member Author

cpuguy83 commented Nov 4, 2015

@calavera unfortunately we are stuck with sqlite in any case since HostConfig.Links is cleared out once read, currently. So the only place the link info is stored is in sqlite... so basically as long as we want to support upgrading from --> it'll need to stay around.

@thaJeztah
Copy link
Member

@cpuguy83 should we close this for now or is this still an option? I see a discussion around removal of links, which is not yet clear when that'll happen

@cpuguy83
Copy link
Member Author

@thaJeztah The overall goal is still valid, don't use sqlite for storing things on disk which we can build at runtime easily enough.
This should ultimately be much more efficient up to a certain point.

@LK4D4
Copy link
Contributor

LK4D4 commented Nov 14, 2015

@cpuguy83 need rebase
Did you add migration logic?

@cpuguy83
Copy link
Member Author

@LK4D4 Not yet.
Rebased for now, will work on migration.

@cpuguy83 cpuguy83 force-pushed the remove_sqlite_dep branch 3 times, most recently from aeeb1c6 to 5c22bf2 Compare November 21, 2015 14:26
@tiborvass
Copy link
Contributor

LGTM

@LK4D4
Copy link
Contributor

LK4D4 commented Jan 11, 2016

LGTM
let's test this in real world :)

LK4D4 added a commit that referenced this pull request Jan 11, 2016
Build names and links at runtime - no more sqlite
@LK4D4 LK4D4 merged commit 9a23569 into moby:master Jan 11, 2016
@cpuguy83 cpuguy83 deleted the remove_sqlite_dep branch January 11, 2016 19:00
@cpuguy83
Copy link
Member Author

ping @ibuildthecloud aka, demolisher of code, hopes, and dreams.

@thaJeztah
Copy link
Member

Yay, merged! Thanks for being so patient @cpuguy83 🤘

@vincentwoo
Copy link
Contributor

Is this the candidate fix to #17720? If this is on experimental I'm down to see if it'll still lockup on my production boxes.

@cpuguy83
Copy link
Member Author

@vincentwoo This definitely speeds up some pieces of docker ps, and container creation. I'm not sure that it would fix speed reductions over time.

@vincentwoo
Copy link
Contributor

I can give it a run. Is it on https://experimental.docker.com? I have a hard time figuring out what revision that thing is at.

@cpuguy83
Copy link
Member Author

This is in stable.

@vincentwoo
Copy link
Contributor

Right, but there's not binaries out against it yet, right? Slated for 1.10?

@cpuguy83
Copy link
Member Author

@vincentwoo
Copy link
Contributor

Niiiice.

aditirajagopal pushed a commit to aditirajagopal/docker that referenced this pull request Feb 8, 2016
Before moby#16032, once links were setup
in the sqlite db, hostConfig.Links was cleared out.
This means that we need to migrate data back out of the sqlite db and
put it back into hostConfig.Links so that links specified on older
daemons can be used.

Signed-off-by: Brian Goff <[email protected]>
southerngs pushed a commit to southerngs/docker that referenced this pull request Mar 2, 2016
See GitHub issue: moby#17691
for details.

Solution is in: moby#16032

This commit cherry-picks 0f9f995
and applies it to the cr-defunct branch.

Build names and links at runtime

Don't rely on sqlite db for name registration and linking.
Instead register names and links when the daemon starts to an in-memory
store.
@LK4D4 LK4D4 mentioned this pull request Sep 26, 2019
corhere added a commit to corhere/moby that referenced this pull request Dec 12, 2022
(*Daemon).registerLinks() calling the WriteHostConfig() method of its
container argument is a vestigial behaviour. In the distant past,
registerLinks() would persist the container links in an SQLite database
and drop the link config from the container's persisted HostConfig. This
changed in Docker v1.10 (moby#16032) which migrated away from SQLite and
began using the link config in the container's HostConfig as the
persistent source of truth. registerLinks() no longer mutates the
HostConfig at all so persisting the HostConfig to disk falls outside of
its scope of responsibilities.

Signed-off-by: Cory Snider <[email protected]>
corhere added a commit to corhere/moby that referenced this pull request Dec 13, 2022
(*Daemon).registerLinks() calling the WriteHostConfig() method of its
container argument is a vestigial behaviour. In the distant past,
registerLinks() would persist the container links in an SQLite database
and drop the link config from the container's persisted HostConfig. This
changed in Docker v1.10 (moby#16032) which migrated away from SQLite and
began using the link config in the container's HostConfig as the
persistent source of truth. registerLinks() no longer mutates the
HostConfig at all so persisting the HostConfig to disk falls outside of
its scope of responsibilities.

Signed-off-by: Cory Snider <[email protected]>
(cherry picked from commit 388fe4a)
Signed-off-by: Cory Snider <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.