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

Support renaming a database #1502

Open
wohali opened this issue Aug 7, 2018 · 2 comments
Open

Support renaming a database #1502

wohali opened this issue Aug 7, 2018 · 2 comments

Comments

@wohali
Copy link
Member

wohali commented Aug 7, 2018

@davisp:

Distributed systems makes renaming things hard since the dbs db is eventually consistent. For a stop gap, a tool to do the rename offline (ie, stop all nodes in the cluster) could probably be done easily enough.

@janl:

good call, I thought that was going to a be a thing. First reaction was maybe _dbs docs allow for an alias that all nodes can converge towards, dunno if that actually works tho

@davisp:

Also, some of the obvious changes we could make here to do this in an eventually consistent fashion:

  1. Replace the dbname -> shard file name mapping, ie, when we create a database document it stores a UUID that we reference on disk.
  2. Similar to UUID but the "rename" or "alias" doc just lists the original filenames on disk

The downsides to these approaches is that there's currently a large amount of operator knowledge based on the fact that database names map to file system locations. If we break that mapping then we'll have to work on tooling for anyone operating a CouchDB cluster.

Also, with alias docs we'd end up having a single database available under two different names without some other sort of voodoo. So that might be something to think about (though it seems fine on the face of it, just maybe surprising to customers in corner cases).

@wohali:

There actually was a request for DB name aliases 5 years ago in the 2012 summit - so that is very on topic @davisp.

Also, this would help with things like adjusting a db's q (replicate to a new db then change the alias when it's ready). It occurs to me that this would help with compaction, too?

@wohali wohali added this to In Discussion in Roadmap Aug 7, 2018
@wohali wohali moved this from Proposed for 3.x to Proposed for 4.x+ in Roadmap Jul 11, 2019
@kocolosk
Copy link
Member

Noting that this one becomes much easier in 4.0. We are already aliasing the DB name to a short key prefix, so renaming a database only requires a (transactional) update of a single KV.

@davisp
Copy link
Member

davisp commented Dec 18, 2019

Also gotta bump the db version key so we invalidate all of the cached db handles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Roadmap
  
Proposed for 4.x+
Development

No branches or pull requests

3 participants