# The MVCC merge operator is non-transactional and stores data in the
# intent, so that subsequent reads diregard the MVCC values stored on
# the same key.
#
# This is a very unique feature and is currently only used in CockroachDB's
# built-in timeseries database.

run ok
with t=A
  txn_begin  ts=11
  put        k=a v=abc resolve
  txn_remove
----
put: lock acquisition = {a id=00000001 key=/Min iso=Serializable pri=0.00000000 epo=0 ts=11.000000000,0 min=0,0 seq=0 Replicated Intent []}
resolve_intent: "a" -> resolved key = true
>> at end:
data: "a"/11.000000000,0 -> /BYTES/abc

# Merge appends data in the intent and ignores the regular k/v pairs.

run trace ok
merge k=a v=def ts=22
merge k=a v=ghi ts=22
----
>> merge k=a v=def ts=22
meta: "a"/0,0 -> txn={<nil>} ts=0,0 del=false klen=0 vlen=0 raw=/BYTES/def mergeTs=<nil> txnDidNotUpdateMeta=false
data: "a"/11.000000000,0 -> /BYTES/abc
>> merge k=a v=ghi ts=22
meta: "a"/0,0 -> txn={<nil>} ts=0,0 del=false klen=0 vlen=0 raw=/BYTES/defghi mergeTs=<nil> txnDidNotUpdateMeta=false
data: "a"/11.000000000,0 -> /BYTES/abc

# After a merge, only the data in the intent is every used.

run ok
with t=A
  txn_begin ts=33
  get k=a
----
get: "a" -> /BYTES/defghi @0,0
>> at end:
txn: "A" meta={id=00000002 key=/Min iso=Serializable pri=0.00000000 epo=0 ts=33.000000000,0 min=0,0 seq=0} lock=true stat=PENDING rts=33.000000000,0 wto=false gul=0,0
