xichen01 commented on code in PR #5524:
URL: https://github.com/apache/ozone/pull/5524#discussion_r1383553020
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java:
##########
@@ -555,6 +565,12 @@ public synchronized void close() throws IOException {
if (!isException) {
Preconditions.checkArgument(writeOffset == offset);
}
+ if (atomicKeyCreation) {
+ long expectedSize = blockOutputStreamEntryPool.getDataSize();
+ Preconditions.checkState(expectedSize == offset,
Review Comment:
Understood, but throwing an exception is currently the most efficient and
simple solution. If we don't throw exceptions, we may need to do a lot of extra
checking, which would require a lot of code changes.
One possible reason is the S3G uses file semantics rather than key semantics
to write keys.
File semantics for writing a key requires 1. create, 2 write, 3 close
(including commit), and it is difficult to pass some state between these three
separate and distinct steps, whereas with key semantics for put
(put=create+write+close), where all the state is managed inside the put, it is
simpler.
--
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]