diff --git a/client/impl/ydb_internal/grpc_connections/grpc_connections.cpp b/client/impl/ydb_internal/grpc_connections/grpc_connections.cpp index d8c1982bc5f..7c68bbbe9a9 100644 --- a/client/impl/ydb_internal/grpc_connections/grpc_connections.cpp +++ b/client/impl/ydb_internal/grpc_connections/grpc_connections.cpp @@ -389,7 +389,7 @@ bool TGRpcConnectionsImpl::StartStatCollecting(NMonitoring::IMetricRegistry* sen if (auto ptr = dynamic_cast(sensorsRegistry)) { MetricRegistryPtr_ = ptr; } else { - Cerr << "Unknown IMetricRegistry impl" << Endl; + std::cerr << "Unknown IMetricRegistry impl" << std::endl; return false; } } diff --git a/client/impl/ydb_internal/retry/retry.h b/client/impl/ydb_internal/retry/retry.h index c89ec74e0cb..2695d379888 100644 --- a/client/impl/ydb_internal/retry/retry.h +++ b/client/impl/ydb_internal/retry/retry.h @@ -47,9 +47,9 @@ class TRetryContextBase : TNonCopyable { void LogRetry(const TStatus& status) { if (Settings_.Verbose_) { - Cerr << "Previous query attempt was finished with unsuccessful status " - << status.GetStatus() << ": " << status.GetIssues().ToString(true) << Endl; - Cerr << "Sending retry attempt " << RetryNumber_ << " of " << Settings_.MaxRetries_ << Endl; + std::cerr << "Previous query attempt was finished with unsuccessful status " + << ToString(status.GetStatus()) << ": " << status.GetIssues().ToString(true) << std::endl; + std::cerr << "Sending retry attempt " << RetryNumber_ << " of " << Settings_.MaxRetries_ << std::endl; } } diff --git a/client/ydb_coordination/coordination_ut.cpp b/client/ydb_coordination/coordination_ut.cpp index abeb1ce24ab..c8e71a67dd8 100644 --- a/client/ydb_coordination/coordination_ut.cpp +++ b/client/ydb_coordination/coordination_ut.cpp @@ -24,7 +24,7 @@ namespace { { Y_UNUSED(context); - Cerr << "ListEndpoints: " << request->ShortDebugString() << Endl; + std::cerr << "ListEndpoints: " << request->ShortDebugString() << std::endl; const auto* result = MockResults.FindPtr(request->database()); Y_ABORT_UNLESS(result, "Mock service doesn't have a result for database '%s'", request->database().c_str()); @@ -50,7 +50,7 @@ namespace { { Y_UNUSED(context); - Cerr << "Session stream started" << Endl; + std::cerr << "Session stream started" << std::endl; Ydb::Coordination::SessionRequest request; @@ -60,7 +60,7 @@ namespace { // Disconnected before the request was sent return grpc::Status::OK; } - Cerr << "Session request: " << request.ShortDebugString() << Endl; + std::cerr << "Session request: " << request.ShortDebugString() << std::endl; Y_ABORT_UNLESS(request.has_session_start(), "Expected session start"); auto& start = request.session_start(); uint64_t sessionId = start.session_id(); @@ -77,7 +77,7 @@ namespace { size_t pings_received = 0; while (stream->Read(&request)) { - Cerr << "Session request: " << request.ShortDebugString() << Endl; + std::cerr << "Session request: " << request.ShortDebugString() << std::endl; Y_ABORT_UNLESS(request.has_ping(), "Only ping requests are supported"); if (++pings_received <= 2) { // Only reply to the first 2 ping requests @@ -152,7 +152,7 @@ Y_UNIT_TEST_SUITE(Coordination) { auto endTimestamp = TInstant::Now(); auto elapsed = endTimestamp - startTimestamp; - Cerr << "Got: " << res.GetStatus() << ": " << res.GetIssues().ToString() << Endl; + std::cerr << "Got: " << res.GetStatus() << ": " << res.GetIssues().ToString() << std::endl; // Both connection and session timeout return EStatus::TIMEOUT UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::TIMEOUT, res.GetIssues().ToString()); @@ -168,7 +168,7 @@ Y_UNIT_TEST_SUITE(Coordination) { TMockCoordinationService coordinationService; ui16 coordinationPort = pm.GetPort(); auto coordinationServer = StartGrpcServer( - TYdbStringBuilder() << "0.0.0.0:" << coordinationPort, + TStringBuilder() << "0.0.0.0:" << coordinationPort, coordinationService); // Fill a fake discovery service @@ -197,7 +197,7 @@ Y_UNIT_TEST_SUITE(Coordination) { auto stoppedFuture = stoppedPromise.GetFuture(); auto settings = TSessionSettings() .OnStateChanged([](auto state) { - Cerr << "Session state: " << state << Endl; + std::cerr << "Session state: " << state << std::endl; }) .OnStopped([stoppedPromise]() mutable { stoppedPromise.SetValue(); @@ -221,7 +221,7 @@ Y_UNIT_TEST_SUITE(Coordination) { // Check the last failure stored in a session auto res2 = session.Close().ExtractValueSync(); - Cerr << "Close: " << res2.GetStatus() << ": " << res2.GetIssues().ToString() << Endl; + std::cerr << "Close: " << res2.GetStatus() << ": " << res2.GetIssues().ToString() << std::endl; UNIT_ASSERT_VALUES_EQUAL_C(res2.GetStatus(), EStatus::TIMEOUT, res2.GetIssues().ToString()); } @@ -261,7 +261,7 @@ Y_UNIT_TEST_SUITE(Coordination) { auto stoppedFuture = stoppedPromise.GetFuture(); auto settings = TSessionSettings() .OnStateChanged([](auto state) { - Cerr << "Session state: " << state << Endl; + std::cerr << "Session state: " << state << std::endl; }) .OnStopped([stoppedPromise]() mutable { stoppedPromise.SetValue(); @@ -288,7 +288,7 @@ Y_UNIT_TEST_SUITE(Coordination) { // Check the last failure stored in a session auto res2 = session.Close().ExtractValueSync(); - Cerr << "Close: " << res2.GetStatus() << ": " << res2.GetIssues().ToString() << Endl; + std::cerr << "Close: " << res2.GetStatus() << ": " << res2.GetIssues().ToString() << std::endl; UNIT_ASSERT_VALUES_EQUAL_C(res2.GetStatus(), EStatus::CLIENT_CANCELLED, res2.GetIssues().ToString()); } diff --git a/client/ydb_driver/driver_ut.cpp b/client/ydb_driver/driver_ut.cpp index b67963c4f16..ef893c8d0a5 100644 --- a/client/ydb_driver/driver_ut.cpp +++ b/client/ydb_driver/driver_ut.cpp @@ -29,7 +29,7 @@ namespace { { Y_UNUSED(context); - Cerr << "ListEndpoints: " << request->ShortDebugString() << Endl; + std::cerr << "ListEndpoints: " << request->ShortDebugString() << std::endl; const auto* result = MockResults.FindPtr(request->database()); Y_ABORT_UNLESS(result, "Mock service doesn't have a result for database '%s'", request->database().c_str()); @@ -54,7 +54,7 @@ namespace { { Y_UNUSED(context); - Cerr << "CreateSession: " << request->ShortDebugString() << Endl; + std::cerr << "CreateSession: " << request->ShortDebugString() << std::endl; Ydb::Table::CreateSessionResult result; result.set_session_id("my-session-id"); diff --git a/client/ydb_federated_topic/ut/basic_usage_ut.cpp b/client/ydb_federated_topic/ut/basic_usage_ut.cpp index 77115390441..705a5e0fb79 100644 --- a/client/ydb_federated_topic/ut/basic_usage_ut.cpp +++ b/client/ydb_federated_topic/ut/basic_usage_ut.cpp @@ -39,7 +39,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { // Create topic client. NYdb::TDriverConfig cfg; - cfg.SetEndpoint(TYdbStringBuilder() << "localhost:" << newServicePort); + cfg.SetEndpoint(TStringBuilder() << "localhost:" << newServicePort); cfg.SetDatabase("/Root"); cfg.SetLog(CreateLogBackend("cerr", ELogPriority::TLOG_DEBUG)); NYdb::TDriver driver(cfg); @@ -53,7 +53,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .AppendTopics(setup->GetTestTopic()); ReadSession = topicClient.CreateReadSession(readSettings); - Cerr << "Session was created" << Endl; + std::cerr << "Session was created" << std::endl; ReadSession->WaitEvent().Wait(TDuration::Seconds(1)); std::optional event = ReadSession->GetEvent(false); @@ -98,7 +98,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { ReadSession->WaitEvent().Wait(); // Get event std::optional event = ReadSession->GetEvent(true/*block - will block if no event received yet*/); - Cerr << "Got new read session event: " << DebugString(*event) << Endl; + std::cerr << "Got new read session event: " << DebugString(*event) << std::endl; auto* startPartitionSessionEvent = std::get_if(&*event); Y_ASSERT(startPartitionSessionEvent); @@ -135,19 +135,19 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .MaxMemoryUsageBytes(1_MB) .AppendTopics(setup->GetTestTopic()); - Cerr << "Before ReadSession was created" << Endl; + std::cerr << "Before ReadSession was created" << std::endl; ReadSession = topicClient.CreateReadSession(readSettings); - Cerr << "Session was created" << Endl; + std::cerr << "Session was created" << std::endl; auto f = ReadSession->WaitEvent(); - Cerr << "Returned from WaitEvent" << Endl; + std::cerr << "Returned from WaitEvent" << std::endl; // observer asyncInit should respect client/session timeouts UNIT_ASSERT(!f.Wait(TDuration::Seconds(1))); - Cerr << "Session blocked successfully" << Endl; + std::cerr << "Session blocked successfully" << std::endl; UNIT_ASSERT(ReadSession->Close(TDuration::MilliSeconds(10))); - Cerr << "Session closed gracefully" << Endl; + std::cerr << "Session closed gracefully" << std::endl; } Y_UNIT_TEST(RetryDiscoveryWithCancel) { @@ -231,7 +231,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .AppendTopics(setup->GetTestTopic()); ReadSession = topicClient.CreateReadSession(readSettings); - Cerr << "Session was created" << Endl; + std::cerr << "Session was created" << std::endl; Sleep(TDuration::MilliSeconds(50)); @@ -296,7 +296,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { UNIT_ASSERT(!events.empty()); for (auto& e : events) { - Cerr << ">>> Got event: " << DebugString(e) << Endl; + std::cerr << ">>> Got event: " << DebugString(e) << std::endl; if (auto* dataEvent = std::get_if(&e)) { dataEvent->Commit(); } else if (auto* startPartitionSessionEvent = std::get_if(&e)) { @@ -343,7 +343,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .AppendTopics(setup->GetTestTopic()); ReadSession = topicClient.CreateReadSession(readSettings); - Cerr << "Session was created" << Endl; + std::cerr << "Session was created" << std::endl; ReadSession->WaitEvent().Wait(TDuration::Seconds(1)); auto event = ReadSession->GetEvent(false); @@ -363,11 +363,11 @@ Y_UNIT_TEST_SUITE(BasicUsage) { ReadSession->WaitEvent().Wait(); event = ReadSession->GetEvent(false); UNIT_ASSERT(event.Defined()); - Cerr << ">>> Got event: " << DebugString(*event) << Endl; + std::cerr << ">>> Got event: " << DebugString(*event) << std::endl; UNIT_ASSERT(std::holds_alternative(*event)); auto ReadSession2 = topicClient.CreateReadSession(readSettings); - Cerr << "Session2 was created" << Endl; + std::cerr << "Session2 was created" << std::endl; ReadSession2->WaitEvent().Wait(TDuration::Seconds(1)); event = ReadSession2->GetEvent(false); @@ -384,10 +384,10 @@ Y_UNIT_TEST_SUITE(BasicUsage) { event = ReadSession2->GetEvent(true); UNIT_ASSERT(event.Defined()); - Cerr << ">>> Got event: " << DebugString(*event) << Endl; + std::cerr << ">>> Got event: " << DebugString(*event) << std::endl; UNIT_ASSERT(std::holds_alternative(*event)); - // Cerr << ">>> Got event: " << DebugString(*event) << Endl; + // std::cerr << ">>> Got event: " << DebugString(*event) << std::endl; // UNIT_ASSERT(std::holds_alternative(*event)); } @@ -408,12 +408,12 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .AppendTopics(setup->GetTestTopic()); ReadSession = topicClient.CreateReadSession(readSettings); - Cerr << "Session was created" << Endl; + std::cerr << "Session was created" << std::endl; ReadSession->WaitEvent().Wait(TDuration::Seconds(1)); std::optional event = ReadSession->GetEvent(false); Y_ASSERT(event); - Cerr << "Got new read session event: " << DebugString(*event) << Endl; + std::cerr << "Got new read session event: " << DebugString(*event) << std::endl; auto* startPartitionSessionEvent = std::get_if(&*event); Y_ASSERT(startPartitionSessionEvent); @@ -471,7 +471,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .AppendTopics(setup->GetTestTopic()); readSettings.FederatedEventHandlers_.SimpleDataHandlers([&](TReadSessionEvent::TDataReceivedEvent& ev) mutable { - Cerr << ">>> event from dataHandler: " << DebugString(ev) << Endl; + std::cerr << ">>> event from dataHandler: " << DebugString(ev) << std::endl; Y_VERIFY_S(AtomicGet(check) != 0, "check is false"); auto& messages = ev.GetMessages(); for (size_t i = 0u; i < messages.size(); ++i) { @@ -484,7 +484,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { }); ReadSession = topicClient.CreateReadSession(readSettings); - Cerr << ">>> Session was created" << Endl; + std::cerr << ">>> Session was created" << std::endl; Sleep(TDuration::MilliSeconds(50)); @@ -548,12 +548,12 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .MessageGroupId("src_id"); WriteSession = topicClient.CreateWriteSession(writeSettings); - Cerr << "Session was created" << Endl; + std::cerr << "Session was created" << std::endl; WriteSession->WaitEvent().Wait(TDuration::Seconds(1)); auto event = WriteSession->GetEvent(false); Y_ASSERT(event); - Cerr << "Got new read session event: " << DebugString(*event) << Endl; + std::cerr << "Got new read session event: " << DebugString(*event) << std::endl; auto* readyToAcceptEvent = std::get_if(&*event); Y_ASSERT(readyToAcceptEvent); WriteSession->Write(std::move(readyToAcceptEvent->ContinuationToken), NTopic::TWriteMessage("hello")); @@ -561,7 +561,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { WriteSession->WaitEvent().Wait(TDuration::Seconds(1)); event = WriteSession->GetEvent(false); Y_ASSERT(event); - Cerr << "Got new read session event: " << DebugString(*event) << Endl; + std::cerr << "Got new read session event: " << DebugString(*event) << std::endl; readyToAcceptEvent = std::get_if(&*event); Y_ASSERT(readyToAcceptEvent); @@ -579,7 +579,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { WriteSession->WaitEvent().Wait(TDuration::Seconds(1)); event = WriteSession->GetEvent(false); Y_ASSERT(event); - Cerr << "Got new read session event: " << DebugString(*event) << Endl; + std::cerr << "Got new read session event: " << DebugString(*event) << std::endl; auto* acksEvent = std::get_if(&*event); Y_ASSERT(acksEvent); diff --git a/client/ydb_federated_topic/ut/fds_mock.h b/client/ydb_federated_topic/ut/fds_mock.h index 1ed05a80f11..118d6c5c88b 100644 --- a/client/ydb_federated_topic/ut/fds_mock.h +++ b/client/ydb_federated_topic/ut/fds_mock.h @@ -61,7 +61,7 @@ class TFederationDiscoveryServiceMock: public Ydb::FederationDiscovery::V1::Fede f.Wait(TDuration::Seconds(35)); if (f.HasValue()) { auto result = f.ExtractValueSync(); - Cerr << ">>> Ready to answer: " << (result.Status.ok() ? "ok" : "err") << Endl; + std::cerr << ">>> Ready to answer: " << (result.Status.ok() ? "ok" : "err") << std::endl; *response = std::move(result.Response); return result.Status; } diff --git a/client/ydb_persqueue_core/impl/write_session_impl.cpp b/client/ydb_persqueue_core/impl/write_session_impl.cpp index 65abba46471..3d3aa4b216e 100644 --- a/client/ydb_persqueue_core/impl/write_session_impl.cpp +++ b/client/ydb_persqueue_core/impl/write_session_impl.cpp @@ -831,10 +831,10 @@ bool TWriteSessionImpl::CleanupOnAcknowledged(ui64 id) { LOG_LAZY(DbDriverState->Log, TLOG_DEBUG, LogPrefix() << "Write session: acknoledged message " << id); UpdateTimedCountersImpl(); if (SentOriginalMessages.empty() || SentOriginalMessages.front().Id != id){ - Cerr << "State before restart was:\n" << StateStr << "\n\n"; + std::cerr << "State before restart was:\n" << StateStr << "\n\n"; DumpState(); - Cerr << "State on ack with id " << id << " is:\n"; - Cerr << StateStr << "\n\n"; + std::cerr << "State on ack with id " << id << " is:\n"; + std::cerr << StateStr << "\n\n"; Y_ABORT("got unknown ack"); } @@ -1098,9 +1098,9 @@ bool TWriteSessionImpl::IsReadyToSendNextImpl() { Y_ABORT_UNLESS(!OriginalMessagesToSend.empty(), "There are packed messages but no original messages"); if (OriginalMessagesToSend.front().Id > PackedMessagesToSend.top().Offset) { - Cerr << " State before restart was:\n" << StateStr << "\n\n"; + std::cerr << " State before restart was:\n" << StateStr << "\n\n"; DumpState(); - Cerr << " State after restart is:\n" << StateStr << "\n\n"; + std::cerr << " State after restart is:\n" << StateStr << "\n\n"; Y_ABORT("Lost original message(s)"); } diff --git a/client/ydb_persqueue_core/ut/basic_usage_ut.cpp b/client/ydb_persqueue_core/ut/basic_usage_ut.cpp index b62790a701f..b4586b99dbd 100644 --- a/client/ydb_persqueue_core/ut/basic_usage_ut.cpp +++ b/client/ydb_persqueue_core/ut/basic_usage_ut.cpp @@ -68,7 +68,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { ui32 previousOffset = 0; bool closed = false; while ((readMessageCount < messageCount || committedOffset <= previousOffset) && !closed) { - Cerr << "Get event on client\n"; + std::cerr << "Get event on client\n"; auto event = *readSession->GetEvent(true); std::visit(TOverloaded { [&](TReadSessionEvent::TDataReceivedEvent& event) { @@ -149,7 +149,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { auto sessionAdapter = TSimpleWriteSessionTestAdapter( dynamic_cast(session.get())); if (shouldCaptureData.has_value()) { - TYdbStringBuilder msg; + TStringBuilder msg; msg << "Session has captured " << sessionAdapter.GetAcquiredMessagesCount() << " messages, capturing was expected: " << *shouldCaptureData << Endl; UNIT_ASSERT_VALUES_EQUAL_C(sessionAdapter.GetAcquiredMessagesCount() > 0, *shouldCaptureData, msg.c_str()); @@ -329,7 +329,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { oss << message; } - Cerr << message << " " << packed << "\n"; + std::cerr << message << " " << packed << "\n"; { auto event = *writer->GetEvent(true); @@ -364,7 +364,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { } ++tokens; } - Cerr << "GOT EVENT " << acks << " " << tokens << "\n"; + std::cerr << "GOT EVENT " << acks << " " << tokens << "\n"; } UNIT_ASSERT(!writer->WaitEvent().Wait(TDuration::Seconds(5))); @@ -377,7 +377,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { ); ui32 readMessageCount = 0; while (readMessageCount < 4) { - Cerr << "Get event on client\n"; + std::cerr << "Get event on client\n"; auto event = *readSession->GetEvent(true); std::visit(TOverloaded { [&](TReadSessionEvent::TDataReceivedEvent& event) { @@ -481,7 +481,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .RetryPolicy(IRetryPolicy::GetNoRetryPolicy()); std::shared_ptr readSession = client.CreateReadSession(settings); - Cerr << "Get event on client\n"; + std::cerr << "Get event on client\n"; auto event = *readSession->GetEvent(true); std::visit(TOverloaded { [&](TReadSessionEvent::TDataReceivedEvent&) { @@ -505,7 +505,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { UNIT_FAIL("Test does not support lock sessions yet"); }, [&](TSessionClosedEvent& event) { - Cerr << "Got close event: " << event.DebugString(); + std::cerr << "Got close event: " << event.DebugString(); } }, event); diff --git a/client/ydb_persqueue_core/ut/compress_executor_ut.cpp b/client/ydb_persqueue_core/ut/compress_executor_ut.cpp index da4bcde9c72..c79d2b7daa7 100644 --- a/client/ydb_persqueue_core/ut/compress_executor_ut.cpp +++ b/client/ydb_persqueue_core/ut/compress_executor_ut.cpp @@ -18,7 +18,7 @@ Y_UNIT_TEST_SUITE(CompressExecutor) { UNIT_ASSERT(!f1.HasValue()); UNIT_ASSERT(!f2.HasValue()); queue->Enqueue(1); - Cerr << "Waiting for writes to complete.\n"; + std::cerr << "Waiting for writes to complete.\n"; f1.Wait(); f2.Wait(); @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(CompressExecutor) { Y_ABORT("ANother ready to accept!"); } if(std::holds_alternative(event)) { - Cerr << "Session closed: " << std::get(event).DebugString() << "\n"; + std::cerr << "Session closed: " << std::get(event).DebugString() << "\n"; Y_ABORT(""); } } @@ -77,7 +77,7 @@ Y_UNIT_TEST_SUITE(CompressExecutor) { event = *writer->GetEvent(true); UNIT_ASSERT(std::holds_alternative(event)); - Cerr << "===Will now kick tablets\n"; + std::cerr << "===Will now kick tablets\n"; setup->KickTablets(); retryPolicy->ExpectBreakDown(); retryPolicy->WaitForRetriesSync(1); @@ -92,7 +92,7 @@ Y_UNIT_TEST_SUITE(CompressExecutor) { continueToken = std::move(std::get(event).ContinuationToken); } } - Cerr << "============ UT - Wait event...\n"; + std::cerr << "============ UT - Wait event...\n"; waitEventFuture = writer->WaitEvent(); waitEventFuture.Wait(TDuration::Seconds(3)); UNIT_ASSERT(!waitEventFuture.HasValue()); diff --git a/client/ydb_persqueue_core/ut/compression_ut.cpp b/client/ydb_persqueue_core/ut/compression_ut.cpp index 834498bba51..cab143c39a8 100644 --- a/client/ydb_persqueue_core/ut/compression_ut.cpp +++ b/client/ydb_persqueue_core/ut/compression_ut.cpp @@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(Compression) { UNIT_ASSERT(status.ok()); Ydb::PersQueue::V1::AlterTopicResult result; response.operation().result().UnpackTo(&result); - Cerr << "Alter topic response: " << response << "\nAlter result: " << result << "\n"; + std::cerr << "Alter topic response: " << response << "\nAlter result: " << result << "\n"; UNIT_ASSERT_VALUES_EQUAL(response.operation().status(), Ydb::StatusIds::SUCCESS); } @@ -78,14 +78,14 @@ Y_UNIT_TEST_SUITE(Compression) { const std::vector codecs, bool decompress ) { - Cerr << Endl << "Start read" << Endl << Endl; + std::cerr << std::endl << "Start read" << std::endl << std::endl; auto readSettings = setup.GetReadSessionSettings(); readSettings.Decompress(decompress); NThreading::TPromise checkedPromise = NThreading::NewPromise(); auto totalReceived = 0u; readSettings.EventHandlers_.SimpleDataHandlers( [&](const NYdb::NPersQueue::TReadSessionEvent::TDataReceivedEvent& ev) { - Cerr << Endl << Endl << Endl << "Got messages" << Endl << Endl; + std::cerr << std::endl << std::endl << std::endl << "Got messages" << std::endl << std::endl; if (decompress) { UNIT_ASSERT_NO_EXCEPTION(ev.GetMessages()); UNIT_ASSERT_EXCEPTION(ev.GetCompressedMessages(), yexception); @@ -102,7 +102,7 @@ Y_UNIT_TEST_SUITE(Compression) { ++totalReceived; } } - Cerr << Endl << "totalReceived: " << totalReceived << " wait: " << messages.size() << Endl << Endl; + std::cerr << std::endl << "totalReceived: " << totalReceived << " wait: " << messages.size() << std::endl << std::endl; if (totalReceived == messages.size()) checkedPromise.SetValue(); } diff --git a/client/ydb_persqueue_core/ut/read_session_ut.cpp b/client/ydb_persqueue_core/ut/read_session_ut.cpp index 0d681aa6b51..8117e7e7114 100644 --- a/client/ydb_persqueue_core/ut/read_session_ut.cpp +++ b/client/ydb_persqueue_core/ut/read_session_ut.cpp @@ -526,7 +526,7 @@ class TReorderingExecutor : public ::IExecutor { void Post(TFunction&& f) override { { std::lock_guard guard(Lock); - Cerr << "Post function" << Endl; + std::cerr << "Post function" << std::endl; ++TasksAdded; if (Functions.empty()) { Functions.reserve(CycleCount); @@ -686,7 +686,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { UNIT_ASSERT(event); UNIT_ASSERT_EVENT_TYPE(*event, TReadSessionEvent::TCreatePartitionStreamEvent); std::get(*event).Confirm(); - Cerr << "create event " << DebugString(*event) << Endl; + std::cerr << "create event " << DebugString(*event) << std::endl; } // Event 2: data. { @@ -698,7 +698,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { for (auto& msg : dataEvent.GetMessages()) { UNIT_ASSERT(msg.GetData() == "message1" || msg.GetData() == "message2"); } - Cerr << "data event " << DebugString(*event) << Endl; + std::cerr << "data event " << DebugString(*event) << std::endl; if (commit) { dc.Add(dataEvent); } @@ -714,7 +714,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { for (auto& msg : dataEvent.GetMessages()) { UNIT_ASSERT(msg.GetData() == "message3"); } - Cerr << "data event " << DebugString(*event) << Endl; + std::cerr << "data event " << DebugString(*event) << std::endl; dataEvent.Commit(); // Commit right now! } @@ -729,14 +729,14 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { if (commit) { // (commit && close) branch check is broken with current TReadSession::Close quick fix std::optional event = session->GetEvent(!close); // Event is expected to be already in queue if closed. UNIT_ASSERT(event); - Cerr << "commit ack or close event " << DebugString(*event) << Endl; + std::cerr << "commit ack or close event " << DebugString(*event) << std::endl; UNIT_ASSERT(std::holds_alternative(*event) || std::holds_alternative(*event)); } if (close && !commit) { std::optional event = session->GetEvent(false); UNIT_ASSERT(event); - Cerr << "close event " << DebugString(*event) << Endl; + std::cerr << "close event " << DebugString(*event) << std::endl; UNIT_ASSERT(std::holds_alternative(*event)); UNIT_ASSERT_STRING_CONTAINS(DebugString(*event), "Session was gracefully closed"); } @@ -769,7 +769,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { std::optional event = \ session->GetEvent(true); \ UNIT_ASSERT(event); \ - Cerr << DebugString(*event) << Endl; \ + std::cerr << DebugString(*event) << std::endl; \ UNIT_ASSERT_EVENT_TYPE(*event, TSessionClosedEvent); \ /**/ @@ -805,7 +805,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { std::shared_ptr session = setup.GetPersQueueClient().CreateReadSession(settings); std::optional event = session->GetEvent(true); UNIT_ASSERT(event); - Cerr << DebugString(*event) << Endl; + std::cerr << DebugString(*event) << std::endl; UNIT_ASSERT_EVENT_TYPE(*event, TSessionClosedEvent); } @@ -820,7 +820,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { std::shared_ptr session = setup.GetPersQueueClient().CreateReadSession(settings); std::optional event = session->GetEvent(true); UNIT_ASSERT(event); - Cerr << DebugString(*event) << Endl; + std::cerr << DebugString(*event) << std::endl; UNIT_ASSERT_NOT_EVENT_TYPE(*event, TSessionClosedEvent); } @@ -830,7 +830,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { std::shared_ptr session = setup.GetPersQueueClient().CreateReadSession(settings); std::optional event = session->GetEvent(true); UNIT_ASSERT(event); - Cerr << DebugString(*event) << Endl; + std::cerr << DebugString(*event) << std::endl; UNIT_ASSERT_EVENT_TYPE(*event, TSessionClosedEvent); } @@ -840,7 +840,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { std::shared_ptr session = setup.GetPersQueueClient().CreateReadSession(settings); std::optional event = session->GetEvent(true); UNIT_ASSERT(event); - Cerr << DebugString(*event) << Endl; + std::cerr << DebugString(*event) << std::endl; UNIT_ASSERT_EVENT_TYPE(*event, TSessionClosedEvent); } } @@ -856,7 +856,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { UNIT_ASSERT(event); UNIT_ASSERT_EVENT_TYPE(*event, TReadSessionEvent::TCreatePartitionStreamEvent); std::get(*event).Confirm(); - Cerr << DebugString(*event) << Endl; + std::cerr << DebugString(*event) << std::endl; } // Event 2: receive data. @@ -867,7 +867,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { TReadSessionEvent::TDataReceivedEvent& dataEvent = std::get(*event); UNIT_ASSERT_VALUES_EQUAL(dataEvent.GetMessages().size(), 1); UNIT_ASSERT_VALUES_EQUAL(dataEvent.GetMessages()[0].GetData(), content); - Cerr << DebugString(*event) << Endl; + std::cerr << DebugString(*event) << std::endl; return event; }; @@ -893,7 +893,7 @@ Y_UNIT_TEST_SUITE(PersQueueSdkReadSessionTest) { std::optional event = session->GetEvent(true); UNIT_ASSERT(event); Y_ASSERT(std::holds_alternative(*event)); - Cerr << DebugString(*event) << Endl; + std::cerr << DebugString(*event) << std::endl; } auto eventFuture = session->WaitEvent(); @@ -1221,7 +1221,7 @@ Y_UNIT_TEST_SUITE(ReadSessionImplTest) { UNIT_ASSERT(event); UNIT_ASSERT_EVENT_TYPE(*event, TReadSessionEvent::TDataReceivedEvent); auto& dataEvent = std::get(*event); - Cerr << dataEvent.DebugString() << "\n"; + std::cerr << dataEvent.DebugString() << "\n"; UNIT_ASSERT_VALUES_EQUAL(dataEvent.GetMessages().size(), 3); UNIT_ASSERT_EXCEPTION(dataEvent.GetMessages()[0].GetData(), TZLibDecompressorError); UNIT_ASSERT_VALUES_EQUAL(dataEvent.GetMessages()[1].GetData(), "message2"); @@ -1316,8 +1316,8 @@ Y_UNIT_TEST_SUITE(ReadSessionImplTest) { const std::string messageData = GenerateMessageData(messageSize); const std::string compressedMessageData = Compress(messageData); - Cerr << "Message data size: " << messageData.size() << Endl; - Cerr << "Compressed message data size: " << compressedMessageData.size() << Endl; + std::cerr << "Message data size: " << messageData.size() << std::endl; + std::cerr << "Compressed message data size: " << compressedMessageData.size() << std::endl; ui64 offset = 1; ui64 seqNo = 42; THashSet committedCookies; @@ -1328,7 +1328,7 @@ Y_UNIT_TEST_SUITE(ReadSessionImplTest) { committedCookies.insert(commit.partition_cookie()); } for (const auto& range : req.offset_ranges()) { - Cerr << "GOT RANGE " << range.start_offset() << " " << range.end_offset() << "\n"; + std::cerr << "GOT RANGE " << range.start_offset() << " " << range.end_offset() << "\n"; for (ui64 i = range.start_offset(); i < range.end_offset(); ++i) { committedOffsets.insert(i); } @@ -1350,11 +1350,11 @@ Y_UNIT_TEST_SUITE(ReadSessionImplTest) { ui64 prevOffset = 0; ui64 prevSeqNo = 41; for (size_t i = 0; i < batches; ++i) { - Cerr << "Getting new event" << Endl; + std::cerr << "Getting new event" << std::endl; std::optional event = setup.EventsQueue->GetEvent(true, batchLimit); UNIT_ASSERT(event); UNIT_ASSERT_EVENT_TYPE(*event, TReadSessionEvent::TDataReceivedEvent); - Cerr << DebugString(*event) << Endl; + std::cerr << DebugString(*event) << std::endl; auto& dataEvent = std::get(*event); UNIT_ASSERT_VALUES_EQUAL(dataEvent.GetMessages().size(), messagesInBatch); for (const auto& message : dataEvent.GetMessages()) { @@ -1563,7 +1563,7 @@ Y_UNIT_TEST_SUITE(ReadSessionImplTest) { bool has2 = false; EXPECT_CALL(*setup.MockProcessor, OnCommitRequest(_)) .WillRepeatedly(Invoke([&](const Ydb::PersQueue::V1::MigrationStreamingReadClientMessage::Commit& req) { - Cerr << "Got commit req " << req << "\n"; + std::cerr << "Got commit req " << req << "\n"; for (const auto& commit : req.cookies()) { if (commit.partition_cookie() == 1) { has1 = true; @@ -1574,7 +1574,7 @@ Y_UNIT_TEST_SUITE(ReadSessionImplTest) { } } for (const auto& range : req.offset_ranges()) { - Cerr << "RANGE " << range.start_offset() << " " << range.end_offset() << "\n"; + std::cerr << "RANGE " << range.start_offset() << " " << range.end_offset() << "\n"; if (range.start_offset() == 10 && range.end_offset() == 12) has1 = true; else if (range.start_offset() == 0 && range.end_offset() == 10) has2 = true; else UNIT_ASSERT(false); @@ -1586,7 +1586,7 @@ Y_UNIT_TEST_SUITE(ReadSessionImplTest) { UNIT_ASSERT(event); UNIT_ASSERT_EVENT_TYPE(*event, TReadSessionEvent::TDataReceivedEvent); TReadSessionEvent::TDataReceivedEvent& dataEvent = std::get(*event); - Cerr << "got data event: " << dataEvent.DebugString() << "\n"; + std::cerr << "got data event: " << dataEvent.DebugString() << "\n"; dataEvent.Commit(); i += dataEvent.GetMessagesCount(); @@ -1628,7 +1628,7 @@ Y_UNIT_TEST_SUITE(ReadSessionImplTest) { settings.EventHandlers_.SimpleDataHandlers([&](TReadSessionEvent::TDataReceivedEvent& event) { for (auto& message: event.GetMessages()) { ++time; - Cerr << "GOT MESSAGE: " << message.DebugString(true) << "\n"; + std::cerr << "GOT MESSAGE: " << message.DebugString(true) << "\n"; UNIT_ASSERT_VALUES_EQUAL(message.GetData(), TYdbStringBuilder() << "message" << time); if (time == 3) { calledPromise.SetValue(); diff --git a/client/ydb_persqueue_core/ut/retry_policy_ut.cpp b/client/ydb_persqueue_core/ut/retry_policy_ut.cpp index 58cb669963b..3c5251dd5e4 100644 --- a/client/ydb_persqueue_core/ut/retry_policy_ut.cpp +++ b/client/ydb_persqueue_core/ut/retry_policy_ut.cpp @@ -19,9 +19,9 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { auto doBreakDown = [&] () { helper.Policy->ExpectBreakDown(); NThreading::TPromise retriesPromise = NThreading::NewPromise(); - Cerr << "WAIT for retries...\n"; + std::cerr << "WAIT for retries...\n"; helper.Policy->WaitForRetries(30, retriesPromise); - Cerr << "KICK tablets\n"; + std::cerr << "KICK tablets\n"; helper.Setup->KickTablets(); auto f1 = helper.Write(false); @@ -29,19 +29,19 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { auto retriesFuture = retriesPromise.GetFuture(); retriesFuture.Wait(); - Cerr << "WAIT for retries done\n"; + std::cerr << "WAIT for retries done\n"; NThreading::TPromise repairPromise = NThreading::NewPromise(); auto repairFuture = repairPromise.GetFuture(); helper.Policy->WaitForRepair(repairPromise); - Cerr << "ALLOW tablets\n"; + std::cerr << "ALLOW tablets\n"; helper.Setup->AllowTablets(); - Cerr << "WAIT for repair\n"; + std::cerr << "WAIT for repair\n"; repairFuture.Wait(); - Cerr << "REPAIR done\n"; + std::cerr << "REPAIR done\n"; f1.Wait(); f2.Wait(); helper.Write(true); @@ -82,29 +82,29 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { retryPolicy->ExpectBreakDown(); auto& client = setup1->GetPersQueueClient(); - Cerr << "=== Create write session \n"; + std::cerr << "=== Create write session \n"; auto writer = client.CreateWriteSession(settings); NThreading::TPromise retriesPromise = NThreading::NewPromise(); auto retriesFuture = retriesPromise.GetFuture(); retryPolicy->WaitForRetries(3, retriesPromise); - Cerr << "=== Wait retries\n"; + std::cerr << "=== Wait retries\n"; retriesFuture.Wait(); - Cerr << "=== Enable dc2\n"; + std::cerr << "=== Enable dc2\n"; setup1->EnableDataCenter("dc2"); NThreading::TPromise repairPromise = NThreading::NewPromise(); auto repairFuture = repairPromise.GetFuture(); retryPolicy->WaitForRepair(repairPromise); - Cerr << "=== Wait for repair\n"; + std::cerr << "=== Wait for repair\n"; repairFuture.Wait(); - Cerr << "=== Close writer\n"; + std::cerr << "=== Close writer\n"; writer->Close(); } Y_UNIT_TEST(TWriteSession_SwitchBackToLocalCluster) { - Cerr << "====Start test\n"; + std::cerr << "====Start test\n"; auto setup1 = std::make_shared(TEST_CASE_NAME, false); SDKTestSetup setup2("SwitchBackToLocalCluster", false); @@ -113,14 +113,14 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { setup1->AddDataCenter("dc2", setup2, true); setup1->Start(); setup2.Start(false); - Cerr << "=== Start session 1\n"; + std::cerr << "=== Start session 1\n"; auto helper = MakeHolder("", nullptr, std::string(), setup1); helper->Write(true); auto retryPolicy = helper->Policy; retryPolicy->Initialize(); auto waitForReconnect = [&](bool enable) { - Cerr << "=== Expect breakdown\n"; + std::cerr << "=== Expect breakdown\n"; retryPolicy->ExpectBreakDown(); NThreading::TPromise retriesPromise = NThreading::NewPromise(); @@ -132,11 +132,11 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { retryPolicy->WaitForRepair(repairPromise); if (enable) { - Cerr << "===Enabled DC1\n"; + std::cerr << "===Enabled DC1\n"; setup1->EnableDataCenter("dc1"); setup2.EnableDataCenter("dc1"); } else { - Cerr << "===Disabled DC1\n"; + std::cerr << "===Disabled DC1\n"; setup1->DisableDataCenter("dc1"); setup2.DisableDataCenter("dc1"); } @@ -145,9 +145,9 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { retriesFuture.Wait(); repairFuture.Wait(); }; - Cerr << "===Wait for 1st reconnect\n"; + std::cerr << "===Wait for 1st reconnect\n"; waitForReconnect(false); - Cerr << "===Wait for 2nd reconnect\n"; + std::cerr << "===Wait for 2nd reconnect\n"; waitForReconnect(true); } @@ -169,14 +169,14 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { auto& client = setup1->GetPersQueueClient(); //! Fill data in dc1 1 with SeqNo = 1..10 for 2 different SrcId - Cerr << "===Write 10 messages into every writer\n"; + std::cerr << "===Write 10 messages into every writer\n"; for (auto i = 0; i != 10; i++) { writer1->Write(true); // 1 writer2->Write(true); // 1 } - Cerr << "===Messages were written\n"; + std::cerr << "===Messages were written\n"; - Cerr << "===Disable dc1\n"; + std::cerr << "===Disable dc1\n"; //! Leave only dc2 available writer1->Policy->ExpectBreakDown(); writer2->Policy->ExpectBreakDown(); @@ -184,17 +184,17 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { writer1->Policy->WaitForRetriesSync(1); writer2->Policy->WaitForRetriesSync(1); - Cerr << "===Recreate writers\n"; + std::cerr << "===Recreate writers\n"; //! Re-create writers, kill previous sessions. New sessions will connect to dc2. writer1 = MakeHolder("", nullptr, std::string(), setup1, sourceId1, true); writer2 = MakeHolder("", nullptr, std::string(), setup1, sourceId2, true); //! Write some data and await confirmation - just to ensure sessions are started. - Cerr << "===Write one message into every writer\n"; + std::cerr << "===Write one message into every writer\n"; writer1->Write(true); writer2->Write(true); - Cerr << "===Messages were written\n"; + std::cerr << "===Messages were written\n"; //! Leave no available DCs writer1->Policy->ExpectBreakDown(); @@ -202,14 +202,14 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { writer1->Policy->Initialize(); writer2->Policy->Initialize(); - Cerr << "===Disable dc2\n"; + std::cerr << "===Disable dc2\n"; setup1->DisableDataCenter("dc2"); - Cerr << "===Wait for retries after initial dc2 shutdown\n"; + std::cerr << "===Wait for retries after initial dc2 shutdown\n"; writer1->Policy->WaitForRetriesSync(1); writer2->Policy->WaitForRetriesSync(1); //! Put some data inflight. It cannot be written now, but SeqNo will be assigned. - Cerr << "===Write four async message into every writer\n"; + std::cerr << "===Write four async message into every writer\n"; for (auto i = 0; i != 3; i++) { writer1->Write(false); writer2->Write(false); @@ -220,46 +220,46 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { //! Enable DC1. Now writers gonna write collected data to DC1 having LastSeqNo = 10 //! (because of data written in the very beginning), and inflight data has SeqNo assigned = 2..5, //! so the SeqNo shift takes place. - Cerr << "===Enable dc2\n"; + std::cerr << "===Enable dc2\n"; setup1->EnableDataCenter("dc1"); - Cerr << "===Wait for writes to complete\n"; + std::cerr << "===Wait for writes to complete\n"; f1.Wait(); f2.Wait(); - Cerr << "===Messages were written\n"; + std::cerr << "===Messages were written\n"; //! Writer1 is not used any more. writer1->EventLoop->AllowStop(); writer1 = nullptr; - Cerr << "===Writer 1 closed\n"; + std::cerr << "===Writer 1 closed\n"; writer2->Policy->ExpectBreakDown(); writer2->Policy->Initialize(); //! For the second writer, do switchback to dc2. - Cerr << "===Disable dc1\n"; + std::cerr << "===Disable dc1\n"; setup1->DisableDataCenter("dc1"); - Cerr << "===Wait for retries after dc1 shutdown\n"; + std::cerr << "===Wait for retries after dc1 shutdown\n"; writer2->Policy->WaitForRetriesSync(1); //! Put some data inflight again; - Cerr << "===Write four async messages into writer2\n"; + std::cerr << "===Write four async messages into writer2\n"; for (auto i = 0; i != 3; i++) { writer2->Write(false); } f2 = writer2->Write(false); - Cerr << "===Enable dc2\n"; + std::cerr << "===Enable dc2\n"; setup1->EnableDataCenter("dc2"); f2.Wait(); - Cerr << "===Messages were written\n"; + std::cerr << "===Messages were written\n"; writer2->EventLoop->AllowStop(); writer2->Policy->ExpectBreakDown(); writer2 = nullptr; - Cerr << "===Enable dc1\n"; + std::cerr << "===Enable dc1\n"; setup1->EnableDataCenter("dc1"); auto CheckSeqNo = [&] (const std::string& dcName, ui64 expectedSeqNo) { settings.PreferredCluster(dcName); @@ -274,17 +274,17 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { //!check SeqNo in both DC. For writer1 We expect 14 messages in DC1 //! (10 written initially + 4 written after reconnect) and 1 message in DC2 (only initial message). settings.MessageGroupId(sourceId1); - Cerr << "===Check SeqNo writer1, dc2\n"; + std::cerr << "===Check SeqNo writer1, dc2\n"; CheckSeqNo("dc2", 1); - Cerr << "===Check SeqNo writer1, dc1\n"; + std::cerr << "===Check SeqNo writer1, dc1\n"; CheckSeqNo("dc1", 14); //! Check SeqNo for writer 2; Expect to have 6 messages on DC2 with MaxSeqNo = 6; settings.MessageGroupId(sourceId2); - Cerr << "===Check SeqNo writer2 dc1\n"; + std::cerr << "===Check SeqNo writer2 dc1\n"; CheckSeqNo("dc1", 14); //! DC2 has no shift in SeqNo since 5 messages were written to dc 1. - Cerr << "===Check SeqNo writer2 dc2\n"; + std::cerr << "===Check SeqNo writer2 dc2\n"; CheckSeqNo("dc2", 9); @@ -309,11 +309,11 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { ui32 clustersPendingSrc2 = 2; while (!stop && (clustersPendingSrc2 || clustersPendingSrc1)) { - Cerr << "===Get event on client\n"; + std::cerr << "===Get event on client\n"; auto event = *readSession->GetEvent(true); std::visit(TOverloaded { [&](TReadSessionEvent::TDataReceivedEvent& event) { - Cerr << "===Data event\n"; + std::cerr << "===Data event\n"; auto& clusterName = event.GetPartitionStream()->GetCluster(); for (auto& message: event.GetMessages()) { std::string sourceId = message.GetMessageGroupId(); @@ -361,15 +361,15 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { event.Confirm(); }, [&](TReadSessionEvent::TPartitionStreamStatusEvent&) { - Cerr << "===Status event\n"; + std::cerr << "===Status event\n"; UNIT_FAIL("Test does not support lock sessions yet"); }, [&](TReadSessionEvent::TPartitionStreamClosedEvent&) { - Cerr << "===Stream closed event\n"; + std::cerr << "===Stream closed event\n"; UNIT_FAIL("Test does not support lock sessions yet"); }, [&](TSessionClosedEvent& event) { - Cerr << "===Got close event: " << event.DebugString(); + std::cerr << "===Got close event: " << event.DebugString(); stop = true; } @@ -387,7 +387,7 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { auto& client = setup->GetPersQueueClient(); auto writer = client.CreateWriteSession(settings); auto event = *writer->GetEvent(true); - Cerr << NYdb::NPersQueue::DebugString(event) << "\n"; + std::cerr << NYdb::NPersQueue::DebugString(event) << "\n"; UNIT_ASSERT(std::holds_alternative(event)); auto continueToken = std::move(std::get(event).ContinuationToken); std::string message = "1234567890"; @@ -398,7 +398,7 @@ Y_UNIT_TEST_SUITE(RetryPolicy) { retryPolicy->WaitForRetriesSync(3); while (seqNo < 10) { auto event = *writer->GetEvent(true); - Cerr << NYdb::NPersQueue::DebugString(event) << "\n"; + std::cerr << NYdb::NPersQueue::DebugString(event) << "\n"; UNIT_ASSERT(std::holds_alternative(event)); writer->Write( std::move(std::get(event).ContinuationToken), diff --git a/client/ydb_persqueue_core/ut/ut_utils/sdk_test_setup.h b/client/ydb_persqueue_core/ut/ut_utils/sdk_test_setup.h index eea12bc8475..d1872b9089e 100644 --- a/client/ydb_persqueue_core/ut/ut_utils/sdk_test_setup.h +++ b/client/ydb_persqueue_core/ut/ut_utils/sdk_test_setup.h @@ -37,7 +37,7 @@ class SDKTestSetup { void InitOptions(ui32 nodeCount = NKikimr::NPersQueueTests::PQ_DEFAULT_NODE_COUNT) { Log.SetFormatter([testCaseName = TestCaseName](ELogPriority priority, std::string_view message) { - return TYdbStringBuilder() << TInstant::Now() << " :" << testCaseName << " " << priority << ": " << message << Endl; + return TStringBuilder() << TInstant::Now() << " :" << testCaseName << " " << priority << ": " << message << Endl; }); Server.ServerSettings.SetNodeCount(nodeCount); Server.GrpcServerOptions.SetGRpcShutdownDeadline(TDuration::Max()); diff --git a/client/ydb_persqueue_core/ut/ut_utils/test_server.h b/client/ydb_persqueue_core/ut/ut_utils/test_server.h index f42cfc6945c..df6041e8961 100644 --- a/client/ydb_persqueue_core/ut/ut_utils/test_server.h +++ b/client/ydb_persqueue_core/ut/ut_utils/test_server.h @@ -46,7 +46,7 @@ class TTestServer { void StartServer(bool doClientInit = true, std::optional databaseName = std::nullopt) { Log.SetFormatter([](ELogPriority priority, std::string_view message) { - return TYdbStringBuilder() << TInstant::Now() << " " << priority << ": " << message << Endl; + return TStringBuilder() << TInstant::Now() << " " << priority << ": " << message << Endl; }); PrepareNetDataFile(); diff --git a/client/ydb_persqueue_core/ut/ut_utils/ut_utils.h b/client/ydb_persqueue_core/ut/ut_utils/ut_utils.h index b4e2f47182b..54210b80b00 100644 --- a/client/ydb_persqueue_core/ut/ut_utils/ut_utils.h +++ b/client/ydb_persqueue_core/ut/ut_utils/ut_utils.h @@ -201,7 +201,7 @@ struct TYdbPqTestRetryState : NYdb::NPersQueue::IRetryPolicy::IRetryState { {} std::optional GetNextRetryDelay(NYdb::EStatus) override { - Cerr << "Test retry state: get retry delay\n"; + std::cerr << "Test retry state: get retry delay\n"; RetryDone(); return Delay; } @@ -226,17 +226,17 @@ struct TYdbPqTestRetryPolicy : IRetryPolicy { TYdbPqTestRetryPolicy(const TDuration& delay = TDuration::MilliSeconds(2000)) : Delay(delay) { - Cerr << "====TYdbPqTestRetryPolicy()\n"; + std::cerr << "====TYdbPqTestRetryPolicy()\n"; } IRetryState::TPtr CreateRetryState() const override { - Cerr << "====CreateRetryState\n"; + std::cerr << "====CreateRetryState\n"; if (AtomicSwap(&OnFatalBreakDown, 0)) { return std::make_unique(); } if (AtomicGet(Initialized_)) { - Cerr << "====CreateRetryState Initialized\n"; + std::cerr << "====CreateRetryState Initialized\n"; auto res = AtomicSwap(&OnBreakDown, 0); UNIT_ASSERT(res); for (size_t i = 0; i < 100; i++) { @@ -269,7 +269,7 @@ struct TYdbPqTestRetryPolicy : IRetryPolicy { } void ExpectBreakDown() { // Either TYdbPqTestRetryPolicy() or Initialize() should be called beforehand in order to set OnBreakDown=0 - Cerr << "====ExpectBreakDown\n"; + std::cerr << "====ExpectBreakDown\n"; for (size_t i = 0; i < 100; i++) { if (AtomicGet(OnBreakDown) == 0) break; @@ -335,13 +335,13 @@ class TYdbPqTestExecutor : public IAsyncExecutor { TFunction f; while (TasksQueue.Dequeue(&f)) { ++CurrentTaskId; - Cerr << "Enqueue task with id " << CurrentTaskId << Endl; + std::cerr << "Enqueue task with id " << CurrentTaskId << Endl; Tasks[CurrentTaskId] = f; } ui64 id = 0; while (ExecIdsQueue->Dequeue(&id)) { ExecIds.push(id); - Cerr << "Got ok to execute task with id " << id << Endl; + std::cerr << "Got ok to execute task with id " << id << Endl; } while (!ExecIds.empty()) { @@ -349,15 +349,15 @@ class TYdbPqTestExecutor : public IAsyncExecutor { auto iter = Tasks.find(id); if (iter == Tasks.end()) break; - Cerr << "Executing compression of " << id << Endl; + std::cerr << "Executing compression of " << id << Endl; ExecIds.pop(); try { (iter->second)(); } catch (...) { - Cerr << "Failed on compression call: " << CurrentExceptionMessage() << Endl; + std::cerr << "Failed on compression call: " << CurrentExceptionMessage() << Endl; Y_ABORT(); } - Cerr << "Compression of " << id << " Done\n"; + std::cerr << "Compression of " << id << " Done\n"; Tasks.erase(iter); } diff --git a/client/ydb_topic/ut/basic_usage_ut.cpp b/client/ydb_topic/ut/basic_usage_ut.cpp index e200ab4347c..3bba9610343 100644 --- a/client/ydb_topic/ut/basic_usage_ut.cpp +++ b/client/ydb_topic/ut/basic_usage_ut.cpp @@ -78,7 +78,7 @@ void WriteAndReadToEndWithRestarts(TReadSessionSettings readSettings, TWriteSess [&] (TReadSessionEvent::TDataReceivedEvent& ev) mutable { AtomicSet(lastOffset, ev.GetMessages().back().GetOffset()); - Cerr << ">>> TEST: last offset = " << lastOffset << Endl; + std::cerr << ">>> TEST: last offset = " << lastOffset << std::endl; }); ReadSession = topicClient.CreateReadSession(readSettings); @@ -143,24 +143,24 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .Path(TEST_TOPIC) .ProducerId(TEST_MESSAGE_GROUP_ID) .MessageGroupId(TEST_MESSAGE_GROUP_ID); - Cerr << ">>> open write session " << i << Endl; + std::cerr << ">>> open write session " << i << std::endl; auto writeSession = client.CreateSimpleBlockingWriteSession(writeSettings); UNIT_ASSERT(writeSession->Write("message_using_MessageGroupId")); - Cerr << ">>> write session " << i << " message written" << Endl; + std::cerr << ">>> write session " << i << " message written" << std::endl; writeSession->Close(); - Cerr << ">>> write session " << i << " closed" << Endl; + std::cerr << ">>> write session " << i << " closed" << std::endl; } { auto writeSettings = TWriteSessionSettings() .Path(TEST_TOPIC) .ProducerId(TEST_MESSAGE_GROUP_ID) .PartitionId(0); - Cerr << ">>> open write session 100" << Endl; + std::cerr << ">>> open write session 100" << std::endl; auto writeSession = client.CreateSimpleBlockingWriteSession(writeSettings); UNIT_ASSERT(writeSession->Write("message_using_PartitionId")); - Cerr << ">>> write session 100 message written" << Endl; + std::cerr << ">>> write session 100 message written" << std::endl; writeSession->Close(); - Cerr << ">>> write session 100 closed" << Endl; + std::cerr << ">>> write session 100 closed" << std::endl; } { @@ -278,7 +278,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { if (shouldCaptureData.Defined()) { TYdbStringBuilder msg; msg << "Session has captured " << sessionAdapter.GetAcquiredMessagesCount() - << " messages, capturing was expected: " << *shouldCaptureData << Endl; + << " messages, capturing was expected: " << *shouldCaptureData << std::endl; UNIT_ASSERT_VALUES_EQUAL_C(sessionAdapter.GetAcquiredMessagesCount() > 0, *shouldCaptureData, msg.c_str()); } } @@ -296,7 +296,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { .MaxMemoryUsageBytes(1_MB) .AppendTopics(setup->GetTestTopic()); - Cerr << "Session was created" << Endl; + std::cerr << "Session was created" << std::endl; NThreading::TPromise checkedPromise = NThreading::NewPromise(); auto totalReceived = 0u; @@ -405,7 +405,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { writeSession->Close(TDuration::Seconds(10)); } promiseToWrite.SetValue(); - Cerr << ">>>TEST: write promise set " << Endl; + std::cerr << ">>>TEST: write promise set " << std::endl; { NThreading::TPromise promise = NThreading::NewPromise(); @@ -415,7 +415,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { [promise = std::move(promise)](TReadSessionEvent::TDataReceivedEvent& ev) mutable { ev.Commit(); promise.SetValue(); - Cerr << ">>>TEST: get read event " << Endl; + std::cerr << ">>>TEST: get read event " << std::endl; }); auto readSession = topicClient.CreateReadSession(readSettings); @@ -423,7 +423,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { readSession->Close(TDuration::Seconds(10)); } promiseToRead.SetValue(); - Cerr << ">>>TEST: read promise set " << Endl; + std::cerr << ">>>TEST: read promise set " << std::endl; }); @@ -444,31 +444,31 @@ Y_UNIT_TEST_SUITE(BasicUsage) { auto RunTasks = [&](auto e, const std::vector& tasks) { size_t n = tasks.size(); - Cerr << ">>>TEST in RunTasks: before WaitPlannedTasks" << Endl; + std::cerr << ">>>TEST in RunTasks: before WaitPlannedTasks" << std::endl; WaitPlannedTasks(e, n); - Cerr << ">>>TEST in RunTasks: before WaitExecutedTasks" << Endl; + std::cerr << ">>>TEST in RunTasks: before WaitExecutedTasks" << std::endl; size_t completed = e->GetExecutedCount(); e->StartFuncs(tasks); WaitExecutedTasks(e, completed + n); }; UNIT_ASSERT(!futureWrite.HasValue()); - Cerr << ">>>TEST: future write has no value " << Endl; + std::cerr << ">>>TEST: future write has no value " << std::endl; RunTasks(stepByStepExecutor, {0}); futureWrite.GetValueSync(); UNIT_ASSERT(futureWrite.HasValue()); - Cerr << ">>>TEST: future write has value " << Endl; + std::cerr << ">>>TEST: future write has value " << std::endl; UNIT_ASSERT(!futureRead.HasValue()); - Cerr << ">>>TEST: future read has no value " << Endl; + std::cerr << ">>>TEST: future read has no value " << std::endl; RunTasks(stepByStepExecutor, {1}); futureRead.GetValueSync(); UNIT_ASSERT(futureRead.HasValue()); - Cerr << ">>>TEST: future read has value " << Endl; + std::cerr << ">>>TEST: future read has value " << std::endl; f.get(); - Cerr << ">>> TEST: gracefully closed" << Endl; + std::cerr << ">>> TEST: gracefully closed" << std::endl; } Y_UNIT_TEST(SessionNotDestroyedWhileUserEventHandlingInFlight) { @@ -516,7 +516,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { // { // std::shared_ptr token; // writeSettings.EventHandlers_.CommonHandler([token](TWriteSessionEvent::TEvent& event){ - // Cerr << ">>>TEST: in CommonHandler " << Endl; + // std::cerr << ">>>TEST: in CommonHandler " << std::endl; // if (std::holds_alternative(event)) { // *token = std::move(std::get(event).ContinuationToken); @@ -531,7 +531,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { // writeSession->Close(TDuration::Seconds(10)); // } // promiseToWrite.SetValue(); - // Cerr << ">>>TEST: write promise set " << Endl; + // std::cerr << ">>>TEST: write promise set " << std::endl; { NThreading::TPromise promise = NThreading::NewPromise(); @@ -539,7 +539,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { readSettings.EventHandlers_.SimpleDataHandlers( [promise = std::move(promise)](TReadSessionEvent::TDataReceivedEvent& ev) mutable { - Cerr << ">>>TEST: in SimpleDataHandlers " << Endl; + std::cerr << ">>>TEST: in SimpleDataHandlers " << std::endl; ev.Commit(); promise.SetValue(); }); @@ -549,7 +549,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { readSession->Close(TDuration::Seconds(10)); } promiseToRead.SetValue(); - Cerr << ">>>TEST: read promise set " << Endl; + std::cerr << ">>>TEST: read promise set " << std::endl; }); @@ -570,9 +570,9 @@ Y_UNIT_TEST_SUITE(BasicUsage) { auto RunTasks = [&](auto e, const std::vector& tasks) { size_t n = tasks.size(); - Cerr << ">>>TEST in RunTasks: before WaitPlannedTasks" << Endl; + std::cerr << ">>>TEST in RunTasks: before WaitPlannedTasks" << std::endl; WaitPlannedTasks(e, n); - Cerr << ">>>TEST in RunTasks: before WaitExecutedTasks" << Endl; + std::cerr << ">>>TEST in RunTasks: before WaitExecutedTasks" << std::endl; size_t completed = e->GetExecutedCount(); e->StartFuncs(tasks); WaitExecutedTasks(e, completed + n); @@ -580,25 +580,25 @@ Y_UNIT_TEST_SUITE(BasicUsage) { // RunTasks(stepByStepExecutor, {0}); // UNIT_ASSERT(!futureWrite.HasValue()); - // Cerr << ">>>TEST: future write has no value " << Endl; + // std::cerr << ">>>TEST: future write has no value " << std::endl; // RunTasks(stepByStepExecutor, {1}); // futureWrite.GetValueSync(); // UNIT_ASSERT(futureWrite.HasValue()); - // Cerr << ">>>TEST: future write has value " << Endl; + // std::cerr << ">>>TEST: future write has value " << std::endl; UNIT_ASSERT(!futureRead.HasValue()); - Cerr << ">>>TEST: future read has no value " << Endl; + std::cerr << ">>>TEST: future read has no value " << std::endl; // 0: TStartPartitionSessionEvent RunTasks(stepByStepExecutor, {0}); // 1: TDataReceivedEvent RunTasks(stepByStepExecutor, {1}); futureRead.GetValueSync(); UNIT_ASSERT(futureRead.HasValue()); - Cerr << ">>>TEST: future read has value " << Endl; + std::cerr << ">>>TEST: future read has value " << std::endl; f.get(); - Cerr << ">>> TEST: gracefully closed" << Endl; + std::cerr << ">>> TEST: gracefully closed" << std::endl; } Y_UNIT_TEST(ReadSessionCorrectClose) { @@ -640,11 +640,11 @@ Y_UNIT_TEST_SUITE(BasicUsage) { readSettings.EventHandlers_.SimpleDataHandlers( [] (NYdb::NTopic::TReadSessionEvent::TDataReceivedEvent& ev) mutable { - Cerr << ">>> Got TDataReceivedEvent" << Endl; + std::cerr << ">>> Got TDataReceivedEvent" << std::endl; ev.Commit(); }); - Cerr << ">>> TEST: Create session" << Endl; + std::cerr << ">>> TEST: Create session" << std::endl; ReadSession = topicClient.CreateReadSession(readSettings); @@ -652,7 +652,7 @@ Y_UNIT_TEST_SUITE(BasicUsage) { ReadSession->Close(); ReadSession = nullptr; - Cerr << ">>> TEST: Session gracefully closed" << Endl; + std::cerr << ">>> TEST: Session gracefully closed" << std::endl; Sleep(TDuration::Seconds(5)); diff --git a/client/ydb_topic/ut/local_partition_ut.cpp b/client/ydb_topic/ut/local_partition_ut.cpp index 94e1ad28630..7431b1281ab 100644 --- a/client/ydb_topic/ut/local_partition_ut.cpp +++ b/client/ydb_topic/ut/local_partition_ut.cpp @@ -51,7 +51,7 @@ namespace NYdb::NTopic::NTests { void WriteMessage(TTopicClient& client) { - Cerr << "=== Write message" << Endl; + std::cerr << "=== Write message" << std::endl; auto writeSession = client.CreateSimpleBlockingWriteSession(CreateWriteSessionSettings()); UNIT_ASSERT(writeSession->Write("message")); @@ -60,7 +60,7 @@ namespace NYdb::NTopic::NTests { void ReadMessage(TTopicClient& client, ui64 expectedCommitedOffset = 1) { - Cerr << "=== Read message" << Endl; + std::cerr << "=== Read message" << std::endl; auto readSession = client.CreateReadSession(CreateReadSessionSettings()); @@ -103,13 +103,13 @@ namespace NYdb::NTopic::NTests { { ui16 discoveryPort = TPortManager().GetPort(); DiscoveryAddr = TYdbStringBuilder() << "0.0.0.0:" << discoveryPort; - Cerr << "==== TMockDiscovery server started on port " << discoveryPort << Endl; + std::cerr << "==== TMockDiscovery server started on port " << discoveryPort << std::endl; Server = ::NYdb::NTopic::NTests::NTestSuiteLocalPartition::StartGrpcServer(DiscoveryAddr, *this); } void SetGoodEndpoints(TTopicSdkTestSetup& setup) { - Cerr << "=== TMockDiscovery set good endpoint nodes " << Endl; + std::cerr << "=== TMockDiscovery set good endpoint nodes " << std::endl; SetEndpoints(setup.GetRuntime().GetNodeId(0), setup.GetRuntime().GetNodeCount(), setup.GetServer().GrpcPort); } @@ -117,7 +117,7 @@ namespace NYdb::NTopic::NTests { { std::lock_guard lock(Lock); - Cerr << "==== TMockDiscovery add endpoints, firstNodeId " << firstNodeId << ", nodeCount " << nodeCount << ", port " << port << Endl; + std::cerr << "==== TMockDiscovery add endpoints, firstNodeId " << firstNodeId << ", nodeCount " << nodeCount << ", port " << port << std::endl; MockResults.clear_endpoints(); if (nodeCount > 0) @@ -146,7 +146,7 @@ namespace NYdb::NTopic::NTests { if (Delay) { - Cerr << "==== Delay " << Delay << " before ListEndpoints request" << Endl; + std::cerr << "==== Delay " << Delay << " before ListEndpoints request" << std::endl; TInstant start = TInstant::Now(); while (start + Delay < TInstant::Now()) { @@ -156,14 +156,14 @@ namespace NYdb::NTopic::NTests { } } - Cerr << "==== ListEndpoints request: " << request->ShortDebugString() << Endl; + std::cerr << "==== ListEndpoints request: " << request->ShortDebugString() << std::endl; auto* op = response->mutable_operation(); op->set_ready(true); op->set_status(Ydb::StatusIds::SUCCESS); op->mutable_result()->PackFrom(MockResults); - Cerr << "==== ListEndpoints response: " << response->ShortDebugString() << Endl; + std::cerr << "==== ListEndpoints response: " << response->ShortDebugString() << std::endl; return grpc::Status::OK; } @@ -218,7 +218,7 @@ namespace NYdb::NTopic::NTests { auto [setup, client, discovery] = Start(TEST_CASE_NAME); for (size_t i = 1; i <= 10; ++i) { - Cerr << "=== Restart attempt " << i << Endl; + std::cerr << "=== Restart attempt " << i << std::endl; setup->GetServer().KillTopicPqTablets(setup->GetTopicPath()); WriteMessage(*client); ReadMessage(*client, i); @@ -242,23 +242,23 @@ namespace NYdb::NTopic::NTests { retryPolicy->Initialize(); retryPolicy->ExpectBreakDown(); - Cerr << "=== Create write session\n"; + std::cerr << "=== Create write session\n"; TTopicClient client(TDriver(CreateConfig(*setup, discovery.GetDiscoveryAddr()))); auto writeSession = client.CreateWriteSession(writeSettings); - Cerr << "=== Wait for retries\n"; + std::cerr << "=== Wait for retries\n"; retryPolicy->WaitForRetriesSync(3); - Cerr << "=== Alter partition count\n"; + std::cerr << "=== Alter partition count\n"; TAlterTopicSettings alterSettings; alterSettings.AlterPartitioningSettings(2, 2); auto alterResult = client.AlterTopic(setup->GetTopicPath(), alterSettings).GetValueSync(); UNIT_ASSERT_VALUES_EQUAL_C(alterResult.GetStatus(), NYdb::EStatus::SUCCESS, alterResult.GetIssues().ToString()); - Cerr << "=== Wait for repair\n"; + std::cerr << "=== Wait for repair\n"; retryPolicy->WaitForRepairSync(); - Cerr << "=== Close write session\n"; + std::cerr << "=== Close write session\n"; writeSession->Close(); } @@ -276,19 +276,19 @@ namespace NYdb::NTopic::NTests { retryPolicy->Initialize(); retryPolicy->ExpectBreakDown(); - Cerr << "=== Create write session\n"; + std::cerr << "=== Create write session\n"; TTopicClient client(TDriver(CreateConfig(*setup, discovery.GetDiscoveryAddr()))); auto writeSession = client.CreateWriteSession(writeSettings); - Cerr << "=== Wait for retries\n"; + std::cerr << "=== Wait for retries\n"; retryPolicy->WaitForRetriesSync(3); discovery.SetGoodEndpoints(*setup); - Cerr << "=== Wait for repair\n"; + std::cerr << "=== Wait for repair\n"; retryPolicy->WaitForRepairSync(); - Cerr << "=== Close write session\n"; + std::cerr << "=== Close write session\n"; writeSession->Close(); } @@ -306,19 +306,19 @@ namespace NYdb::NTopic::NTests { retryPolicy->Initialize(); retryPolicy->ExpectBreakDown(); - Cerr << "=== Create write session\n"; + std::cerr << "=== Create write session\n"; TTopicClient client(TDriver(CreateConfig(*setup, discovery.GetDiscoveryAddr()))); auto writeSession = client.CreateWriteSession(writeSettings); - Cerr << "=== Wait for retries\n"; + std::cerr << "=== Wait for retries\n"; retryPolicy->WaitForRetriesSync(3); discovery.SetGoodEndpoints(*setup); - Cerr << "=== Wait for repair\n"; + std::cerr << "=== Wait for repair\n"; retryPolicy->WaitForRepairSync(); - Cerr << "=== Close write session\n"; + std::cerr << "=== Close write session\n"; writeSession->Close(); } @@ -336,11 +336,11 @@ namespace NYdb::NTopic::NTests { retryPolicy->Initialize(); retryPolicy->ExpectBreakDown(); - Cerr << "=== Create write session\n"; + std::cerr << "=== Create write session\n"; TTopicClient client(TDriver(CreateConfig(*setup, discovery.GetDiscoveryAddr()))); auto writeSession = client.CreateWriteSession(writeSettings); - Cerr << "=== Close write session\n"; + std::cerr << "=== Close write session\n"; writeSession->Close(); } @@ -351,11 +351,11 @@ namespace NYdb::NTopic::NTests { discovery.SetGoodEndpoints(*setup); discovery.SetDelay(TDuration::Days(1)); - Cerr << "=== Create write session\n"; + std::cerr << "=== Create write session\n"; TTopicClient client(TDriver(CreateConfig(*setup, discovery.GetDiscoveryAddr()))); auto writeSession = client.CreateWriteSession(CreateWriteSessionSettings()); - Cerr << "=== Close write session\n"; + std::cerr << "=== Close write session\n"; writeSession->Close(); } } diff --git a/client/ydb_topic/ut/ut_utils/topic_sdk_test_setup.cpp b/client/ydb_topic/ut/ut_utils/topic_sdk_test_setup.cpp index 77130c8f310..74a0977e89e 100644 --- a/client/ydb_topic/ut/ut_utils/topic_sdk_test_setup.cpp +++ b/client/ydb_topic/ut/ut_utils/topic_sdk_test_setup.cpp @@ -9,7 +9,7 @@ TTopicSdkTestSetup::TTopicSdkTestSetup(const std::string& testCaseName, const NK , Server(settings, false) { Log.SetFormatter([testCaseName](ELogPriority priority, std::string_view message) { - return TYdbStringBuilder() << TInstant::Now() << " :" << testCaseName << " " << priority << ": " << message << Endl; + return TStringBuilder() << TInstant::Now() << " :" << testCaseName << " " << priority << ": " << message << Endl; }); Server.StartServer(true, GetDatabase()); diff --git a/examples/basic_example/basic_example.cpp b/examples/basic_example/basic_example.cpp index 44a37d05954..1464b3709c6 100644 --- a/examples/basic_example/basic_example.cpp +++ b/examples/basic_example/basic_example.cpp @@ -22,8 +22,8 @@ static void ThrowOnError(const TStatus& status) { } static void PrintStatus(const TStatus& status) { - Cerr << "Status: " << status.GetStatus() << Endl; - status.GetIssues().PrintTo(Cerr); + std::cerr << "Status: " << ToString(status.GetStatus()) << std::endl; + std::cerr << status.GetIssues().ToString(); } static std::string JoinPath(const std::string& basePath, const std::string& path) { @@ -95,9 +95,9 @@ static void DescribeTable(TTableClient client, const std::string& path, const st return result; })); - Cout << "> Describe table: " << name << Endl; + std::cout << "> Describe table: " << name << std::endl; for (auto& column : desc->GetColumns()) { - Cout << "Column, name: " << column.Name << ", type: " << FormatType(column.Type) << Endl; + std::cout << "Column, name: " << column.Name << ", type: " << FormatType(column.Type) << std::endl; } } @@ -272,7 +272,7 @@ static TStatus PreparedSelectTransaction(TSession session, const std::string& pa } if (!prepareResult.IsQueryFromCache()) { - Cerr << "+Finished preparing query: PreparedSelectTransaction" << Endl; + std::cerr << "+Finished preparing query: PreparedSelectTransaction" << std::endl; } auto dataQuery = prepareResult.GetQuery(); @@ -441,11 +441,11 @@ void SelectSimple(TTableClient client, const std::string& path) { TResultSetParser parser(*resultSet); if (parser.TryNextRow()) { - Cout << "> SelectSimple:" << Endl << "Series" - << ", Id: " << parser.ColumnParser("series_id").GetOptionalUint64() - << ", Title: " << parser.ColumnParser("title").GetOptionalUtf8() - << ", Release date: " << parser.ColumnParser("release_date").GetOptionalString() - << Endl; + std::cout << "> SelectSimple:" << std::endl << "Series" + << ", Id: " << ToString(parser.ColumnParser("series_id").GetOptionalUint64()) + << ", Title: " << ToString(parser.ColumnParser("title").GetOptionalUtf8()) + << ", Release date: " << ToString(parser.ColumnParser("release_date").GetOptionalString()) + << std::endl; } } @@ -463,10 +463,10 @@ void SelectWithParams(TTableClient client, const std::string& path) { TResultSetParser parser(*resultSet); if (parser.TryNextRow()) { - Cout << "> SelectWithParams:" << Endl << "Season" - << ", Title: " << parser.ColumnParser("season_title").GetOptionalUtf8() - << ", Series title: " << parser.ColumnParser("series_title").GetOptionalUtf8() - << Endl; + std::cout << "> SelectWithParams:" << std::endl << "Season" + << ", Title: " << ToString(parser.ColumnParser("season_title").GetOptionalUtf8()) + << ", Series title: " << ToString(parser.ColumnParser("series_title").GetOptionalUtf8()) + << std::endl; } } @@ -480,10 +480,10 @@ void PreparedSelect(TTableClient client, const std::string& path, ui32 seriesId, if (parser.TryNextRow()) { auto airDate = TInstant::Days(*parser.ColumnParser("air_date").GetOptionalUint64()); - Cout << "> PreparedSelect:" << Endl << "Episode " << parser.ColumnParser("episode_id").GetOptionalUint64() - << ", Title: " << parser.ColumnParser("title").GetOptionalUtf8() + std::cout << "> PreparedSelect:" << std::endl << "Episode " << ToString(parser.ColumnParser("episode_id").GetOptionalUint64()) + << ", Title: " << ToString(parser.ColumnParser("title").GetOptionalUtf8()) << ", Air date: " << airDate.FormatLocalTime("%a %b %d, %Y") - << Endl; + << std::endl; } } @@ -494,15 +494,15 @@ void MultiStep(TTableClient client, const std::string& path) { })); TResultSetParser parser(*resultSet); - Cout << "> MultiStep:" << Endl; + std::cout << "> MultiStep:" << std::endl; while (parser.TryNextRow()) { auto airDate = TInstant::Days(*parser.ColumnParser("air_date").GetOptionalUint64()); - Cout << "Episode " << parser.ColumnParser("episode_id").GetOptionalUint64() - << ", Season: " << parser.ColumnParser("season_id").GetOptionalUint64() - << ", Title: " << parser.ColumnParser("title").GetOptionalUtf8() + std::cout << "Episode " << ToString(parser.ColumnParser("episode_id").GetOptionalUint64()) + << ", Season: " << ToString(parser.ColumnParser("season_id").GetOptionalUint64()) + << ", Title: " << ToString(parser.ColumnParser("title").GetOptionalUtf8()) << ", Air date: " << airDate.FormatLocalTime("%a %b %d, %Y") - << Endl; + << std::endl; } } @@ -536,19 +536,19 @@ void ScanQuerySelect(TTableClient client, const std::string& path) { auto result = client.StreamExecuteScanQuery(query, parameters).GetValueSync(); if (!result.IsSuccess()) { - Cerr << "ScanQuery execution failure: " << result.GetIssues().ToString() << Endl; + std::cerr << "ScanQuery execution failure: " << result.GetIssues().ToString() << std::endl; return; } bool eos = false; - Cout << "> ScanQuerySelect:" << Endl; + std::cout << "> ScanQuerySelect:" << std::endl; while (!eos) { auto streamPart = result.ReadNext().ExtractValueSync(); if (!streamPart.IsSuccess()) { eos = true; if (!streamPart.EOS()) { - Cerr << "ScanQuery execution failure: " << streamPart.GetIssues().ToString() << Endl; + std::cerr << "ScanQuery execution failure: " << streamPart.GetIssues().ToString() << std::endl; } continue; } @@ -559,12 +559,12 @@ void ScanQuerySelect(TTableClient client, const std::string& path) { TResultSetParser parser(rs); while (parser.TryNextRow()) { - Cout << "Season" - << ", SeriesId: " << parser.ColumnParser("series_id").GetOptionalUint64() - << ", SeasonId: " << parser.ColumnParser("season_id").GetOptionalUint64() - << ", Title: " << parser.ColumnParser("title").GetOptionalUtf8() - << ", Air date: " << parser.ColumnParser("first_aired").GetOptionalString() - << Endl; + std::cout << "Season" + << ", SeriesId: " << ToString(parser.ColumnParser("series_id").GetOptionalUint64()) + << ", SeasonId: " << ToString(parser.ColumnParser("season_id").GetOptionalUint64()) + << ", Title: " << ToString(parser.ColumnParser("title").GetOptionalUtf8()) + << ", Air date: " << ToString(parser.ColumnParser("first_aired").GetOptionalString()) + << std::endl; } } } @@ -601,7 +601,7 @@ bool Run(const TDriver& driver, const std::string& path) { ScanQuerySelect(client, path); } catch (const TYdbErrorException& e) { - Cerr << "Execution failed due to fatal error:" << Endl; + std::cerr << "Execution failed due to fatal error:" << std::endl; PrintStatus(e.Status); return false; } diff --git a/examples/bulk_upsert_simple/main.cpp b/examples/bulk_upsert_simple/main.cpp index b6b73ba81bd..167ef001b35 100644 --- a/examples/bulk_upsert_simple/main.cpp +++ b/examples/bulk_upsert_simple/main.cpp @@ -58,14 +58,14 @@ bool WriteLogBatch(NYdb::NTable::TTableClient& tableClient, const std::string& t auto status = tableClient.RetryOperationSync(bulkUpsertOperation, retrySettings); if (!status.IsSuccess()) { - Cerr << Endl << "Write failed with status: " << (const NYdb::TStatus&)status << Endl; + std::cerr << std::endl << "Write failed with status: " << ToString((const NYdb::TStatus&)status) << std::endl; return false; } return true; } bool CreateLogTable(NYdb::NTable::TTableClient& client, const std::string& table) { - Cerr << "Create table " << table << "\n"; + std::cerr << "Create table " << table << "\n"; NYdb::NTable::TRetryOperationSettings settings; auto status = client.RetryOperationSync([&table](NYdb::NTable::TSession session) { @@ -82,7 +82,7 @@ bool CreateLogTable(NYdb::NTable::TTableClient& client, const std::string& table }, settings); if (!status.IsSuccess()) { - Cerr << "Create table failed with status: " << status << Endl; + std::cerr << "Create table failed with status: " << ToString(status) << std::endl; return false; } return true; @@ -105,10 +105,10 @@ bool Run(const NYdb::TDriver &driver, const std::string &table, ui32 batchCount) if (!WriteLogBatch(client, table, logBatch, writeRetrySettings)) { return false; } - Cerr << "."; + std::cerr << "."; } - Cerr << Endl << "Done." << Endl; + std::cerr << std::endl << "Done." << std::endl; return true; } diff --git a/examples/pagination/pagination.cpp b/examples/pagination/pagination.cpp index 659bab796a1..9a13cd2cca5 100644 --- a/examples/pagination/pagination.cpp +++ b/examples/pagination/pagination.cpp @@ -22,8 +22,8 @@ static void ThrowOnError(const TStatus& status) { } static void PrintStatus(const TStatus& status) { - Cerr << "Status: " << status.GetStatus() << Endl; - status.GetIssues().PrintTo(Cerr); + std::cerr << "Status: " << ToString(status.GetStatus()) << std::endl; + std::cerr << status.GetIssues().ToString(); } static std::string JoinPath(const std::string& basePath, const std::string& path) { @@ -150,7 +150,7 @@ bool SelectPaging(TTableClient client, const std::string& path, ui64 pageLimit, do { lastCity = parser.ColumnParser("city").GetOptionalUtf8().value(); lastNumber = parser.ColumnParser("number").GetOptionalUint32().value(); - Cout << lastCity << ", Школа №" << lastNumber << ", Адрес: " << parser.ColumnParser("address").GetOptionalUtf8() << Endl; + std::cout << lastCity << ", Школа №" << lastNumber << ", Адрес: " << ToString(parser.ColumnParser("address").GetOptionalUtf8()) << std::endl; } while (parser.TryNextRow()); return true; } @@ -171,17 +171,17 @@ bool Run(const TDriver& driver, const std::string& path) { ui32 page = 0; bool pageNotEmpty = true; - Cout << "> Pagination, Limit=" << limit << Endl; + std::cout << "> Pagination, Limit=" << limit << std::endl; // show first MaxPages=10 pages: while (pageNotEmpty && page <= MaxPages) { ++page; - Cout << "> Page " << page << ":" << Endl; + std::cout << "> Page " << page << ":" << std::endl; pageNotEmpty = SelectPaging(client, path, limit, lastCity, lastNumber); } } catch (const TYdbErrorException& e) { - Cerr << "Execution failed due to fatal error:" << Endl; + std::cerr << "Execution failed due to fatal error:" << std::endl; PrintStatus(e.Status); return false; } diff --git a/examples/secondary_index/main.cpp b/examples/secondary_index/main.cpp index 2a70ada3bc2..70a540cd2e3 100644 --- a/examples/secondary_index/main.cpp +++ b/examples/secondary_index/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char** argv) { ECmd cmd = ParseCmd(*argv); if (cmd == ECmd::NONE) { - Cerr << "Unsupported command '" << *argv << "'" << Endl; + std::cerr << "Unsupported command '" << *argv << "'" << std::endl; return 1; } @@ -61,7 +61,7 @@ int main(int argc, char** argv) { return RunDeleteSeries(driver, prefix, argc, argv); } } catch (const TYdbErrorException& e) { - Cerr << "Execution failed: " << e << Endl; + std::cerr << "Execution failed: " << ToString(e) << std::endl; return 1; } diff --git a/examples/secondary_index/secondary_index_create.cpp b/examples/secondary_index/secondary_index_create.cpp index 4d6432293f4..3b0151a003b 100644 --- a/examples/secondary_index/secondary_index_create.cpp +++ b/examples/secondary_index/secondary_index_create.cpp @@ -35,7 +35,7 @@ static void CreateSeriesIndexTable(TTableClient& client, const std::string& pref int RunCreateTables(TDriver& driver, const std::string& prefix, int argc, char**) { if (argc > 1) { - Cerr << "Unexpected arguments after create_tables" << Endl; + std::cerr << "Unexpected arguments after create_tables" << std::endl; return 1; } diff --git a/examples/secondary_index/secondary_index_delete.cpp b/examples/secondary_index/secondary_index_delete.cpp index dfefb49ebea..3a1d6d76414 100644 --- a/examples/secondary_index/secondary_index_delete.cpp +++ b/examples/secondary_index/secondary_index_delete.cpp @@ -74,6 +74,6 @@ int RunDeleteSeries(TDriver& driver, const std::string& prefix, int argc, char** return DeleteSeries(session, prefix, seriesId, deletedCount); })); - Cout << "Deleted " << deletedCount << " rows" << Endl; + std::cout << "Deleted " << deletedCount << " rows" << std::endl; return 0; } diff --git a/examples/secondary_index/secondary_index_drop.cpp b/examples/secondary_index/secondary_index_drop.cpp index 4ab3f70ff74..c6b7f84ca67 100644 --- a/examples/secondary_index/secondary_index_drop.cpp +++ b/examples/secondary_index/secondary_index_drop.cpp @@ -14,7 +14,7 @@ static void DropTable(TTableClient& client, const std::string& path) { int RunDropTables(TDriver& driver, const std::string& prefix, int argc, char**) { if (argc > 1) { - Cerr << "Unexpected arguments after drop_tables" << Endl; + std::cerr << "Unexpected arguments after drop_tables" << std::endl; return 1; } diff --git a/examples/secondary_index/secondary_index_generate.cpp b/examples/secondary_index/secondary_index_generate.cpp index 996bc19a672..d40696005d8 100644 --- a/examples/secondary_index/secondary_index_generate.cpp +++ b/examples/secondary_index/secondary_index_generate.cpp @@ -202,6 +202,6 @@ int RunGenerateSeries(TDriver& driver, const std::string& prefix, int argc, char } executor.Wait(); - Cout << "Generated " << generated << " new series" << Endl; + std::cout << "Generated " << generated << " new series" << std::endl; return 0; } diff --git a/examples/secondary_index/secondary_index_list.cpp b/examples/secondary_index/secondary_index_list.cpp index b6c6f62ddc9..1f09a06c648 100644 --- a/examples/secondary_index/secondary_index_list.cpp +++ b/examples/secondary_index/secondary_index_list.cpp @@ -297,27 +297,27 @@ int RunListSeries(TDriver& driver, const std::string& prefix, int argc, char** a } } auto printLine = [&]() { - Cout << '+'; + std::cout << '+'; for (size_t i = 0; i < 5; ++i) { for (size_t k = 0; k < widths[i]; ++k) { - Cout << '-'; + std::cout << '-'; } - Cout << '+'; + std::cout << '+'; } - Cout << Endl; + std::cout << std::endl; }; auto printRow = [&](size_t row) { - Cout << '|'; + std::cout << '|'; for (size_t i = 0; i < 5; ++i) { - Cout << ' ' << columns[i][row]; + std::cout << ' ' << columns[i][row]; size_t printed = 1 + GetNumberOfUTF8Chars(columns[i][row]); while (printed < widths[i]) { - Cout << ' '; + std::cout << ' '; ++printed; } - Cout << '|'; + std::cout << '|'; } - Cout << Endl; + std::cout << std::endl; }; printLine(); diff --git a/examples/secondary_index/secondary_index_update.cpp b/examples/secondary_index/secondary_index_update.cpp index 7a449476a61..e15da5649a0 100644 --- a/examples/secondary_index/secondary_index_update.cpp +++ b/examples/secondary_index/secondary_index_update.cpp @@ -82,6 +82,6 @@ int RunUpdateViews(TDriver& driver, const std::string& prefix, int argc, char** return result; })); - Cout << "Updated " << updatedCount << " rows" << Endl; + std::cout << "Updated " << updatedCount << " rows" << std::endl; return 0; } diff --git a/examples/secondary_index_builtin/main.cpp b/examples/secondary_index_builtin/main.cpp index 2e26d31019d..3bf5640c3ca 100644 --- a/examples/secondary_index_builtin/main.cpp +++ b/examples/secondary_index_builtin/main.cpp @@ -28,7 +28,7 @@ int main(int argc, char** argv) { TCommand cmd = Parse(command.c_str()); if (cmd == TCommand::NONE) { - Cerr << "Unsupported command: " << command << Endl; + std::cerr << "Unsupported command: " << command << std::endl; return 1; } @@ -56,7 +56,7 @@ int main(int argc, char** argv) { } } catch (const TYdbErrorException& e) { - Cerr << "Execution failed: " << e << Endl; + std::cerr << "Execution failed: " << ToString(e) << std::endl; return 1; } } diff --git a/examples/secondary_index_builtin/secondary_index_select.cpp b/examples/secondary_index_builtin/secondary_index_select.cpp index 620dff5b2c4..ae4264ee311 100644 --- a/examples/secondary_index_builtin/secondary_index_select.cpp +++ b/examples/secondary_index_builtin/secondary_index_select.cpp @@ -55,8 +55,8 @@ int Select(TDriver& driver, const std::string& path, int argc, char **argv) { })); for (auto& item: selectResult) { - Cout << item.SeriesId << ' ' << item.Title << ' ' << item.Info << ' ' - << item.ReleaseDate << ' ' << item.Views << ' ' << item.UploadedUserId << Endl; + std::cout << item.SeriesId << ' ' << item.Title << ' ' << item.Info << ' ' + << item.ReleaseDate.ToString() << ' ' << item.Views << ' ' << item.UploadedUserId << std::endl; } return 0; diff --git a/examples/secondary_index_builtin/secondary_index_select_join.cpp b/examples/secondary_index_builtin/secondary_index_select_join.cpp index ba3872ceb81..f93a62c167e 100644 --- a/examples/secondary_index_builtin/secondary_index_select_join.cpp +++ b/examples/secondary_index_builtin/secondary_index_select_join.cpp @@ -60,7 +60,7 @@ int SelectJoin(TDriver& driver, const std::string& path, int argc, char **argv) })); for (auto& item : selectResult) { - Cout << item.SeriesId << ' ' << item.Title << Endl; + std::cout << item.SeriesId << ' ' << item.Title << std::endl; } return 0; diff --git a/examples/topic_reader/eventloop/main.cpp b/examples/topic_reader/eventloop/main.cpp index 2ef27b387ab..1cf0dae7834 100644 --- a/examples/topic_reader/eventloop/main.cpp +++ b/examples/topic_reader/eventloop/main.cpp @@ -35,7 +35,7 @@ struct TOptions { std::shared_ptr ReadSession; void StopHandler(int) { - Cerr << "Stopping session" << Endl; + std::cerr << "Stopping session" << std::endl; if (ReadSession) { ReadSession->Close(TDuration::Seconds(3)); } else { @@ -74,7 +74,7 @@ int main(int argc, const char* argv[]) { ReadSession = topicClient.CreateReadSession(settings); - Cerr << "Session was created" << Endl; + std::cerr << "Session was created" << std::endl; // [BEGIN read session process events] // Event loop @@ -83,15 +83,15 @@ int main(int argc, const char* argv[]) { // Wait for next event or ten seconds future.Wait(TDuration::Seconds(10)); // future.Subscribe([](){ - // Cerr << ...; + // std::cerr << ...; // }); // Get event std::optional event = ReadSession->GetEvent(true/*block - will block if no event received yet*/); - Cerr << "Got new read session event: " << DebugString(*event) << Endl; + std::cerr << "Got new read session event: " << DebugString(*event) << std::endl; if (auto* dataEvent = std::get_if(&*event)) { for (const auto& message : dataEvent->GetMessages()) { - Cerr << "Data message: \"" << message.GetData() << "\"" << Endl; + std::cerr << "Data message: \"" << message.GetData() << "\"" << std::endl; } if (opts.CommitAfterProcessing) { diff --git a/examples/topic_reader/simple/main.cpp b/examples/topic_reader/simple/main.cpp index a72a4bb212f..5cf1fca585e 100644 --- a/examples/topic_reader/simple/main.cpp +++ b/examples/topic_reader/simple/main.cpp @@ -35,7 +35,7 @@ struct TOptions { std::shared_ptr ReadSession; void StopHandler(int) { - Cerr << "Stopping session" << Endl; + std::cerr << "Stopping session" << std::endl; if (ReadSession) { ReadSession->Close(TDuration::Seconds(3)); } else { @@ -80,13 +80,13 @@ int main(int argc, const char* argv[]) { // settings.SetSimpleDataHandlers( settings.EventHandlers_.SimpleDataHandlers( [](NYdb::NTopic::TReadSessionEvent::TDataReceivedEvent& event) { - Cerr << "Data event " << DebugString(event); + std::cerr << "Data event " << DebugString(event); }, opts.CommitAfterProcessing); ReadSession = topicClient.CreateReadSession(settings); // [END Create read session] - Cerr << "Session was created" << Endl; + std::cerr << "Session was created" << std::endl; // Wait SessionClosed event. ReadSession->GetEvent(/*block = */true); diff --git a/examples/topic_reader/transaction/application.cpp b/examples/topic_reader/transaction/application.cpp index 171d2b7d37e..205ee36d6f4 100644 --- a/examples/topic_reader/transaction/application.cpp +++ b/examples/topic_reader/transaction/application.cpp @@ -37,7 +37,7 @@ void TApplication::CreateTopicReadSession(const TOptions& options) ReadSession = TopicClient->CreateReadSession(settings); - Cout << "Topic session was created" << Endl; + std::cout << "Topic session was created" << std::endl; } void TApplication::CreateTableSession() @@ -48,7 +48,7 @@ void TApplication::CreateTableSession() TableSession = result.GetSession(); - Cout << "Table session was created" << Endl; + std::cout << "Table session was created" << std::endl; } void TApplication::Run() @@ -120,7 +120,7 @@ void TApplication::CommitTransaction() auto result = Transaction->Commit(settings).GetValueSync(); - Cout << "Commit: " << static_cast(result) << Endl; + std::cout << "Commit: " << ToString(static_cast(result)) << std::endl; } void TApplication::TryCommitTransaction() diff --git a/examples/topic_reader/transaction/main.cpp b/examples/topic_reader/transaction/main.cpp index 95cc49edc22..f3af9a2a0b6 100644 --- a/examples/topic_reader/transaction/main.cpp +++ b/examples/topic_reader/transaction/main.cpp @@ -9,7 +9,7 @@ std::optional App; void StopHandler(int) { - Cout << "Stopping session" << Endl; + std::cout << "Stopping session" << std::endl; if (App) { App->Stop(); } else { @@ -25,10 +25,10 @@ int main(int argc, const char* argv[]) TOptions options(argc, argv); App.emplace(options); - Cout << "Application initialized" << Endl; + std::cout << "Application initialized" << std::endl; App->Run(); - Cout << "Event loop completed" << Endl; + std::cout << "Event loop completed" << std::endl; App->Finalize(); } diff --git a/examples/ttl/ttl.cpp b/examples/ttl/ttl.cpp index aff575f49d8..a7c8861df41 100644 --- a/examples/ttl/ttl.cpp +++ b/examples/ttl/ttl.cpp @@ -211,18 +211,18 @@ static TStatus DeleteDocumentWithTimestamp(TSession session, const std::string& void AddDocument(TTableClient client, const std::string& path, const std::string& url, const std::string& html, const ui64 timestamp) { - Cout << "> AddDocument:" << Endl - << " Url: " << url << Endl - << " Timestamp: " << timestamp << Endl; + std::cout << "> AddDocument:" << std::endl + << " Url: " << url << std::endl + << " Timestamp: " << timestamp << std::endl; ThrowOnError(client.RetryOperationSync([path, url, html, timestamp](TSession session) { return AddDocumentTransaction(session, path, url, html, timestamp); })); - Cout << Endl; + std::cout << std::endl; } void ReadDocument(TTableClient client, const std::string& path, const std::string& url) { - Cout << "> ReadDocument \"" << url << "\":" << Endl; + std::cout << "> ReadDocument \"" << url << "\":" << std::endl; std::optional resultSet; ThrowOnError(client.RetryOperationSync([path, url, &resultSet] (TSession session) { return ReadDocumentTransaction(session, path, url, resultSet); @@ -230,18 +230,18 @@ void ReadDocument(TTableClient client, const std::string& path, const std::strin TResultSetParser parser(*resultSet); if (parser.TryNextRow()) { - Cout << " DocId: " << parser.ColumnParser("doc_id").GetOptionalUint64() << Endl - << " Url: " << parser.ColumnParser("url").GetOptionalUtf8() << Endl - << " Timestamp: " << parser.ColumnParser("timestamp").GetOptionalUint64() << Endl - << " Html: " << parser.ColumnParser("html").GetOptionalUtf8() << Endl; + std::cout << " DocId: " << ToString(parser.ColumnParser("doc_id").GetOptionalUint64()) << std::endl + << " Url: " << ToString(parser.ColumnParser("url").GetOptionalUtf8()) << std::endl + << " Timestamp: " << ToString(parser.ColumnParser("timestamp").GetOptionalUint64()) << std::endl + << " Html: " << ToString(parser.ColumnParser("html").GetOptionalUtf8()) << std::endl; } else { - Cout << " Not found" << Endl; + std::cout << " Not found" << std::endl; } - Cout << Endl; + std::cout << std::endl; } void DeleteExpired(TTableClient client, const std::string& path, const ui32 queue, const ui64 timestamp) { - Cout << "> DeleteExpired from queue #" << queue << ":" << Endl; + std::cout << "> DeleteExpired from queue #" << queue << ":" << std::endl; bool empty = false; ui64 lastTimestamp = 0; ui64 lastDocId = 0; @@ -257,14 +257,14 @@ void DeleteExpired(TTableClient client, const std::string& path, const ui32 queu empty = false; lastDocId = *parser.ColumnParser("doc_id").GetOptionalUint64(); lastTimestamp = *parser.ColumnParser("timestamp").GetOptionalUint64(); - Cout << " DocId: " << lastDocId << " Timestamp: " << lastTimestamp << Endl; + std::cout << " DocId: " << lastDocId << " Timestamp: " << lastTimestamp << std::endl; ThrowOnError(client.RetryOperationSync([path, queue, lastDocId, lastTimestamp] (TSession session) { return DeleteDocumentWithTimestamp(session, path, queue, lastDocId, lastTimestamp); })); } } - Cout << Endl; + std::cout << std::endl; } /////////////////////////////////////////////////////////////////////////////// @@ -311,7 +311,7 @@ bool Run(const TDriver& driver, const std::string& path) { ReadDocument(client, path, "https://ya.ru/"); } catch (const TYdbErrorException& e) { - Cerr << "Execution failed due to fatal error:" << Endl; + std::cerr << "Execution failed due to fatal error:" << std::endl; PrintStatus(e.Status); return false; } diff --git a/examples/ttl/util.h b/examples/ttl/util.h index fe350067305..dc20477ae11 100644 --- a/examples/ttl/util.h +++ b/examples/ttl/util.h @@ -25,8 +25,8 @@ inline void ThrowOnError(const TStatus& status) { } inline void PrintStatus(const TStatus& status) { - Cerr << "Status: " << status.GetStatus() << Endl; - status.GetIssues().PrintTo(Cerr); + std::cerr << "Status: " << ToString(status.GetStatus()) << std::endl; + std::cerr << status.GetIssues().ToString(); } inline std::string JoinPath(const std::string& basePath, const std::string& path) { diff --git a/library/cpp/blockcodecs/codecs_ut.cpp b/library/cpp/blockcodecs/codecs_ut.cpp index e99cd6d6ce8..4d02b518734 100644 --- a/library/cpp/blockcodecs/codecs_ut.cpp +++ b/library/cpp/blockcodecs/codecs_ut.cpp @@ -59,7 +59,7 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { d.AsString(res); UNIT_ASSERT_EQUAL(NBlockCodecs::TData(res), NBlockCodecs::TData(data)); } catch (...) { - Cerr << c->Name() << "(" << res.Quote() << ")(" << std::string{NBlockCodecs::TData(data)}.Quote() << ")" << Endl; + std::cerr << c->Name() << "(" << res.Quote() << ")(" << std::string{NBlockCodecs::TData(data)}.Quote() << ")" << std::endl; throw; } @@ -183,7 +183,7 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { try { UNIT_ASSERT_EQUAL(resNew, res); } catch (...) { - Cerr << c->Name() << Endl; + std::cerr << c->Name() << std::endl; throw; } diff --git a/library/cpp/coroutine/engine/coroutine_ut.cpp b/library/cpp/coroutine/engine/coroutine_ut.cpp index 9ec91cafb0b..406212d255c 100644 --- a/library/cpp/coroutine/engine/coroutine_ut.cpp +++ b/library/cpp/coroutine/engine/coroutine_ut.cpp @@ -634,11 +634,11 @@ namespace NCoroTestFastPathWake { UNIT_ASSERT_VALUES_EQUAL(res.Checked(), 0); state.IoSleepRunning = false; } catch (const NUnitTest::TAssertException& ex) { - Cerr << ex.AsStrBuf() << Endl; - ex.BackTrace()->PrintTo(Cerr); + std::cerr << ex.AsStrBuf() << std::endl; + ex.BackTrace()->PrintTo(std::cerr); throw; } catch (...) { - Cerr << CurrentExceptionMessage() << Endl; + std::cerr << CurrentExceptionMessage() << std::endl; throw; } } @@ -697,11 +697,11 @@ namespace NCoroTestFastPathWake { // Check everything has ended sooner than the timeout UNIT_ASSERT(TInstant::Now() - start < TDuration::Seconds(1)); } catch (const NUnitTest::TAssertException& ex) { - Cerr << ex.AsStrBuf() << Endl; - ex.BackTrace()->PrintTo(Cerr); + std::cerr << ex.AsStrBuf() << std::endl; + ex.BackTrace()->PrintTo(std::cerr); throw; } catch (...) { - Cerr << CurrentExceptionMessage() << Endl; + std::cerr << CurrentExceptionMessage() << std::endl; throw; } } diff --git a/library/cpp/coroutine/engine/impl.cpp b/library/cpp/coroutine/engine/impl.cpp index 8acf7a90e16..fd4e09cfadc 100644 --- a/library/cpp/coroutine/engine/impl.cpp +++ b/library/cpp/coroutine/engine/impl.cpp @@ -9,6 +9,8 @@ #include #include +#include + TCont::TJoinWait::TJoinWait(TCont& c) noexcept : Cont_(c) {} @@ -355,7 +357,7 @@ void TContExecutor::RunScheduler() noexcept { } } } catch (...) { - TBackTrace::FromCurrentException().PrintTo(Cerr); + std::cerr << TBackTrace::FromCurrentException().PrintToString(); Y_ABORT("Uncaught exception in the scheduler: %s", CurrentExceptionMessage().c_str()); } } diff --git a/library/cpp/cppparser/parser.cpp b/library/cpp/cppparser/parser.cpp index b5d0c1205e7..72b8dc5d384 100644 --- a/library/cpp/cppparser/parser.cpp +++ b/library/cpp/cppparser/parser.cpp @@ -106,8 +106,8 @@ class TCppSaxParser::TImpl { } #if DEBUG_ME - Cerr << "char: " << ch << Endl; - Cerr << "state before: " << (unsigned int)State_ << Endl; + std::cerr << "char: " << ch << std::endl; + std::cerr << "state before: " << (unsigned int)State_ << std::endl; #endif retry: @@ -348,7 +348,7 @@ class TCppSaxParser::TImpl { } #if DEBUG_ME - Cerr << "state after: " << (unsigned int)State_ << Endl; + std::cerr << "state after: " << (unsigned int)State_ << std::endl; #endif ++data; diff --git a/library/cpp/dbg_output/auto.h b/library/cpp/dbg_output/auto.h index 8d96167f6ac..d16574938d6 100644 --- a/library/cpp/dbg_output/auto.h +++ b/library/cpp/dbg_output/auto.h @@ -2,13 +2,13 @@ #include -// int a = 1, b = 2; Cout << LabeledDump(a, b, 1 + 2); yields {"a": 1, "b": 2, "1 + 2": 3} +// int a = 1, b = 2; std::cout << LabeledDump(a, b, 1 + 2); yields {"a": 1, "b": 2, "1 + 2": 3} #define LabeledDump(...) \ '{' Y_PASS_VA_ARGS(Y_MAP_ARGS_WITH_LAST(__LABELED_DUMP_NONLAST__, __LABELED_DUMP_IMPL__, __VA_ARGS__)) << '}' #define __LABELED_DUMP_IMPL__(x) << "\"" #x "\": " << DbgDump(x) #define __LABELED_DUMP_NONLAST__(x) __LABELED_DUMP_IMPL__(x) << ", " -// Usage: struct TMyStruct { int A, B; }; DEFINE_DUMPER(TMyStruct, A, B); Cout << TMyStruct{3, 4}; +// Usage: struct TMyStruct { int A, B; }; DEFINE_DUMPER(TMyStruct, A, B); std::cout << TMyStruct{3, 4}; // yields {"A": 3, "B": 4} #define DEFINE_DUMPER(C, ...) \ template <> \ diff --git a/library/cpp/dbg_output/dump.h b/library/cpp/dbg_output/dump.h index c7efa105ee6..6f6f338fbf2 100644 --- a/library/cpp/dbg_output/dump.h +++ b/library/cpp/dbg_output/dump.h @@ -11,9 +11,9 @@ #include /* - * Cout << DbgDump(any) << Endl; - * Cout << DbgDumpDeep(any) << Endl; - * Cout << DbgDump(any).SetIndent(true) << Endl; + * std::cout << DbgDump(any) << std::endl; + * std::cout << DbgDumpDeep(any) << std::endl; + * std::cout << DbgDump(any).SetIndent(true) << std::endl; * * specialize TDumper for extending dumper */ diff --git a/library/cpp/diff/diff_ut.cpp b/library/cpp/diff/diff_ut.cpp index 140db6a4642..7a3ac24c952 100644 --- a/library/cpp/diff/diff_ut.cpp +++ b/library/cpp/diff/diff_ut.cpp @@ -53,7 +53,7 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("aaa", "aaa"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "aaa"); } @@ -61,11 +61,11 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("aaa", "bbb"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aaa|bbb)"); tester.Test("aaa", "bbbb"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aaa|bbbb)"); } @@ -73,19 +73,19 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("aaa", "abb", ""); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "a(aa|bb)"); tester.Test("aac", "abc", ""); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "a(a|b)c"); tester.Test("123", "133", ""); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "1(2|3)3"); tester.Test("[1, 2, 3]", "[1, 3, 3]", ""); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "[1, (2|3), 3]"); } @@ -93,7 +93,7 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("abcde", "accfg"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(abcde|accfg)"); } @@ -103,7 +103,7 @@ Y_UNIT_TEST_SUITE(DiffTokens) { std::string_view str("aaa bbb"); tester.Test(str, str); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "aaa bbb"); } @@ -111,11 +111,11 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("aaa bbb", "ccc ddd"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aaa|ccc) (bbb|ddd)"); tester.Test("aaa bbb", "c d"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aaa|c) (bbb|d)"); } @@ -123,11 +123,11 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("aaa ccd", "abb cce"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aaa|abb) (ccd|cce)"); tester.Test("aac cbb", "aa bb"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aac|aa) (cbb|bb)"); } @@ -135,19 +135,19 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("aaa bbb", "bbb aaa"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(|bbb )aaa( bbb|)"); tester.Test("aaa bbb", " bbb aaa"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aaa|) bbb(| aaa)"); tester.Test(" aaa bbb ", " bbb aaa "); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(| bbb) aaa (bbb |)"); tester.Test("aaa bb", " bbb aa"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aaa|) (bb|bbb aa)"); } @@ -155,19 +155,19 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("aaa bbb", "aaa"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "aaa( bbb|)"); tester.Test("aaa bbb", "aaa "); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "aaa (bbb|)"); tester.Test("aaa bbb", " bbb"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aaa|) bbb"); tester.Test("aaa bbb", "bbb"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "(aaa |)bbb"); } @@ -175,11 +175,11 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("aaa\nabc\nbbb", "aaa\nacc\nbbb"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "aaa\n(abc|acc)\nbbb"); tester.Test("aaa\nabc\nbbb", "aaa\nac\nbbb"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "aaa\n(abc|ac)\nbbb"); } @@ -187,11 +187,11 @@ Y_UNIT_TEST_SUITE(DiffTokens) { TDiffTester tester; tester.Test("aaa bbb", "aaa\tbbb"); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "aaa( |\t)bbb"); tester.Test(" aaa\tbbb\n", "\taaa\nbbb "); - //~ Cerr << tester.Result() << Endl; + //~ std::cerr << tester.Result() << std::endl; UNIT_ASSERT_VALUES_EQUAL(tester.Result(), "( |\t)aaa(\t|\n)bbb(\n| )"); } } diff --git a/library/cpp/getopt/last_getopt_demo/demo.cpp b/library/cpp/getopt/last_getopt_demo/demo.cpp index 66f81e94547..967afb7bcb3 100644 --- a/library/cpp/getopt/last_getopt_demo/demo.cpp +++ b/library/cpp/getopt/last_getopt_demo/demo.cpp @@ -2,6 +2,8 @@ #include #include +#include + // For the sake of this example, let's implement Wget Y_COMPLETER(HeaderCompleter) { @@ -59,7 +61,7 @@ class TMain: public TMainClassArgs { .IfPresentDisableCompletion() .NoArgument() .Handler([]() { - Cerr << "last_getopt_demo 1.0.0" << Endl; + std::cerr << "last_getopt_demo 1.0.0" << std::endl; exit(0); }); @@ -208,28 +210,28 @@ class TMain: public TMainClassArgs { std::string method = ExplicitMethod_ ? ExplicitMethod_ : ImplicitMethod_; - Cerr << ST_LIGHT << "Settings:" << RESET << Endl; - Cerr << GREEN << " Background: " << RESET << Background_ << Endl; - Cerr << GREEN << " Timeout: " << RESET << Timeout_ << Endl; - Cerr << GREEN << " Method: " << RESET << method.Quote() << Endl; - Cerr << GREEN << " UserAgent: " << RESET << UserAgent_.Quote() << Endl; - Cerr << GREEN << " PostData: " << RESET << (PostData_ ? PostData_->Quote() : "Nothing") << Endl; - Cerr << GREEN << " PostFile: " << RESET << (PostFile_ ? PostFile_->Quote() : "Nothing") << Endl; + std::cerr << ST_LIGHT << "Settings:" << RESET << std::endl; + std::cerr << GREEN << " Background: " << RESET << Background_ << std::endl; + std::cerr << GREEN << " Timeout: " << RESET << Timeout_ << std::endl; + std::cerr << GREEN << " Method: " << RESET << method.Quote() << std::endl; + std::cerr << GREEN << " UserAgent: " << RESET << UserAgent_.Quote() << std::endl; + std::cerr << GREEN << " PostData: " << RESET << (PostData_ ? PostData_->Quote() : "Nothing") << std::endl; + std::cerr << GREEN << " PostFile: " << RESET << (PostFile_ ? PostFile_->Quote() : "Nothing") << std::endl; - Cerr << ST_LIGHT << "Headers:" << RESET << Endl; + std::cerr << ST_LIGHT << "Headers:" << RESET << std::endl; for (auto& header : Headers_) { - Cerr << " " << header.Quote() << Endl; + std::cerr << " " << header.Quote() << std::endl; } if (!Headers_) { - Cerr << GREEN << " no headers" << RESET << Endl; + std::cerr << GREEN << " no headers" << RESET << std::endl; } - Cerr << ST_LIGHT << "Will download the following URLs:" << RESET << Endl; + std::cerr << ST_LIGHT << "Will download the following URLs:" << RESET << std::endl; for (auto& arg : parsedOptions.GetFreeArgs()) { - Cerr << " " << arg.Quote() << Endl; + std::cerr << " " << arg.Quote() << std::endl; } if (!parsedOptions.GetFreeArgs()) { - Cerr << " no urls" << Endl; + std::cerr << " no urls" << std::endl; } return 0; } diff --git a/library/cpp/getopt/small/completer.cpp b/library/cpp/getopt/small/completer.cpp index 045c4146af7..598253b3898 100644 --- a/library/cpp/getopt/small/completer.cpp +++ b/library/cpp/getopt/small/completer.cpp @@ -5,6 +5,8 @@ #include #include +#include + using NLastGetopt::NEscaping::Q; using NLastGetopt::NEscaping::QQ; using NLastGetopt::NEscaping::C; @@ -263,7 +265,7 @@ namespace NLastGetopt::NComp { } void TCustomCompleter::AddCompletion(std::string_view completion) { - Cout << completion << Endl; // this was easy =) + std::cout << completion << std::endl; // this was easy =) // TODO: support option descriptions and messages } @@ -275,12 +277,12 @@ namespace NLastGetopt::NComp { } if (!root.empty()) { - Cout << root << Sep_ << Endl; + std::cout << root << Sep_ << std::endl; } else { - Cout << Endl; + std::cout << std::endl; } - Cout << Sep_ << Endl; + std::cout << Sep_ << std::endl; GenerateCompletionParts(argc, argv, curIdx, cur, prefix, suffix, root); } diff --git a/library/cpp/getopt/small/completer_command.cpp b/library/cpp/getopt/small/completer_command.cpp index 8226c0f9de6..75734bbedb7 100644 --- a/library/cpp/getopt/small/completer_command.cpp +++ b/library/cpp/getopt/small/completer_command.cpp @@ -7,6 +7,8 @@ #include #include +#include + namespace NLastGetopt { std::string MakeInfo(std::string_view command, std::string_view flag) { std::string info = ( @@ -97,13 +99,13 @@ namespace NLastGetopt { .Completer(ShellChoiceCompleter()) .Handler1T([opts, command, name](std::string_view shell) { if (shell.empty()) { - Cerr << Wrap(80, MakeInfo(command, "--" + name)) << Endl; + std::cerr << Wrap(80, MakeInfo(command, "--" + name)) << std::endl; } else if (shell == "bash") { TBashCompletionGenerator(opts).Generate(command, Cout); } else if (shell == "zsh") { TZshCompletionGenerator(opts).Generate(command, Cout); } else { - Cerr << "Unknown shell name " << NUtils::Quote(shell) << Endl; + std::cerr << "Unknown shell name " << NUtils::Quote(shell) << std::endl; exit(1); } exit(0); @@ -144,7 +146,7 @@ namespace NLastGetopt { } else if (arg == "zsh") { TZshCompletionGenerator(Modes_).Generate(Command_, Cout); } else { - Cerr << "Unknown shell name " << NUtils::Quote(arg) << Endl; + std::cerr << "Unknown shell name " << NUtils::Quote(arg) << std::endl; parsedOptions.PrintUsage(); return 1; } diff --git a/library/cpp/getopt/small/last_getopt_opts.cpp b/library/cpp/getopt/small/last_getopt_opts.cpp index 466e9289212..9bba442f513 100644 --- a/library/cpp/getopt/small/last_getopt_opts.cpp +++ b/library/cpp/getopt/small/last_getopt_opts.cpp @@ -9,7 +9,8 @@ #include #include -#include +#include +#include namespace NLastGetoptPrivate { std::string& VersionString() { @@ -26,12 +27,12 @@ namespace NLastGetopt { static const std::string_view SPad = " "; void PrintVersionAndExit(const TOptsParser*) { - Cout << (!NLastGetoptPrivate::VersionString().empty() ? NLastGetoptPrivate::VersionString() : "program version: not linked with library/cpp/getopt") << Endl; + std::cout << (!NLastGetoptPrivate::VersionString().empty() ? NLastGetoptPrivate::VersionString() : "program version: not linked with library/cpp/getopt") << std::endl; exit(NLastGetoptPrivate::VersionString().empty()); } void PrintShortVersionAndExit(const std::string& appName) { - Cout << appName << " version " << (!NLastGetoptPrivate::ShortVersionString().empty() ? NLastGetoptPrivate::ShortVersionString() : "not linked with library/cpp/getopt") << Endl; + std::cout << appName << " version " << (!NLastGetoptPrivate::ShortVersionString().empty() ? NLastGetoptPrivate::ShortVersionString() : "not linked with library/cpp/getopt") << std::endl; exit(NLastGetoptPrivate::ShortVersionString().empty()); } diff --git a/library/cpp/getopt/small/last_getopt_parse_result.cpp b/library/cpp/getopt/small/last_getopt_parse_result.cpp index 42522264c33..0416f6ebcea 100644 --- a/library/cpp/getopt/small/last_getopt_parse_result.cpp +++ b/library/cpp/getopt/small/last_getopt_parse_result.cpp @@ -1,5 +1,7 @@ #include "last_getopt_parse_result.h" +#include + namespace NLastGetopt { const TOptParseResult* TOptsParseResult::FindParseResult(const TdVec& vec, const TOpt* opt) { for (const auto& r : vec) { @@ -162,10 +164,10 @@ namespace NLastGetopt { } void TOptsParseResult::HandleError() const { - Cerr << CurrentExceptionMessage() << Endl; + std::cerr << CurrentExceptionMessage() << std::endl; if (Parser_.Get()) { // parser initializing can fail (and we get here, see Init) if (Parser_->Opts_->FindLongOption("help") != nullptr) { - Cerr << "Try '" << Parser_->ProgramName_ << " --help' for more information." << Endl; + std::cerr << "Try '" << Parser_->ProgramName_ << " --help' for more information." << std::endl; } else { PrintUsage(); } diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index 03a6e31484b..e94f0223090 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -8,6 +8,8 @@ #include #include +#include + class PtrWrapper: public TMainClass { public: explicit PtrWrapper(const TMainFunctionPtr& main) @@ -194,7 +196,7 @@ int TModChooser::Run(const int argc, const char** argv) const { } if (modeIter == Modes.end()) { - Cerr << "Unknown mode " << NUtils::Quote(modeName) << "." << Endl; + std::cerr << "Unknown mode " << NUtils::Quote(modeName) << "." << std::endl; PrintHelp(argv[0], true); return 1; } @@ -276,12 +278,12 @@ std::string TModChooser::TMode::FormatFullName(size_t pad) const { void TModChooser::PrintHelp(const std::string& progName, bool toStdErr) const { auto baseName = TFsPath(progName).Basename(); - auto& out = toStdErr ? Cerr : Cout; + auto& out = toStdErr ? std::cerr : std::cout; const auto& colors = toStdErr ? NColorizer::StdErr() : NColorizer::StdOut(); - out << Description << Endl << Endl; - out << colors.BoldColor() << "Usage" << colors.OldColor() << ": " << baseName << " MODE [MODE_OPTIONS]" << Endl; - out << Endl; - out << colors.BoldColor() << "Modes" << colors.OldColor() << ":" << Endl; + out << Description << std::endl << std::endl; + out << colors.BoldColor() << "Usage" << colors.OldColor() << ": " << baseName << " MODE [MODE_OPTIONS]" << std::endl; + out << std::endl; + out << colors.BoldColor() << "Modes" << colors.OldColor() << ":" << std::endl; size_t maxModeLen = 0; for (const auto& [name, mode] : Modes) { if (name != mode->Name) @@ -293,10 +295,10 @@ void TModChooser::PrintHelp(const std::string& progName, bool toStdErr) const { for (const auto& unsortedMode : UnsortedModes) if (!unsortedMode->Hidden) { if (unsortedMode->Name.size()) { - out << " " << unsortedMode->FormatFullName(maxModeLen + 4) << unsortedMode->Description << Endl; + out << " " << unsortedMode->FormatFullName(maxModeLen + 4) << unsortedMode->Description << std::endl; } else { - out << SeparationString << Endl; - out << unsortedMode->Description << Endl; + out << SeparationString << std::endl; + out << unsortedMode->Description << std::endl; } } } else { @@ -305,17 +307,17 @@ void TModChooser::PrintHelp(const std::string& progName, bool toStdErr) const { continue; // this is an alias if (!mode.second->Hidden) { - out << " " << mode.second->FormatFullName(maxModeLen + 4) << mode.second->Description << Endl; + out << " " << mode.second->FormatFullName(maxModeLen + 4) << mode.second->Description << std::endl; } } } - out << Endl; - out << "To get help for specific mode type '" << baseName << " MODE " << ModesHelpOption << "'" << Endl; + out << std::endl; + out << "To get help for specific mode type '" << baseName << " MODE " << ModesHelpOption << "'" << std::endl; if (VersionHandler) - out << "To print program version type '" << baseName << " --version'" << Endl; + out << "To print program version type '" << baseName << " --version'" << std::endl; if (!SvnRevisionOptionDisabled) { - out << "To print svn revision type '" << baseName << " --svnrevision'" << Endl; + out << "To print svn revision type '" << baseName << " --svnrevision'" << std::endl; } } diff --git a/library/cpp/getopt/small/opt.cpp b/library/cpp/getopt/small/opt.cpp index 73ff2a582c5..51c20e06a3f 100644 --- a/library/cpp/getopt/small/opt.cpp +++ b/library/cpp/getopt/small/opt.cpp @@ -4,6 +4,8 @@ #include +#include + using namespace NLastGetopt; namespace { @@ -83,7 +85,7 @@ int Opt::Get(int* longOptionIndex) { } catch (const NLastGetopt::TException&) { GotError_ = true; if (Err) - Cerr << CurrentExceptionMessage() << Endl; + std::cerr << CurrentExceptionMessage() << std::endl; return '?'; } } diff --git a/library/cpp/http/fetch/httpfsm_ut.cpp b/library/cpp/http/fetch/httpfsm_ut.cpp index 6d1bb2671a8..bcf6f0fee81 100644 --- a/library/cpp/http/fetch/httpfsm_ut.cpp +++ b/library/cpp/http/fetch/httpfsm_ut.cpp @@ -501,7 +501,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) { for (size_t n = 0; n < states.size(); n++) { const std::string_view d{blob, n, 1}; int code = parser.Execute(d.data(), d.size()); - Cout << std::string(d).Quote() << " " << code << Endl; + std::cout << std::string(d).Quote() << " " << code << std::endl; UNIT_ASSERT_EQUAL(code, states[n]); } return parser; diff --git a/library/cpp/http/fetch/httpparser_ut.cpp b/library/cpp/http/fetch/httpparser_ut.cpp index 58eca2f8835..8a7af7f4a3f 100644 --- a/library/cpp/http/fetch/httpparser_ut.cpp +++ b/library/cpp/http/fetch/httpparser_ut.cpp @@ -39,7 +39,7 @@ namespace { // other functions are not really called by THttpParser void CheckDocPart(const void* buf, size_t len, THttpHeader* /* header */) { std::string s(static_cast(buf), len); - Cout << "State = " << static_cast(this)->GetState() << ", CheckDocPart(" << s.Quote() << ")\n"; + std::cout << "State = " << static_cast(this)->GetState() << ", CheckDocPart(" << s.Quote() << ")\n"; Body_ += s; } }; @@ -138,7 +138,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { for (size_t i = 0; i < blob.size(); ++i) { const std::string_view d{blob, i, 1}; parser.Parse((void*)d.data(), d.size()); - Cout << std::string(d).Quote() << " -> " << parser.GetState() << Endl; + std::cout << std::string(d).Quote() << " -> " << parser.GetState() << std::endl; } AssertPipelineClen(parser, hdr); UNIT_ASSERT_EQUAL(parser.Body(), "OK\r\n"); @@ -213,7 +213,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { for (size_t i = 0; i < blob.size(); ++i) { const std::string_view d{blob, i, 1}; parser.Parse((void*)d.data(), d.size()); - Cout << std::string(d).Quote() << " -> " << parser.GetState() << Endl; + std::cout << std::string(d).Quote() << " -> " << parser.GetState() << std::endl; if (blob.size() / 2 - 1 <= i) // last \n sets EOF UNIT_ASSERT_EQUAL(parser.GetState(), parser.hp_eof); } diff --git a/library/cpp/http/io/list_codings/main.cpp b/library/cpp/http/io/list_codings/main.cpp index 9818d02bdfe..faca8052115 100644 --- a/library/cpp/http/io/list_codings/main.cpp +++ b/library/cpp/http/io/list_codings/main.cpp @@ -1,8 +1,9 @@ #include -#include + +#include int main() { for (auto codec : SupportedCodings()) { - Cout << codec << Endl; + std::cout << codec << std::endl; } } diff --git a/library/cpp/http/io/stream_ut_medium.cpp b/library/cpp/http/io/stream_ut_medium.cpp index 9f3340ac776..ffb6d1535d6 100644 --- a/library/cpp/http/io/stream_ut_medium.cpp +++ b/library/cpp/http/io/stream_ut_medium.cpp @@ -35,7 +35,7 @@ Y_UNIT_TEST_SUITE(THttpTestMedium) { UNIT_ASSERT(s.size() > 10); UNIT_ASSERT(s.find(data) == std::string::npos); } catch (...) { - Cerr << codec << " " << s << Endl; + std::cerr << codec << " " << s << std::endl; throw; } diff --git a/library/cpp/http/simple/ut/https_ut.cpp b/library/cpp/http/simple/ut/https_ut.cpp index f448166cada..5f18154ffc5 100644 --- a/library/cpp/http/simple/ut/https_ut.cpp +++ b/library/cpp/http/simple/ut/https_ut.cpp @@ -7,6 +7,8 @@ #include +#include + Y_UNIT_TEST_SUITE(Https) { using TShellCommandPtr = std::unique_ptr; @@ -14,7 +16,7 @@ Y_UNIT_TEST_SUITE(Https) { const std::string data = ArcadiaSourceRoot() + "/library/cpp/http/simple/ut/https_server"; const std::string command = - TYdbStringBuilder() + TStringBuilder() << BuildRoot() << "/library/cpp/http/simple/ut/https_server/https_server" << " --port " << port << " --keyfile " << data << "/http_server.key" @@ -37,7 +39,7 @@ Y_UNIT_TEST_SUITE(Https) { client.DoGet("/ping"); break; } catch (const std::exception& e) { - Cout << "== failed to connect to new server: " << e.what() << Endl; + std::cout << "== failed to connect to new server: " << e.what() << std::endl; Sleep(TDuration::MilliSeconds(1)); } } @@ -46,7 +48,7 @@ Y_UNIT_TEST_SUITE(Https) { } static void get(TKeepAliveHttpClient & client) { - std::stringStream out; + TStringStream out; ui32 code = 0; UNIT_ASSERT_NO_EXCEPTION(code = client.DoGet("/ping", &out)); @@ -75,7 +77,7 @@ Y_UNIT_TEST_SUITE(Https) { } static void get(TSimpleHttpClient & client) { - std::stringStream out; + TStringStream out; UNIT_ASSERT_NO_EXCEPTION_C(client.DoGet("/ping", &out), out.Str()); UNIT_ASSERT_VALUES_EQUAL(out.Str(), "pong.my"); diff --git a/library/cpp/json/fuzzy_test/main.cpp b/library/cpp/json/fuzzy_test/main.cpp index a6e0a7d4376..a5ce20454ba 100644 --- a/library/cpp/json/fuzzy_test/main.cpp +++ b/library/cpp/json/fuzzy_test/main.cpp @@ -10,20 +10,20 @@ extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) { NJson::TJsonValue value; NJson::ReadJsonFastTree(json, &value, true); } catch (...) { - //Cout << json << " -> " << CurrentExceptionMessage() << Endl; + //std::cout << json << " -> " << CurrentExceptionMessage() << std::endl; } try { NJson::TJsonCallbacks cb; NJson::ReadJsonFast(json, &cb); } catch (...) { - //Cout << json << " -> " << CurrentExceptionMessage() << Endl; + //std::cout << json << " -> " << CurrentExceptionMessage() << std::endl; } try { NJson::ValidateJson(json); } catch (...) { - //Cout << json << " -> " << CurrentExceptionMessage() << Endl; + //std::cout << json << " -> " << CurrentExceptionMessage() << std::endl; } return 0; diff --git a/library/cpp/json/ut/json_reader_fast_ut.cpp b/library/cpp/json/ut/json_reader_fast_ut.cpp index ee95ea99db0..7ba5b265bc9 100644 --- a/library/cpp/json/ut/json_reader_fast_ut.cpp +++ b/library/cpp/json/ut/json_reader_fast_ut.cpp @@ -5,6 +5,8 @@ #include #include +#include + namespace NJson { namespace NTest { enum ETestEvent { @@ -157,9 +159,9 @@ namespace NJson { UNIT_ASSERT_VALUES_EQUAL_C(e[i].Str, Events[i].Str, std::format("'{}' {}", str, i)); } } catch (const yexception&) { - Clog << "Exception at '" << str << "'" << Endl; + std::cerr << "Exception at '" << str << "'" << std::endl; for (const auto& event : Events) { - Clog << event.ToString() << Endl; + std::cerr << event.ToString() << std::endl; } throw; diff --git a/library/cpp/json/writer/README.md b/library/cpp/json/writer/README.md index a20489f32ee..0986cf62c81 100644 --- a/library/cpp/json/writer/README.md +++ b/library/cpp/json/writer/README.md @@ -10,7 +10,7 @@ Use it like this: json.BeginList() .WriteString("