airborne12 commented on code in PR #66856:
URL: https://github.com/apache/doris/pull/66856#discussion_r3801516909


##########
be/src/storage/index/snii/snii_blob_staging_directory.cpp:
##########
@@ -184,27 +202,21 @@ std::vector<snii::writer::BlobFileSource> 
SniiBlobStagingDirectory::blob_sources
     // std::map iterates in name order, which is the order the filesystem 
harvest
     // produced by sorting list(). Two builds of one index therefore lay their
     // sub-files out identically in the container.
-    for (const auto& [name, buffer] : _files) {
+    for (const auto& [name, file] : _files) {
         sources.push_back(snii::writer::BlobFileSource {
                 .name = name,
-                .length = buffer->size(),
-                .read_fn = [buffer](uint64_t offset, size_t len, uint8_t* out) 
-> Status {
-                    if (offset > buffer->size() || len > buffer->size() - 
offset) {
-                        return Status::Error<ErrorCode::INTERNAL_ERROR>(
-                                "SNII staging read [{}, +{}) is outside the 
staged {} bytes",
-                                offset, len, buffer->size());
-                    }
-                    std::memcpy(out, buffer->data() + offset, len);
-                    return Status::OK();
+                .length = file->bytes_written(),
+                .read_fn = [file](uint64_t offset, size_t len, uint8_t* out) 
-> Status {

Review Comment:
   Confirmed independently. I reproduced both failure positions with a real 
StagedBlobFile while keeping SniiCompoundWriter alive: bootstrap append failure 
before the blob is visited, and mid-blob append failure after one 64 KiB chunk. 
The terminal finish path now defers release of every cold/hot callback owner, 
and an already-poisoned writer releases them before returning as well. The 
staging file is unlinked immediately in both cases. Verified with 39 relevant 
ASAN unit tests, full ./build.sh --be -j 192, clang-format/check-format, and 
diff checks.



-- 
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