liaoxin01 opened a new pull request, #68106:
URL: https://github.com/apache/doris/pull/68106
### What problem does this PR solve?
Problem Summary:
#67347 changed `CloudRowsetWriter::_collect_packed_slice_location()` to read
the slice
location from the writer instead of `PackedFileManager`:
```cpp
if (!file_writer->is_in_packed_file()) {
return Status::OK();
}
...
static_cast<io::PackedFileWriter*>(file_writer)->get_packed_slice_location(&index);
```
`is_in_packed_file()` is a virtual method of `FileWriter`, and a writer that
wraps a
`PackedFileWriter` (for example an encryption writer layered on top of
`PackedFileSystem`)
has to forward it so that callers still see that the data went into a packed
file. For
such a writer the check passes but the object is not a `PackedFileWriter`,
so the
`static_cast` is undefined behavior:
```
cloud_rowset_writer.cpp:218:5: runtime error: downcast of address
0x7c8be5b61100 which does not point to an object of type 'io::PackedFileWriter'
note: object is of type 'doris::io::EncryptedFileWriter'
F packed_file_writer.cpp:236] Check failed: _state == State::CLOSED
```
Debug/ASAN builds abort on the `DCHECK`. Release builds read unrelated
fields as
`_is_direct_write` / `_packed_slice_handle`, which may crash or record a
bogus packed slice
location in the rowset meta.
### What is changed and how it works?
`get_packed_slice_location()` becomes a virtual method of `FileWriter`, next
to
`is_in_packed_file()`. The default returns `NotSupported`,
`PackedFileWriter` overrides it
with its existing implementation, and a wrapper forwards both calls to its
inner writer.
`CloudRowsetWriter` and `DeleteBitmapFileWriter` call it through
`FileWriter` instead of
downcasting. The lifetime fix of #67347 is kept: the location is still taken
from the
writer's own slice handle, not looked up by path.
### Release note
None
### Check List (For Author)
- Test
- [x] Unit Test
- Behavior changed:
- [x] No.
- Does this need documentation?
- [x] No.
--
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]