<blockquote>
<p>That's all very nice, but it ignores how complicated this would be to implement on the server.</p>
</blockquote>
<p>Just to finish off what I originally had in mind:</p>
<h3>Changeset upload</h3>
<ol>
<li>Exclusive lock on changeset</li>
<li>Check if I<code>dempotency-Key</code> was provided in request, if so<br>
2.1 Fetch (Changeset Id, Idempotency-Key) from DB table <code>changeset_diffresults</code><br>
2.2. If entry exists, check if Request hash on DB matches hash for current request<br>
2.3. If matching, use cached diffResult from DB --> jump to step 6.</li>
<li>Process osmChange message</li>
<li>In case of success, and <code>Idempotency-Key</code> available<br>
4.1 Store (Changeset id, Idempotency Key, Hash, current time, diffResult) on db table <code>changeset_diffresults</code></li>
<li>Commit transaction</li>
<li>Return diffResult response to client</li>
</ol>
<p>Cleanup:</p>
<ul>
<li>Close changeset: remove all entries for changeset id in <code>changeset_diffresults</code> table</li>
<li>Periodic job cleans up stale entries for implicitly closed changesets</li>
</ul>
<p>Table <code>changeset_diffresults</code></p>
<ul>
<li>Changeset Id (Key)</li>
<li>Idempotency-Key (Key)</li>
<li>Hash for osmChange mesasge</li>
<li>Timestamp (for cleanup)</li>
<li>diffResult message</li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/2201#issuecomment-480600794">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABWnLbVaT5Rhoqb_17AQa8HEbB9HdVg0ks5vehCUgaJpZM4cgFOf">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABWnLdrs3gpc7ot9oMyQ8vfFpHg-Z7pcks5vehCUgaJpZM4cgFOf.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/openstreetmap/openstreetmap-website","title":"openstreetmap/openstreetmap-website","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/openstreetmap/openstreetmap-website"}},"updates":{"snippets":[{"icon":"PERSON","message":"@mmd-osm in #2201: \u003e That's all very nice, but it ignores how complicated this would be to implement on the server.\r\n\r\nJust to finish off what I originally had in mind:\r\n\r\n### Changeset upload\r\n\r\n1. Exclusive lock on changeset\r\n2. Check if I`dempotency-Key` was provided in request, if so\r\n2.1 Fetch (Changeset Id, Idempotency-Key) from DB table `changeset_diffresults`\r\n2.2. If entry exists, check if Request hash on DB matches hash for current request\r\n2.3. If matching, use cached diffResult from DB --\u003e jump to step 6.\r\n3. Process osmChange message\r\n4. In case of success, and `Idempotency-Key` available\r\n4.1 Store (Changeset id, Idempotency Key, Hash, current time, diffResult) on db table `changeset_diffresults`\r\n5. Commit transaction\r\n6. Return diffResult response to client\r\n\r\n\r\nCleanup:\r\n\r\n* Close changeset: remove all entries for changeset id in `changeset_diffresults` table\r\n* Periodic job cleans up stale entries for implicitly closed changesets\r\n\r\nTable `changeset_diffresults`\r\n\r\n* Changeset Id (Key)\r\n* Idempotency-Key (Key)\r\n* Hash for osmChange mesasge\r\n* Timestamp (for cleanup)\r\n* diffResult message\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}],"action":{"name":"View Issue","url":"https://github.com/openstreetmap/openstreetmap-website/issues/2201#issuecomment-480600794"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/2201#issuecomment-480600794",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/2201#issuecomment-480600794",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>