gavinchou commented on code in PR #66889:
URL: https://github.com/apache/doris/pull/66889#discussion_r3859586295
##########
be/src/storage/binlog.h:
##########
@@ -157,23 +158,24 @@ inline int64_t extract_tso_physical_time(int64_t tso) {
namespace segment_v2 {
-class SegmentWriteBinlogLsnMap {
+class SegmentAllocatedLsnMap {
public:
- void insert_seg_lsn(int64_t seg_id, std::shared_ptr<std::vector<int64_t>>
lsn_ids) {
+ void insert_segment_allocated_lsns(int64_t seg_id,
+ ConstAllocatedLsnVectorSharedPtr
lsn_ids) {
std::lock_guard<std::mutex> l(_mutex);
_seg_id_to_lsn_ids.emplace(seg_id, std::move(lsn_ids));
}
- void remove_seg(int64_t seg_id) {
+ void remove_segment(int64_t seg_id) {
std::lock_guard<std::mutex> l(_mutex);
_seg_id_to_lsn_ids.erase(seg_id);
}
- std::shared_ptr<const std::vector<int64_t>> get_seg_lsn(int64_t seg_id)
const {
+ ConstAllocatedLsnVectorSharedPtr get_segment_allocated_lsns(int64_t
seg_id) const {
std::lock_guard<std::mutex> l(_mutex);
auto it = _seg_id_to_lsn_ids.find(seg_id);
- CHECK(it != _seg_id_to_lsn_ids.end())
- << "SegmentWriteBinlogLsnMap::get_seg_lsn missing seg_id=" <<
seg_id
+ DCHECK(it != _seg_id_to_lsn_ids.end())
Review Comment:
Non-blocking: could we keep these guards as release-mode checks
(`CHECK`/`DORIS_CHECK`) rather than `DCHECK`? Here, if `seg_id` is missing,
`DCHECK` is compiled out in release builds and the following `it->second`
dereferences `end()`, which is undefined behavior. The analogous
`allocated_lsn_map` guards in `RowsetWriterContext` can similarly allow a null
dereference. This path previously used `CHECK`, so retaining a hard check would
preserve the production invariant.
--
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]