<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/library/cpp/yt/threading, branch oidc-1.2.4</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=oidc-1.2.4</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=oidc-1.2.4'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2025-04-17T11:47:23Z</updated>
<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>
<entry>
<title>Fix babenko issues of rXXXXXX</title>
<updated>2024-11-14T09:22:27Z</updated>
<author>
<name>arkady-e1ppa</name>
<email>arkady-e1ppa@yandex-team.com</email>
</author>
<published>2024-11-14T09:08:09Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=e667baaa857655a17da06aaf7ca0188e3f0178d8'/>
<id>urn:sha1:e667baaa857655a17da06aaf7ca0188e3f0178d8</id>
<content type='text'>
[nodiff:caesar]
commit_hash:93eef00a7132e68e727aa1f4028616db6522d03c
</content>
</entry>
<entry>
<title>Move atomic object to library/cpp/yt/threading</title>
<updated>2024-10-14T14:40:51Z</updated>
<author>
<name>arkady-e1ppa</name>
<email>arkady-e1ppa@yandex-team.com</email>
</author>
<published>2024-10-14T14:25:51Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=3b92e669413cdc39137dbfd1d23417b23ef276ef'/>
<id>urn:sha1:3b92e669413cdc39137dbfd1d23417b23ef276ef</id>
<content type='text'>
[nodiff:caesar]
commit_hash:446e45e0378f6b2cb31d85bcc3e4516efbdfe5a7
</content>
</entry>
<entry>
<title>YT-21233: Split error into error and stripped_error to rid the latter of deps on global variables</title>
<updated>2024-08-15T15:44:19Z</updated>
<author>
<name>arkady-e1ppa</name>
<email>arkady-e1ppa@yandex-team.com</email>
</author>
<published>2024-08-15T15:32:55Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=28ff4da78aa89f0226af33522332b7f06521412e'/>
<id>urn:sha1:28ff4da78aa89f0226af33522332b7f06521412e</id>
<content type='text'>
What happened:
1. error contents has been split into stripped_error and error. stripped_error contains the error itself (with attributes for now) and macros; error contains stripped_error and some extensions, namely, functions to get fiberId, hostname and traceid/spanid and all functions used to (de-)serialize error. This means that you cannot print error if you only include stripped_error, therefore you are likely to still require the entire error.h at the moment.
2. Mechanic for gathering origin attributes has been moved to newly created library/cpp/yt/error thus having no dependency on fibers, net or tracing. stripped_error uses these attributes as extendable semi-erased (meaning, you still would have to add a field and recompile the entire thing, but you don't have to introduce an extra dependency) storage for a bunch of attributes
3. Parsing of said attributes is done in error file (and not stripped_error).

P.S. So far the plan is to eventually move stripped_error (once dependency on core/ytree/attributes is eliminated) without any actual change to dependency graph of anything outside of core (e.g. you would still have to include misc/error.h to use it). Next step would be re-teaching the error how to print, which would move some more methods from core to the standalone module. After that one could finally depend on the error itself and not the entire core.

Annotations: [nodiff:caesar]
66615172181355821241d2e5f8e4a0f15e0ea791
</content>
</entry>
<entry>
<title>Throw on error in TNotificationHandle::TNotificationHandle instead of crashing</title>
<updated>2024-08-11T07:50:18Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2024-08-11T07:31:25Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=ccd1e498e726a5d05b17b7c451d63da5c9d845ef'/>
<id>urn:sha1:ccd1e498e726a5d05b17b7c451d63da5c9d845ef</id>
<content type='text'>
4356fc70f6d9ceec9f94b1879f49e27f3fee4342
</content>
</entry>
<entry>
<title>Return to the use of NThreading::TSpinLock</title>
<updated>2024-06-11T07:16:48Z</updated>
<author>
<name>arkady-e1ppa</name>
<email>arkady-e1ppa@yandex-team.com</email>
</author>
<published>2024-06-11T06:54:53Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=6db3b8ca95e44179e48306a58656fb1f9317d9c3'/>
<id>urn:sha1:6db3b8ca95e44179e48306a58656fb1f9317d9c3</id>
<content type='text'>
4792c7769dba84e38c0d981714741114add571d3
</content>
</entry>
</feed>
