Why data is rebuild during node restart


When a es node (es 0.90.7) restart, the restarted node will rebuild shards using peers replica. Is the rebuild from size 0byte until it is balance with other peers? Why is this done so? is it because of the stale data even within few second restart?

Another question is, considering full cluster restart during upgrade. What's gonna happen to the data in the cluster? Will the cluster think all the data are stale and wipe all the data in this situation?

Thank you.

Older versions of ES weren't as smart they could have been with recovery, so they will retrieve the entire shard dataset from the current primary.
If you restart the entire cluster then you just have to wait through recovery, data won't be deleted by ES.

That's a pretty old version by the way, you should really upgrade!

do you have reference (book or code) for this? would definitely be very helpful.

did that before, but too many exceptions. it's a pity nonetheless.