<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/library/cpp/yt/threading, branch CLI_2.27.0</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=CLI_2.27.0</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=CLI_2.27.0'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2025-09-30T14:11:54Z</updated>
<entry>
<title>Intermediate changes</title>
<updated>2025-09-30T14:11:54Z</updated>
<author>
<name>robot-piglet</name>
<email>robot-piglet@yandex-team.com</email>
</author>
<published>2025-09-30T14:00:09Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=93c3c7e2863c2e70b8d2959681210da19439af87'/>
<id>urn:sha1:93c3c7e2863c2e70b8d2959681210da19439af87</id>
<content type='text'>
commit_hash:d932ec0ffc0aaea61db064d99b47b64653cd406e
</content>
</entry>
<entry>
<title>Track RWSpinLock acquires per thread to ensure no reentrant usages are present</title>
<updated>2025-09-30T14:02:14Z</updated>
<author>
<name>pavook</name>
<email>pavook@yandex-team.com</email>
</author>
<published>2025-09-30T13:19:31Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=2266fce1ac8998d68d921a03e902e0596fe204a4'/>
<id>urn:sha1:2266fce1ac8998d68d921a03e902e0596fe204a4</id>
<content type='text'>
commit_hash:daa3d76bfd4283d7cda9ffd741c8ed10457a5c84
</content>
</entry>
<entry>
<title>YT-26288: Revert fork lock to writer starving spinlock</title>
<updated>2025-09-26T10:44:08Z</updated>
<author>
<name>pavook</name>
<email>pavook@yandex-team.com</email>
</author>
<published>2025-09-26T10:21:26Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=9239d3fa83520c4cc193a272ed9c62bc5eec3e6b'/>
<id>urn:sha1:9239d3fa83520c4cc193a272ed9c62bc5eec3e6b</id>
<content type='text'>
`TForkAwareSpinLock` implementation takes `ForkLock_` reader, which can (and does) violate the non-reentrancy.
commit_hash:6eb1092777ac21dd8303b938f855d0cd61276641
</content>
</entry>
<entry>
<title>YT-18571: Refactor traced (fomerly tracked)  spin locks and add unittests</title>
<updated>2025-08-18T06:39:02Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2025-08-18T06:12:12Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=4da962b08b5146886840a888e757489ebac0fa63'/>
<id>urn:sha1:4da962b08b5146886840a888e757489ebac0fa63</id>
<content type='text'>
commit_hash:2476930524e6179b49fbf312f907bd03413cd8b8
</content>
</entry>
<entry>
<title>Intermediate changes</title>
<updated>2025-08-17T14:33:49Z</updated>
<author>
<name>robot-piglet</name>
<email>robot-piglet@yandex-team.com</email>
</author>
<published>2025-08-17T14:21:28Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=29bb27ece8eeaaf4c99109de21e4762af5d7efb4'/>
<id>urn:sha1:29bb27ece8eeaaf4c99109de21e4762af5d7efb4</id>
<content type='text'>
commit_hash:ca1f7319b759adc9a144adc5d01ae005c364e806
</content>
</entry>
<entry>
<title>YT-24537: Prioritize writers in TReaderWriterSpinLock, rename old version to TWriterStarvingRWLock</title>
<updated>2025-04-17T11:47:23Z</updated>
<author>
<name>pavook</name>
<email>pavook@yandex-team.com</email>
</author>
<published>2025-04-17T11:21:12Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=6b567e38e0404cb1f94132fb48f6cb4b8ab1c800'/>
<id>urn:sha1:6b567e38e0404cb1f94132fb48f6cb4b8ab1c800</id>
<content type='text'>
Previously, it was possible that `TReaderWriterSpinLock` wouldn't let the writer through if there's a steady flow of readers.

This change addresses that by:
1. Prioritizing writers inside the spinlock by adding an additional `WriterReady` flag that writers set on arrival. This flag doesn't allow any readers to come through.
2. Adding the proper tests to verify this functionality, as well as spinlock's behaviour under forks.
3. Clarifying the documentation about spinlock guarantees
4. Adding a TLA+ model, formally specifying and verifying the guarantees of the new spinlock.
5. Renaming the old lock to `TWriterStarvingRWSpinLock`, and replacing all usages inside YT with the new version (renaming all usages outside of YT to the WriterStarving version).

