MB-18594 Avoid duplicate items during WAL flushing
MB-18594 Avoid duplicate items during WAL flushing

- get_old_offset() may return same 'old_offset' value on different
keys; this is because hbtrie_find_offset() (which is internally
called by get_old_offset()) does not compare entire key string but
just prefix only, due to performance issue.

- As a result, aforementioned case (keys are different but both
'old_offset' and 'offset' are same) very rarely happens so that
different items are duplicate, and causes crash.

- To avoid this issue, we need to additionally compare sequence
numbers so as to distinguish those two different items.

Change-Id: I697f12422c70c60d292cbfe765f9e06b7c02b0e2
Reviewed-on: http://review.couchbase.org/61771
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Chiyoung Seo <fcffc23db27b19ee4ebba46695ee6b50e09216a2@couchbase.com>

couchbase/forestdb,couchbase/forestdb,wurikiji/forestdb,hisundar/forestdb,wurikiji/forestdb,hisundar/forestdb