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

Added replicaset name to bigchaindb config #1063

Merged
merged 10 commits into from Jan 20, 2017

Conversation

r-marques
Copy link
Contributor

@r-marques r-marques commented Jan 18, 2017

resolves #1056

This pr adds replicaset to bigchaindb.config.
Also updated the mongodb connection initialization to connect to a replica set, and moved the initialize_replica_set into mongodb.connection. The reason for this is that the replicaset needs to be initialized before we even try to setup a MongoDBConnection

@codecov-io
Copy link

codecov-io commented Jan 18, 2017

Current coverage is 96.76% (diff: 100%)

Merging #1063 into master will increase coverage by <.01%

@@             master      #1063   diff @@
==========================================
  Files            48         48          
  Lines          2128       2132     +4   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           2059       2063     +4   
  Misses           69         69          
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 8e49734...8c9c4d8

It now initializes the replica set with the name provided by the
bigchaindb config file.

Fixed tests.
This way we are sure that a replica set exists when we return a
connection.
@r-marques r-marques requested a review from sohkai January 19, 2017 13:48
port=bigchaindb.config['database']['port'])
_check_replica_set(conn)
config = {'_id': bigchaindb.config['database']['replicaset'],
'members': [{'_id': 0, 'host': 'localhost:27017'}]}
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder: should we get the host and port from the config, for cases where the host and port differ from defaults?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

while True:
logs = conn.admin.command('getLog', 'rs')['log']
if any('database writes are now permitted' in line for line in logs):
return
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation is one tab off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

copypasta failed

initialize_replica_set()
self.connection = MongoClient(self.host, self.port,
replicaset=self.replicaset)
except errors.ConnectionFailure as exc:
Copy link
Contributor

Choose a reason for hiding this comment

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

we can discard the exc as it is not used

Copy link
Contributor

@vrde vrde left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@r-marques r-marques requested review from ttmc and removed request for sohkai January 20, 2017 10:26
Copy link
Contributor

@ttmc ttmc left a comment

Choose a reason for hiding this comment

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

I only looked at the docs changes and they look okay to me.

@r-marques r-marques merged commit e7ffcf5 into master Jan 20, 2017
@vrde vrde deleted the feat/1056/add-replica-name-config branch March 21, 2018 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle replica set name in bigchaindb configuration
5 participants