Skip to content

Commit 1038143

Browse files
committed
Improove tablet generation value in Topic protocol (ydb-platform#2375)
1 parent b7a3970 commit 1038143

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

.github/config/muted_ya.txt

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ ydb/services/persqueue_v1/ut TPersQueueTest.CheckACLForGrpcWrite
6666
ydb/services/persqueue_v1/ut TPersQueueTest.DirectRead*
6767
ydb/services/persqueue_v1/ut TPersQueueTest.SetupLockSession
6868
ydb/services/persqueue_v1/ut TPersQueueTest.TopicServiceCommitOffsetBadOffsets
69-
ydb/services/persqueue_v1/ut TPersQueueTest.UpdatePartitionLocation
7069
ydb/services/persqueue_v1/ut TPQCompatTest.BadTopics
7170
ydb/services/persqueue_v1/ut [3/10]*
7271
ydb/services/ydb/sdk_sessions_pool_ut YdbSdkSessionsPool.StressTestSync*

ydb/core/persqueue/partition.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ void TPartition::InitComplete(const TActorContext& ctx) {
501501

502502
LOG_INFO_S(
503503
ctx, NKikimrServices::PERSQUEUE,
504-
"init complete for topic '" << TopicName() << "' partition " << Partition << " " << ctx.SelfID
504+
"init complete for topic '" << TopicName() << "' partition " << Partition << " generation " << TabletGeneration << " " << ctx.SelfID
505505
);
506506

507507
TStringBuilder ss;

ydb/services/persqueue_v1/actors/partition_actor.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void TPartitionActor::Handle(TEvPersQueue::TEvResponse::TPtr& ev, const TActorCo
593593

594594

595595
if (!StartReading) {
596-
ctx.Send(ParentId, new TEvPQProxy::TEvPartitionStatus(Partition, CommittedOffset, EndOffset, WriteTimestampEstimateMs, TabletGeneration, NodeId));
596+
ctx.Send(ParentId, new TEvPQProxy::TEvPartitionStatus(Partition, CommittedOffset, EndOffset, WriteTimestampEstimateMs, NodeId, TabletGeneration));
597597
} else {
598598
InitStartReading(ctx);
599599
}
@@ -802,15 +802,14 @@ void TPartitionActor::Handle(TEvTabletPipe::TEvClientConnected::TPtr& ev, const
802802
TEvTabletPipe::TEvClientConnected *msg = ev->Get();
803803

804804
LOG_INFO_S(ctx, NKikimrServices::PQ_READ_PROXY, PQ_LOG_PREFIX << " " << Partition
805-
<< " pipe restart attempt " << PipeGeneration << " pipe creation result: " << msg->Status);
805+
<< " pipe restart attempt " << PipeGeneration << " pipe creation result: " << msg->Status
806+
<< " TabletId: " << msg->TabletId << " Generation: " << msg->Generation);
806807

807808
if (msg->Status != NKikimrProto::OK) {
808809
RestartPipe(ctx, TStringBuilder() << "pipe to tablet is dead " << msg->TabletId, NPersQueue::NErrorCode::TABLET_PIPE_DISCONNECTED);
809810
return;
810811
}
811812

812-
auto prevGeneration = TabletGeneration;
813-
Y_UNUSED(prevGeneration);
814813
TabletGeneration = msg->Generation;
815814
NodeId = msg->ServerId.NodeId();
816815

ydb/services/persqueue_v1/persqueue_ut.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ Y_UNIT_TEST_SUITE(TPersQueueTest) {
716716
TPersQueueV1TestServer server;
717717
SET_LOCALS;
718718
MAKE_INSECURE_STUB(Ydb::Topic::V1::TopicService);
719-
server.EnablePQLogs({ NKikimrServices::PQ_METACACHE, NKikimrServices::PQ_READ_PROXY});
719+
server.EnablePQLogs({ NKikimrServices::PQ_METACACHE, NKikimrServices::PQ_READ_PROXY, NKikimrServices::PERSQUEUE});
720720
server.EnablePQLogs({ NKikimrServices::KQP_PROXY }, NLog::EPriority::PRI_EMERG);
721721
server.EnablePQLogs({ NKikimrServices::FLAT_TX_SCHEMESHARD }, NLog::EPriority::PRI_ERROR);
722722

@@ -742,8 +742,8 @@ Y_UNIT_TEST_SUITE(TPersQueueTest) {
742742
}
743743

744744
// await and confirm CreatePartitionStreamRequest from server
745-
i64 assignId = 0;
746-
i64 generation = 0;
745+
i64 assignId;
746+
i64 generation;
747747
{
748748
Ydb::Topic::StreamReadMessage::FromServer resp;
749749

@@ -756,8 +756,8 @@ Y_UNIT_TEST_SUITE(TPersQueueTest) {
756756
UNIT_ASSERT_VALUES_EQUAL(resp.start_partition_session_request().partition_session().path(), "acc/topic1");
757757
UNIT_ASSERT(resp.start_partition_session_request().partition_session().partition_id() == 0);
758758
UNIT_ASSERT(resp.start_partition_session_request().partition_location().generation() > 0);
759-
generation = resp.start_partition_session_request().partition_location().generation();
760759
assignId = resp.start_partition_session_request().partition_session().partition_session_id();
760+
generation = resp.start_partition_session_request().partition_location().generation();
761761
}
762762

763763
server.Server->AnnoyingClient->RestartPartitionTablets(server.Server->CleverServer->GetRuntime(), "rt3.dc1--acc--topic1");

0 commit comments

Comments
 (0)