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
@calavera
Copy link
Contributor

calavera commented Jan 8, 2016

I might be wrong but, the graceful downgrade is guaranteed unless we remove linkgraph.db. Obviously, if people add new containers to 1.10 and then downgrade those names will be lost. But old container names will be preserved in the database as long as the database file exists. That's guarantee enough for me.

@cpuguy83
Copy link
Member Author

cpuguy83 commented Jan 8, 2016

That's fine, I updated to make it not remove the db.

@cpuguy83
Copy link
Member Author

cpuguy83 commented Jan 8, 2016

All green

daemon/daemon.go Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

@cpuguy83 couldn't we do the container.HostConfig == nil || container.HostConfig.Links != nil check in the containers loop above to detect if legacyLinkDB should be set at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep!

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 <cpuguy83@gmail.com>
@tiborvass
Copy link
Contributor

LGTM

@LK4D4
Copy link
Contributor

LK4D4 commented Jan 11, 2016

LGTM
let's test this in real world :)

@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.

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.