MB-7828 Don't attempt to copy purged docs list

We don't have a purged docs list (but we have started using the old
purge_seq field), and some old code has broken. Removing it.

Change-Id: I1b376920db2acddac595acbab0adb762fd22de44
Reviewed-on: http://review.couchbase.org/24885
Tested-by: abhinav dangeti <abhinav.dangeti@gmail.com>
Reviewed-by: Damien Katz <damien@couchbase.com>
MB-7813 Allow replicas on transfer to be unindexable

Previosuly it was not possible to move to the unindexable state
partitions that are replicas being transferred into the main
index (marked as passive). This change now allows it, as from
an external point of view, once a replica is requested to become
active, it's seen like a regular active partition - the details
of transferring a replica are meant to be known only internally,
abstracted from callers.

Change-Id: Ife72afe0e6827427a23b4bf48fe2eb6a48481758
Reviewed-on: http://review.couchbase.org/24946
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Merge remote-tracking branch 'origin/2.0.1' into 2.0.2

* origin/2.0.1:
  MB-7828 Don't attempt to copy purged docs list

Change-Id: If7cf5e471e744a2e7fd9d8f7789b5796fe45bb1c
MB-7467: added mapreduce test of context usability after timeout

Change-Id: I977b997e70c1b052ee939ca81317094e9b58769c
Reviewed-on: http://review.couchbase.org/23584
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-on: http://review.couchbase.org/24950
MB-7467: use un-lock-ful javascript task termination

I've found that V8's own preemption is not really effective. When we
wanted to terminate mapreduce task we needed to grab isolate
lock. Thus we depended not only on v8's preemption (which I've
confirmed via source code) periodically unlocks isolate and does
sched_yield, but also on somewhat fair mutex locking.

What I've observed in practice is that sched_yield was apparently not
enough to give terminateTask thread chance to grab isolate lock in
time.

Luckily for us, V8 has terminate API that doesn't require locking
isolate and using it doesn't depend on preemption at all.

Because we don't need taskId anymore I've removed this field. And
because we don't need preemption anymore (which is costly to setup
(i.e. spawns thread)), I've removed it too.

Change-Id: I1e194211c477c5fa1ef78d07e1a3cc05b06fa24e
Reviewed-on: http://review.couchbase.org/23580
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Reviewed-on: http://review.couchbase.org/24951
MB-7453: use time() for long running mapreduce task termination

I.e. because previous implementation used clock which is defined to
reflect CPU time of all process threads.

It should give us more precise long running task termination.

Change-Id: I8ab51cd94a769329be212d24dda6f275287751fe
Reviewed-on: http://review.couchbase.org/23582
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-on: http://review.couchbase.org/24952
MB-7467 Reset task start time after being interrupted

So that there's no re-attempt to terminate an idle isolate
if the same mapreduce context is not re-used within the
next termination period.

Change-Id: Ia9f2a3b3e17cb8abdc055913192ae450a21fd881
Reviewed-on: http://review.couchbase.org/24953
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Merge remote-tracking branch 'origin/2.0.2'

* origin/2.0.2:
  MB-7467 Reset task start time after being interrupted
  MB-7453: use time() for long running mapreduce task termination
  MB-7467: use un-lock-ful javascript task termination
  MB-7467: added mapreduce test of context usability after timeout
  MB-7813 Allow replicas on transfer to be unindexable
  MB-7828 Don't attempt to copy purged docs list

Conflicts:
	src/mapreduce/mapreduce.cc

Change-Id: Iea980c41ea8c350778b2435bdbf6a6af059c2962