kerneltime commented on code in PR #6482:
URL: https://github.com/apache/ozone/pull/6482#discussion_r1571157453


##########
hadoop-hdds/docs/content/design/overwrite-key-only-if-unchanged.md:
##########
@@ -0,0 +1,191 @@
+---
+title: Overwriting an Ozone Key only if it has not changed.
+summary: A minimal design illustrating how to replace a key in Ozone only if 
it has not changes since it was read.
+date: 2024-04-05
+jira: HDDS-10657
+status: accepted
+author: Stephen ODonnell
+---
+
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+
+
+Ozone offers write semantics where the last writer to commit a key wins. 
Therefore multiple writers can concurrently write the same key, and which ever 
commits last will effectively overwrite all data that came before it.
+
+As an extension of this, there is no "locking" on a key which is being 
replaced.
+
+For any key, but especially a large key, it can take significant time to read 
and write it. There are scenarios where it would be desirable to replace a key 
in Ozone, but only if the key has not changed since it was read. With the 
absence of a lock, such an operation is not possible today.
+
+## As Things Stand
+
+Internally, all Ozone keys have both an objectID and UpdateID which are stored 
in OM as part of the key metadata.
+
+Each time something changes on the key, whether it is data or metadata, the 
updateID is changed. It comes from the ratis transactionID and is generally an 
increasing number.

Review Comment:
   The choice to base it on Ratis transaction ID is purely opportunistic for 
now, we could choose implement it entirely differently in the future. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to