Are these conflicted documents frequent?
In one instance there were 20 conflicts out of 5,618 total telemetry docs (so about 0.36%).
In another there were 328 conflicts out of 27,475 total telemetry docs (so about 1.2%).
completely different data for the corresponding “non-conflicted” doc?
I’ve seen a mix. For the one with 20 conflicts, 10 of the conflicted documents had a corresponding document that had the exact same data for metrics, dbInfo, and device. The other 10 had some of those properties the same and some different.
Created Seconds before? Milliseconds before?
Telemetry docs don’t have a timestamp property. For the docs that are conflicted, the UUID has the UNIX epoch time on the end, but since the non-conflicted doc doesn’t have a timestamp, I can’t tell how close together they were.
Here’s the SQL I’m using just FYI:
SELECT
doc#>>'{metadata,user}' AS t_user,
(doc#>>'{metadata,year}')::int AS year,
(doc#>>'{metadata,month}')::int AS month,
doc#>>'{metadata,deviceId}' AS device_id,
COUNT(*) AS count_telemetry_docs,
COUNT(DISTINCT(doc#>>'{metrics}')) AS count_distinct_metrics,
COUNT(DISTINCT(doc#>>'{dbInfo}')) AS count_distinct_dbinfo,
COUNT(DISTINCT(doc#>>'{device}')) AS count_distinct_device
FROM
couchdb_users_meta
WHERE
doc->>'type' = 'telemetry'
GROUP BY
t_user,
year,
month,
device_id
ORDER BY
count_telemetry_docs DESC,
count_distinct_metrics DESC,
count_distinct_dbinfo DESC,
count_distinct_device DESC