Skip to content

Commit 865a27c

Browse files
authored
Ignore auto partitioning fields if disabled (#9312)
1 parent 4147a42 commit 865a27c

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

ydb/core/kafka_proxy/actors/kafka_list_offsets_actor.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ void TKafkaListOffsetsActor::SendOffsetsRequests(const NActors::TActorContext& c
3333
for (size_t i = 0; i < ListOffsetsRequestData->Topics.size(); ++i) {
3434
auto &requestTopic = ListOffsetsRequestData->Topics[i];
3535
auto &responseTopic = ListOffsetsResponseData->Topics[i];
36-
36+
3737
responseTopic = TListOffsetsResponseData::TListOffsetsTopicResponse{};
38-
38+
3939
if (!requestTopic.Name.has_value()) {
4040
HandleMissingTopicName(requestTopic, responseTopic);
4141
continue;
@@ -44,7 +44,7 @@ void TKafkaListOffsetsActor::SendOffsetsRequests(const NActors::TActorContext& c
4444
responseTopic.Name = requestTopic.Name;
4545
TTopicRequestInfo topicRequestInfo;
4646
topicRequestInfo.TopicIndex = i;
47-
47+
4848
for (auto& partition: requestTopic.Partitions) {
4949
topicRequestInfo.Partitions.push_back(TPartitionRequestInfo{.PartitionId = partition.PartitionIndex, .Timestamp = partition.Timestamp});
5050
}
@@ -65,7 +65,7 @@ void TKafkaListOffsetsActor::HandleMissingTopicName(const TListOffsetsRequestDat
6565

6666
TActorId TKafkaListOffsetsActor::SendOffsetsRequest(const TListOffsetsRequestData::TListOffsetsTopic& topic, const NActors::TActorContext&) {
6767
KAFKA_LOG_D("ListOffsets actor: Get offsets for topic '" << topic.Name << "' for user '" << Context->UserToken->GetUserSID() << "'");
68-
68+
6969
TEvKafka::TGetOffsetsRequest offsetsRequest;
7070
offsetsRequest.Topic = NormalizePath(Context->DatabasePath, topic.Name.value());
7171
offsetsRequest.Token = Context->UserToken->GetSerializedToken();
@@ -83,7 +83,7 @@ void TKafkaListOffsetsActor::Handle(TEvKafka::TEvTopicOffsetsResponse::TPtr& ev,
8383
--PendingResponses;
8484
auto it = TopicsRequestsInfo.find(ev->Sender);
8585

86-
Y_DEBUG_ABORT_UNLESS(it != TopicsRequestsInfo.end());
86+
Y_DEBUG_ABORT_UNLESS(it != TopicsRequestsInfo.end());
8787
if (it == TopicsRequestsInfo.end()) {
8888
KAFKA_LOG_CRIT("ListOffsets actor: received unexpected TEvTopicOffsetsResponse. Ignoring.");
8989
return RespondIfRequired(ctx);
@@ -110,15 +110,15 @@ void TKafkaListOffsetsActor::Handle(TEvKafka::TEvTopicOffsetsResponse::TPtr& ev,
110110
auto& responseFromPQPartition = it->second;
111111
responsePartition.LeaderEpoch = responseFromPQPartition.Generation;
112112
responsePartition.Timestamp = TIMESTAMP_DEFAULT_RESPONSE_VALUE;
113-
113+
114114
if (partitionRequestInfo.Timestamp == TIMESTAMP_START_OFFSET) {
115115
responsePartition.Offset = responseFromPQPartition.StartOffset;
116116
responsePartition.ErrorCode = NONE_ERROR;
117117
} else if (partitionRequestInfo.Timestamp == TIMESTAMP_END_OFFSET) {
118118
responsePartition.Offset = responseFromPQPartition.EndOffset;
119119
responsePartition.ErrorCode = NONE_ERROR;
120120
} else {
121-
responsePartition.ErrorCode = INVALID_REQUEST; // FIXME(savnik): handle it
121+
responsePartition.ErrorCode = INVALID_REQUEST; // FIXME(savnik): handle
122122
ErrorCode = INVALID_REQUEST;
123123
}
124124
} else {

ydb/services/lib/actors/pq_schema_actor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,6 @@ namespace NKikimr::NGRpcProxy::V1 {
597597
if (!config.HasPartitionStrategy()) {
598598
return std::nullopt;
599599
}
600-
if (::NKikimrPQ::TPQTabletConfig_TPartitionStrategyType::TPQTabletConfig_TPartitionStrategyType_DISABLED == config.GetPartitionStrategy().GetPartitionStrategyType()) {
601-
return std::nullopt;
602-
}
603600
auto strategy = config.GetPartitionStrategy();
604601
if (strategy.GetMinPartitionCount() < 0) {
605602
error = TStringBuilder() << "Partitions count must be non-negative, provided " << strategy.GetMinPartitionCount();
@@ -1007,7 +1004,10 @@ namespace NKikimr::NGRpcProxy::V1 {
10071004
return TYdbPqCodes(Ydb::StatusIds::BAD_REQUEST, Ydb::PersQueue::ErrorCode::VALIDATION_ERROR);
10081005
}
10091006
minParts = std::max<ui32>(1, settings.min_active_partitions());
1010-
if (appData->FeatureFlags.GetEnableTopicSplitMerge() && request.has_partitioning_settings()) {
1007+
if (appData->FeatureFlags.GetEnableTopicSplitMerge() &&
1008+
request.partitioning_settings().has_auto_partitioning_settings() &&
1009+
request.partitioning_settings().auto_partitioning_settings().strategy() != ::Ydb::Topic::AutoPartitioningStrategy::AUTO_PARTITIONING_STRATEGY_DISABLED) {
1010+
10111011
auto pqTabletConfigPartStrategy = pqTabletConfig->MutablePartitionStrategy();
10121012
auto autoscaleSettings = settings.auto_partitioning_settings();
10131013
pqTabletConfigPartStrategy->SetMinPartitionCount(minParts);

ydb/services/persqueue_v1/topic_yql_ut.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ Y_UNIT_TEST_SUITE(TTopicYqlTest) {
3535
CREATE TOPIC `/Root/PQ/rt3.dc1--legacy--topic1` (
3636
CONSUMER c1
3737
) WITH (min_active_partitions = 2,
38-
partition_count_limit = 5
38+
partition_count_limit = 5,
39+
auto_partitioning_strategy = 'scale_up'
3940
);
4041
)__";
4142

0 commit comments

Comments
 (0)