Closed yuhanz closed 8 years ago
This project is dead, the active fork is at https://github.com/chef-brigade/mongodb-cookbook where you can get this PR merged.
Also, please use a stable url for the link to the mongodb server code in your commit message: https://github.com/mongodb/mongo/blob/r3.2.0/src/mongo/db/repl/member_config.cpp#L225
Thanks.
I copied this patch to chef-brigade/mongodb-cookbook and created another pull request at: https://github.com/chef-brigade/mongodb-cookbook/pull/101
I encountered this problem of having _id > 255 where mongodb considers it as invalid _id. The current recipe will get max_id += 1, which leads _id to grows to the top value.
The validation logic is here: https://github.com/mongodb/mongo/blob/master/src/mongo/db/repl/member_config.cpp#L225
To fix the problem, instead of using max_id +=1, we pick a value between [0,255] for _id, excluding the _id's have existed in the member configs.