Git Product home page Git Product logo

node-is-master's People

Contributors

bendalton avatar dependabot[bot] avatar markstos avatar matkinson-godaddy avatar mattpker avatar perepechko-alex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-is-master's Issues

startDate column has unique index, but uniqueness is not enforced

There's a unique index on the 'startDate' column, however, nothing enforces the uniqueness. It appears that an expectation that new Date() will always produce unique result. In our case, this is certainly not the case.

Our logs are filling up with about 15 million entries which look like this:

{ [MongoError: insertDocument :: caused by :: 11000 E11000 duplicate key error index: foo-production.nodes.$startDate_1 dup key: { : new Date(1438769951417) }]

(This is across several clusters in several databases, so the indexes and dates involved vary some).

I think there may be an infinite loop bug here:

https://github.com/mattpker/node-is-master/blob/master/is-master.js#L97

There is an attempt to detect the duplicate case and try a new startDate, but it appears to me that the lines below should change the startDate and updatedDate on this.worker, not this.

It appears to be this bug is causing an infinite loop in our system, since the function recurses and tries the same wrong value over and over, logging each time....

I'm looking at a patch in our fork right now.

mongodb document expiry only runs every minute or so

Hi @mattpker ,

Thought you should include somewhere on your readme, some information to explain that mongodb's document expiry only runs every minute or so. As a result, if the master dies, it can take a minute or so for a new master to be promoted. Even longer if based on the default expiry/timeout settings (which I have PR'd to improve hopefully)

I understand this is just a caveat of the approach being used - but it is really important to communicate these so people know before spending too much time investigating for themselves.

Thanks for writing this cool module ๐Ÿ‘

recommend renaming default collection from 'nodes' to 'is-master'

As a default value, the collection name of 'nodes' may conflict with an existing collection due to generic name. Also, the name "node" immediately evokes node.js for a Node developer, which is not related to what the collection contains.

By passing an additional option to Mongoose, we can avoid having the name converted to 'is-masters':

http://stackoverflow.com/questions/22391706/is-there-a-way-to-prevent-mongodb-adding-plural-form-to-collection-names

dup_key error after manually deleting is-master collection in MongoDB

after about 20 minutes or so of the app running ( cluster of 4 via pm2 ), i am getting this error:

{ [MongoError: E11000 duplicate key error index: my_db.forks.$startDate_1 dup key: { : null }]
name: 'MongoError',
message: 'E11000 duplicate key error index: my_db.forks.$startDate_1 dup key: { : null }',
driver: true,
index: 0,
code: 11000,
errmsg: 'E11000 duplicate key error index: my_db.forks.$startDate_1 dup key: { : null }' }

running pm2 v0.15.10 on node v5.0.0 on a linux ec2 box

any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.