Ensure that restored map's balanced before adding to history.
Ensure that restored map's balanced before adding to history.

Seen in MB-5230.

Change-Id: I383006d0a43554fae418c0917c28a14af463676d
Reviewed-on: http://review.couchbase.org/15651
Reviewed-by: Aliaksey Kandratsenka <340b8e09ca65cd3fc686427fcfed17e87eaf61e2@gmail.com>
Tested-by: Aliaksey Kandratsenka <340b8e09ca65cd3fc686427fcfed17e87eaf61e2@gmail.com>

t3rm1n4l/ns_server,t3rm1n4l/ns_server,ceejatec/ns_server,vzasade/ns_server,nimishzynga/ns_server,membase/ns_server,vzasade/ns_server,ceejatec/ns_server,nimishzynga/ns_server,daverigby/ns_server,t3rm1n4l/ns_server,pavel-blagodov/ns_server,mschoch/ns_server,pavel-blagodov/ns_server,nimishzynga/ns_server,mschoch/ns_server,ceejatec/ns_server,daverigby/ns_server,vzasade/ns_server,membase/ns_server,ceejatec/ns_server,pavel-blagodov/ns_server,mschoch/ns_server,mschoch/ns_server,nimishzynga/ns_server,vzasade/ns_server,membase/ns_server,nimishzynga/ns_server,daverigby/ns_server,membase/ns_server,mschoch/ns_server,daverigby/ns_server,t3rm1n4l/ns_server,pavel-blagodov/ns_server,membase/ns_server,mschoch/ns_server,t3rm1n4l/ns_server,membase/ns_server,ceejatec/ns_server,daverigby/ns_server,nimishzynga/ns_server,ceejatec/ns_server