electrs icon indicating copy to clipboard operation
electrs copied to clipboard

Auto-rename of `db_dir/mainnet` to `db_dir/bitcoin`

Open Kixunil opened this issue 4 years ago • 11 comments

Since version 0.9 the mainnet subdir is called bitcoin we need to rename it if auto reindex is specified to fulfill the purpose of auto reindex. The logic in this change keeps the intention of disabled auto reindex causing no changes.

Kixunil avatar Sep 29 '21 11:09 Kixunil

Sorry about failed fmt. I would do it right away but I have to go AFK. I'm not certain I will be able to fix it up today because of unexpected health issues. :(

Kixunil avatar Sep 29 '21 13:09 Kixunil

Hope you get well soon! Unfortunately, I won't be able to test the PR today - I will add a note to the release notes about this issue.

romanz avatar Sep 29 '21 14:09 romanz

Added https://github.com/romanz/electrs/pull/512/commits/8b8ebea0018d3e9a97ce965845b1914df4b4d8a4.

romanz avatar Sep 29 '21 14:09 romanz

Health issue fixed. :)

I decided to make #514 in case this one doesn't make it into 0.9 as that one is just doc change. It will conflict with 8b8ebea but should be very easy to resolve.

Kixunil avatar Sep 29 '21 20:09 Kixunil

I'm not sure if this is a good idea. Data volumes are typically mounted from outside of the container, so it can't simply be renamed from within.

schildbach avatar Oct 05 '21 08:10 schildbach

@schildbach you should mount the top-level directory (the one you supply in configuration), not internal directories. Mounting internal directories is equal to messing with internal structures.

Kixunil avatar Oct 05 '21 08:10 Kixunil

@Kixunil I don't need the "testnet"/"mainnet" directories in my data volumes. I'm running separated containers and separated volumes for different chains already, so I mounted the specific data directories explicitly.

schildbach avatar Oct 05 '21 10:10 schildbach

@schildbach frankly I don't like forcing subdirectories either. It'd be cleaner to just have a single directory and let the user worry about different instances. But given where we're today I don't think this can be changed without major disruption (just look at the spike of issues since 0.9 was released). And even if it was, I'd still prefer having a subdirectory for RocksDb, so that we can have database-independent version file at top-level and handle migrations cleanly (I was seriously considering proposing this change recently.)

If we decide to change you'd be affected with your current setup. Please note that we never documented that the contents of directory is considered stable and we actually currently document the opposite. As much as I can feel your pain, I believe it'd be wise for you to modify your setup to treat the db_dir as opaque.

Kixunil avatar Oct 05 '21 11:10 Kixunil

@Kixunil Thanks for your suggestion. I've just changed my configuration accordingly (still on 0.8.11).

schildbach avatar Oct 05 '21 12:10 schildbach

Shouldn't this be merged soon, so that people can upgrade to 0.9?

schildbach avatar Feb 05 '22 19:02 schildbach

Rebased and refactored to use a separate function.

Kixunil avatar Feb 21 '22 23:02 Kixunil