@@ -25,7 +25,7 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
25
25
NYdb::NTable::TTableClient client (driver);
26
26
int count = 10 ;
27
27
28
- std::unordered_set <std::string> sids;
28
+ THashSet <std::string> sids;
29
29
while (count--) {
30
30
auto sessionResponse = client.GetSession ().ExtractValueSync ();
31
31
UNIT_ASSERT_EQUAL (sessionResponse.IsTransportError (), false );
@@ -55,8 +55,8 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
55
55
NYdb::NTable::TTableClient client (driver);
56
56
int count = 10 ;
57
57
58
- std::vector <TSession> sids;
59
- std::vector <TAsyncDataQueryResult> results;
58
+ TVector <TSession> sids;
59
+ TVector <TAsyncDataQueryResult> results;
60
60
while (count--) {
61
61
auto sessionResponse = client.GetSession ().ExtractValueSync ();
62
62
UNIT_ASSERT_EQUAL (sessionResponse.IsTransportError (), false );
@@ -90,8 +90,8 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
90
90
NYdb::NTable::TTableClient client (driver);
91
91
int count = 10 ;
92
92
93
- std::vector <TSession> sids;
94
- std::vector <TAsyncDataQueryResult> results;
93
+ TVector <TSession> sids;
94
+ TVector <TAsyncDataQueryResult> results;
95
95
while (count--) {
96
96
auto sessionResponse = client.GetSession ().ExtractValueSync ();
97
97
UNIT_ASSERT_EQUAL (sessionResponse.IsTransportError (), false );
@@ -189,7 +189,7 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
189
189
};
190
190
IThreadFactory* pool = SystemThreadFactory ();
191
191
192
- std::vector <TAutoPtr<IThreadFactory::IThread>> threads;
192
+ TVector <TAutoPtr<IThreadFactory::IThread>> threads;
193
193
threads.resize (nThreads);
194
194
for (int i = 0 ; i < nThreads; i++) {
195
195
threads[i] = pool->Run (job);
@@ -229,12 +229,12 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
229
229
230
230
constexpr int nThreads = 100 ;
231
231
NYdb::EStatus statuses[nThreads];
232
- std::vector<std::optional <typename TClient::TSession>> sessions;
232
+ TVector<TMaybe <typename TClient::TSession>> sessions;
233
233
sessions.resize (nThreads);
234
- std::atomic< int > t = 0 ;
234
+ TAtomic t = 0 ;
235
235
auto job = [client, &t, &statuses, &sessions]() mutable {
236
236
auto sessionResponse = client.GetSession ().ExtractValueSync ();
237
- int i = ++t ;
237
+ int i = AtomicIncrement (t) ;
238
238
statuses[--i] = sessionResponse.GetStatus ();
239
239
if (statuses[i] == EStatus::SUCCESS) {
240
240
EnsureCanExecQuery (sessionResponse.GetSession ());
@@ -243,7 +243,7 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
243
243
};
244
244
IThreadFactory* pool = SystemThreadFactory ();
245
245
246
- std::vector <TAutoPtr<IThreadFactory::IThread>> threads;
246
+ TVector <TAutoPtr<IThreadFactory::IThread>> threads;
247
247
threads.resize (nThreads);
248
248
for (int i = 0 ; i < nThreads; i++) {
249
249
threads[i] = pool->Run (job);
@@ -309,14 +309,14 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
309
309
310
310
constexpr int nThreads = 20 ;
311
311
constexpr int nRequests = 50 ;
312
- std::array<std::vector <typename T::TResult>, nThreads> results;
312
+ std::array<TVector <typename T::TResult>, nThreads> results;
313
313
std::atomic<int > t = 0 ;
314
314
std::atomic<int > validSessions = 0 ;
315
315
auto job = [client, &t, &results, &validSessions]() mutable {
316
316
auto sessionResponse = client.GetSession ().ExtractValueSync ();
317
317
318
318
int i = ++t;
319
- std::vector <typename T::TResult>& r = results[--i];
319
+ TVector <typename T::TResult>& r = results[--i];
320
320
321
321
if (sessionResponse.GetStatus () != EStatus::SUCCESS) {
322
322
return ;
@@ -329,7 +329,7 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
329
329
};
330
330
IThreadFactory* pool = SystemThreadFactory ();
331
331
332
- std::vector <TAutoPtr<IThreadFactory::IThread>> threads;
332
+ TVector <TAutoPtr<IThreadFactory::IThread>> threads;
333
333
threads.resize (nThreads);
334
334
for (int i = 0 ; i < nThreads; i++) {
335
335
threads[i] = pool->Run (job);
@@ -475,7 +475,7 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
475
475
}*/
476
476
477
477
Y_UNIT_TEST (CloseSessionAfterDriverDtorWithoutSessionPool) {
478
- std::vector <std::string> sessionIds;
478
+ TVector <std::string> sessionIds;
479
479
int iterations = 50 ;
480
480
481
481
while (iterations--) {
@@ -505,7 +505,7 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
505
505
}
506
506
507
507
Y_UNIT_TEST (CloseSessionWithSessionPoolExplicit) {
508
- std::vector <std::string> sessionIds;
508
+ TVector <std::string> sessionIds;
509
509
int iterations = 100 ;
510
510
511
511
while (iterations--) {
@@ -559,7 +559,7 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
559
559
}
560
560
561
561
Y_UNIT_TEST (CloseSessionWithSessionPoolExplicitDriverStopOnly) {
562
- std::vector <std::string> sessionIds;
562
+ TVector <std::string> sessionIds;
563
563
int iterations = 100 ;
564
564
565
565
while (iterations--) {
@@ -601,7 +601,7 @@ Y_UNIT_TEST_SUITE(YdbSdkSessions) {
601
601
}
602
602
603
603
Y_UNIT_TEST (CloseSessionWithSessionPoolFromDtors) {
604
- std::vector <std::string> sessionIds;
604
+ TVector <std::string> sessionIds;
605
605
int iterations = 100 ;
606
606
607
607
while (iterations--) {
0 commit comments