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

Create shard files if missing #1591

Merged
merged 1 commit into from Aug 30, 2018

Conversation

Projects
None yet
1 participant
@rnewson
Member

rnewson commented Aug 30, 2018

Overview

If, when a database is created, it was not possible to create any of
the shard files, the database cannot be used. All requests return a
"No DB shards could be opened." error.

This commit changes fabric_util:get_db/2 to create the shard file if
missing. This is correct as that function has already called
mem3:shards(DbName) which only returns shards if the database exists.

Testing recommendations

It's tricky. You need to have max_dbs_open's worth of files open on all nodes when creating the database. This ensures the _dbs doc is created (as this db is opened at startup and stays open) but none of the shards.

The easiest test is as follows;

  1. Create the db
  2. stop couchdb (all nodes)
  3. delete the .couch files under the 'shards' directory
  4. start couchdb
  5. try to do anything with the database, get "No DB shards could be opened" error.

retry with the patch and step 5 is successful (and the shard files appear on disk).

Related Issues or Pull Requests

N/A

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;
Create shard files if missing
If, when a database is created, it was not possible to create any of
the shard files, the database cannot be used. All requests return a
"No DB shards could be opened." error.

This commit changes fabric_util:get_db/2 to create the shard file if
missing. This is correct as that function has already called
mem3:shards(DbName) which only returns shards if the database exists.

@rnewson rnewson merged commit 32ff5f7 into master Aug 30, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@rnewson rnewson deleted the create-shards-if-missing branch Aug 30, 2018

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