-
Couldn't load subscription status.
- Fork 726
Fix the notify about commit logic in Column Shards #27104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,7 @@ class TReadMetadata: public TReadMetadataBase { | |
| using TBase = TReadMetadataBase; | ||
|
|
||
| private: | ||
| std::shared_ptr<TAtomicCounter> BrokenWithCommitted = std::make_shared<TAtomicCounter>(); | ||
| mutable TAtomicCounter BreakLockOnReadFinished = TAtomicCounter(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mutable? Из-за избавления от shared_ptr? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Так точно. Там метод который это поле меняет const, и на этот const там полагаются вызывающие методы и т.д. В общем, я не стал все это править, просто локально упростил. shared_ptr убрал т.к. это внутренняя переменная, никуда мы ее не шарим, а сам класс не копируемый. |
||
| std::shared_ptr<NColumnShard::TLockSharingInfo> LockSharingInfo; | ||
|
|
||
| class TWriteIdInfo { | ||
|
|
@@ -99,17 +99,17 @@ class TReadMetadata: public TReadMetadataBase { | |
| return LockId; | ||
| } | ||
|
|
||
| void MarkAsConflictable() const { | ||
| void MarkAsConflicting() const { | ||
| Conflicts->Inc(); | ||
| } | ||
|
|
||
| bool IsConflictable() const { | ||
| bool IsConflicting() const { | ||
| return Conflicts->Val(); | ||
| } | ||
| }; | ||
|
|
||
| THashMap<ui64, std::shared_ptr<TAtomicCounter>> LockConflictCounters; | ||
| THashMap<TInsertWriteId, TWriteIdInfo> ConflictedWriteIds; | ||
| THashMap<TInsertWriteId, TWriteIdInfo> ConflictingWrites; | ||
|
|
||
| virtual void DoOnReadFinished(NColumnShard::TColumnShard& owner) const override; | ||
| virtual void DoOnBeforeStartReading(NColumnShard::TColumnShard& owner) const override; | ||
|
|
@@ -132,51 +132,48 @@ class TReadMetadata: public TReadMetadataBase { | |
| return std::move(SourcesConstructor); | ||
| } | ||
|
|
||
| bool GetBrokenWithCommitted() const { | ||
| return BrokenWithCommitted->Val(); | ||
| bool GetBreakLockOnReadFinished() const { | ||
| return BreakLockOnReadFinished.Val(); | ||
| } | ||
| THashSet<ui64> GetConflictableLockIds() const { | ||
|
|
||
| void SetBreakLockOnReadFinished() const { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А почему не Add или Inc? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ну оно по смыслу не Add. Мы именно просим «сломай свой лок когда закончится чтение». There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. То что оно там add внутри - это детали реализации, не вижу смысла «показывать» их наружу. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Странно выглядит, что на самом деле это не Set |
||
| BreakLockOnReadFinished.Inc(); | ||
| } | ||
|
|
||
| THashSet<ui64> GetConflictingLockIds() const { | ||
| THashSet<ui64> result; | ||
| for (auto&& i : ConflictedWriteIds) { | ||
| if (i.second.IsConflictable()) { | ||
| result.emplace(i.second.GetLockId()); | ||
| for (auto& [_, writeIdInfo] : ConflictingWrites) { | ||
| if (writeIdInfo.IsConflicting()) { | ||
| result.emplace(writeIdInfo.GetLockId()); | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| bool IsLockConflictable(const ui64 lockId) const { | ||
| auto it = LockConflictCounters.find(lockId); | ||
| AFL_VERIFY(it != LockConflictCounters.end()); | ||
| return it->second->Val(); | ||
| } | ||
|
|
||
| bool IsWriteConflictable(const TInsertWriteId writeId) const { | ||
| auto it = ConflictedWriteIds.find(writeId); | ||
| AFL_VERIFY(it != ConflictedWriteIds.end()); | ||
| return it->second.IsConflictable(); | ||
| THashSet<ui64> GetMaybeConflictingLockIds() const { | ||
| THashSet<ui64> result; | ||
| for (auto& [_, writeInfo] : ConflictingWrites) { | ||
| result.emplace(writeInfo.GetLockId()); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| bool MayWriteBeConflicting(const TInsertWriteId writeId) const { | ||
| return ConflictedWriteIds.contains(writeId); | ||
| return ConflictingWrites.contains(writeId); | ||
| } | ||
|
|
||
| void AddWriteIdToCheck(const TInsertWriteId writeId, const ui64 lockId) { | ||
| void AddMaybeConflictingWrite(const TInsertWriteId writeId, const ui64 lockId) { | ||
| auto it = LockConflictCounters.find(lockId); | ||
| if (it == LockConflictCounters.end()) { | ||
| it = LockConflictCounters.emplace(lockId, std::make_shared<TAtomicCounter>()).first; | ||
| } | ||
| AFL_VERIFY(ConflictedWriteIds.emplace(writeId, TWriteIdInfo(lockId, it->second)).second); | ||
| AFL_VERIFY(ConflictingWrites.emplace(writeId, TWriteIdInfo(lockId, it->second)).second); | ||
| } | ||
|
|
||
| void SetConflictedWriteId(const TInsertWriteId writeId) const { | ||
| auto it = ConflictedWriteIds.find(writeId); | ||
| AFL_VERIFY(it != ConflictedWriteIds.end()); | ||
| it->second.MarkAsConflictable(); | ||
| } | ||
|
|
||
| void SetBrokenWithCommitted() const { | ||
| BrokenWithCommitted->Inc(); | ||
| void SetWriteConflicting(const TInsertWriteId writeId) const { | ||
| auto it = ConflictingWrites.find(writeId); | ||
| AFL_VERIFY(it != ConflictingWrites.end()); | ||
| it->second.MarkAsConflicting(); | ||
| } | ||
|
|
||
| NArrow::NMerger::TSortableBatchPosition BuildSortedPosition(const NArrow::TSimpleRow& key) const; | ||
|
|
@@ -192,6 +189,9 @@ class TReadMetadata: public TReadMetadataBase { | |
|
|
||
| TReadMetadata(const std::shared_ptr<const TVersionedIndex>& schemaIndex, const TReadDescription& read); | ||
|
|
||
| TReadMetadata(const TReadMetadata&) = delete; | ||
| TReadMetadata& operator=(const TReadMetadata&) = delete; | ||
|
|
||
| virtual std::vector<TNameTypeInfo> GetKeyYqlSchema() const override { | ||
| return GetResultSchema()->GetIndexInfo().GetPrimaryKeyColumns(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.