Reconnection index transfer

I need to know if a node is already synchronized. as I can know?

I was watching this API call that the result is unexpected.

API call: http://x.x.x.x:8443/rest/db/status=shared.

I have 3 nodes, 1 master, 2 slaves.

Master:

{“globalBytes”:982578590,“globalDeleted”:1020,“globalFiles”:20,“ignorePatterns”:false,“inSyncBytes”:982578590,“inSyncFiles”:20,“invalid”:"",“localBytes”:982449438,“localDeleted”:11,“localFiles”:20,“needBytes”:0,“needFiles”:0,“state”:“idle”,“stateChanged”:“2015-08-05T12:18:32.94997942+02:00”,“version”:2281}

Slave 1:

{“globalBytes”:982449438,“globalDeleted”:11,“globalFiles”:20,“ignorePatterns”:false,“inSyncBytes”:982449438,“inSyncFiles”:20,“invalid”:"",“localBytes”:982448030,“localDeleted”:0,“localFiles”:20,“needBytes”:0,“needFiles”:0,“state”:“idle”,“stateChanged”:“2015-08-05T12:18:25.116285298+02:00”,“version”:123}

Slave 2:

{“globalBytes”:982578590,“globalDeleted”:1020,“globalFiles”:20,“ignorePatterns”:false,“inSyncBytes”:982578590,“inSyncFiles”:20,“invalid”:"",“localBytes”:982578334,“localDeleted”:1018,“localFiles”:20,“needBytes”:0,“needFiles”:0,“state”:“idle”,“stateChanged”:“2015-08-05T12:17:45.265030821+02:00”,“version”:2240}

how I can know if a node is synchronized in consultation API?

Thanks!

In sync only has meaning while you are connected. If you are disconnected from everyone you don’t know their state, hence nothing to compare against - hence in sync. When you are connected to somone, needBytes says how many bytes are still needed to catch up with the newest state. If 0, you are in sync. Also, these values are periodically recalculated, rather than when the call is made, so might be a bit stale.

You know why the number of version is different in all nodes?

The local version number is local, i.e. generated by each side on the fly. There’s nothing to say they should be the same.

You can know that a device is in sync by looking at the needBytes, needFiles etc fields. If those are zero, you are in sync.

you know if needBytes is update in reconnection before to transfer index?

needBytes gets updated once we receive an index from a remote device, but can br delayed by 2 seconds.