This is a second attempt of REVIEW: 8233768, the first one was rolled back as it lead to deadlocks in user code with reentrant reader locks:
the case of `AcquireReader(thread0) -&gt; AcquireWriter(thread1) -&gt; AcquireReader(thread0)` is a deadlock, as `thread0` will not be able to acquire the lock (for the second time) before `thread1` frees writer lock, and `thread1` will not be able to acquire writer lock before the reader lock will be released by `thread0`, which won't happen until `thread0` acquires the lock for the second time. See/for more context and a real example of such situation. Analogous problem can happen with fibers: this is why you shouldn't allow context switches under the lock.

Wondering why this ugly name `WriterStarvingRWSpinLock` appeared in your beautiful code? No worries, if you are **sure** that you don't use reentrant locks or fiber switches under the lock, you can freely replace your usage with the new `ReaderWriterSpinLock`. The replacement is drop-in.

[nodiff:caesar]
commit_hash:97683f854defca00cc283f5a2a10a1730b3c9174
</content>
</entry>
<entry>
<title>Revert commit rXXXXXX, YT-24537: Prioritize writers in TReaderWriterSpinLock</title>
<updated>2025-04-15T16:53:08Z</updated>
<author>
<name>pavook</name>
<email>pavook@yandex-team.com</email>
</author>
<published>2025-04-15T16:37:21Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=3b1c16e57e7e2e4499c9d1b592f350f5a4a1a960'/>
<id>urn:sha1:3b1c16e57e7e2e4499c9d1b592f350f5a4a1a960</id>
<content type='text'>
It turns out, RWSpinLock previously accidentally supported recursive AcquireReaders, and this property was broken with the change.
commit_hash:f996e7b52ef8b3d37118034530a094af0efbe435
</content>
</entry>
<entry>
<title>YT-24537: Prioritize writers in TReaderWriterSpinLock</title>
<updated>2025-04-10T12:57:08Z</updated>
<author>
<name>pavook</name>
<email>pavook@yandex-team.com</email>
</author>
<published>2025-04-10T12:42:18Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=e4ca0cae001c7a0cc845bca18daff015123a1294'/>
<id>urn:sha1:e4ca0cae001c7a0cc845bca18daff015123a1294</id>
<content type='text'>
commit_hash:94fee5363799655628bd7e2c144a7869a9d89002
</content>
</entry>
<entry>
<title>Move libyqlplugin.so to yt</title>
<updated>2025-02-05T17:40:36Z</updated>
<author>
<name>mpereskokova</name>
<email>mpereskokova@yandex-team.com</email>
</author>
<published>2025-02-05T17:01:29Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=53c94da1fd856e0a2a445bb594b8da9ee02eaacb'/>
<id>urn:sha1:53c94da1fd856e0a2a445bb594b8da9ee02eaacb</id>
<content type='text'>
Приедет в  ytsaurus: &lt;HIDDEN_URL&gt;

Приедет в `/contrib/ydb/` &lt;HIDDEN_URL&gt;

Проверка, что в github ydb  ничего не сломается: &lt;https://github.com/ydb-platform/ydb/pull/13286&gt;
commit_hash:73ab1b4a3245322afc9fc6e9d71424ad07106477
</content>
</entry>
<entry>
<title>Typos</title>
<updated>2025-01-16T08:39:38Z</updated>
<author>
<name>coteeq</name>
<email>coteeq@yandex-team.com</email>
</author>
<published>2025-01-16T08:22:10Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=9ef54447fb808783ad84dd50b946c3e493a99128'/>
<id>urn:sha1:9ef54447fb808783ad84dd50b946c3e493a99128</id>
<content type='text'>
commit_hash:afeeeea3c2cbdec0ddeed0fea5f88df9d8575f8b
</content>
</entry>
</feed>
