Skip to content

Commit d8e4b72

Browse files
authored
stable-25-3: A couple of fixes for crushes detected under jepsen + nemesis (#31134)
2 parents cc9dac5 + cf3a905 commit d8e4b72

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

ydb/core/tx/columnshard/engines/reader/common_reader/constructor/read_metadata.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ NArrow::NMerger::TSortableBatchPosition TReadMetadata::BuildSortedPosition(const
9090
}
9191

9292
void TReadMetadata::DoOnReadFinished(NColumnShard::TColumnShard& owner) const {
93-
if (!NeedToDetectConflicts()) {
93+
auto alreadyAborted = LockId.has_value() && owner.GetOperationsManager().GetLockOptional(*GetLockId()) == nullptr;
94+
if (!NeedToDetectConflicts() || alreadyAborted) {
9495
return;
9596
}
97+
9698
const ui64 lock = *GetLockId();
9799
if (GetBreakLockOnReadFinished()) {
98100
owner.GetOperationsManager().GetLockVerified(lock).SetBroken();

ydb/core/tx/columnshard/engines/storage/granule/granule.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,16 @@ TGranuleMeta::TGranuleMeta(const TInternalPathId pathId, const TGranulesStorage&
148148
}
149149

150150
void TGranuleMeta::UpsertPortionOnLoad(const std::shared_ptr<TPortionInfo>& portion) {
151+
if (portion->GetPortionType() == EPortionType::Written) {
152+
auto writtenPortion = std::static_pointer_cast<TWrittenPortionInfo>(portion);
153+
const TInsertWriteId insertWriteId = writtenPortion->GetInsertWriteId();
154+
if (AtomicGet(LastInsertWriteId) < (i64)insertWriteId) {
155+
AtomicSet(LastInsertWriteId, (i64)insertWriteId);
156+
}
157+
}
151158
if (!portion->IsCommitted()) {
152159
const std::shared_ptr<TWrittenPortionInfo> portionImpl = std::static_pointer_cast<TWrittenPortionInfo>(portion);
153160
const TInsertWriteId insertWriteId = portionImpl->GetInsertWriteId();
154-
if (AtomicGet(LastInsertWriteId) < (i64)portionImpl->GetInsertWriteId()) {
155-
AtomicSet(LastInsertWriteId, (i64)portionImpl->GetInsertWriteId());
156-
}
157161
AFL_VERIFY(InsertedPortions.emplace(insertWriteId, portionImpl).second);
158162
AFL_VERIFY(InsertedPortionsById.emplace(portionImpl->GetPortionId(), portionImpl).second);
159163
AFL_VERIFY(!Portions.contains(portionImpl->GetPortionId()));

0 commit comments

Comments
 (0)