@@ -2343,19 +2343,19 @@ bool TPartition::ExecUserActionOrTransaction(TSimpleSharedPtr<TTransaction>& t,
2343
2343
return true ;
2344
2344
}
2345
2345
2346
- std::pair<bool , bool > TPartition::ValidatePartitionOperation (const NKikimrPQ::TPartitionOperation& operation) {
2346
+ std::pair<TString , bool > TPartition::ValidatePartitionOperation (const NKikimrPQ::TPartitionOperation& operation) {
2347
2347
const TString& consumer = operation.GetConsumer ();
2348
2348
2349
2349
if (AffectedUsers.contains (consumer) && !GetPendingUserIfExists (consumer)) {
2350
2350
PQ_LOG_D (" Partition " << Partition <<
2351
2351
" Consumer '" << consumer << " ' has been removed" );
2352
- return {false , false };
2352
+ return {TStringBuilder () << " Consumer ' " << consumer << " ' has been removed " , false };
2353
2353
}
2354
2354
2355
2355
if (!UsersInfoStorage->GetIfExists (consumer)) {
2356
2356
PQ_LOG_D (" Partition " << Partition <<
2357
2357
" Unknown consumer '" << consumer << " '" );
2358
- return {false , false };
2358
+ return {TStringBuilder () << " Unknown consumer ' " << consumer << " ' " , false };
2359
2359
}
2360
2360
2361
2361
TUserInfoBase& userInfo = GetOrCreatePendingUser (consumer);
@@ -2367,12 +2367,12 @@ std::pair<bool, bool> TPartition::ValidatePartitionOperation(const NKikimrPQ::TP
2367
2367
" RequestSessionId '" << operation.GetReadSessionId () <<
2368
2368
" ' CurrentSessionId '" << userInfo.Session <<
2369
2369
" '" );
2370
- return {false , false };
2370
+ return {" Bad request (session already dead) " , false };
2371
2371
} else if (operation.GetOnlyCheckCommitedToFinish ()) {
2372
2372
if (IsActive () || static_cast <ui64>(userInfo.Offset ) != EndOffset) {
2373
- return {false , false };
2373
+ return {TStringBuilder () << " There are uncommitted messages in partition " << Partition. OriginalPartitionId , false };
2374
2374
} else {
2375
- return {true , false };
2375
+ return {" " , false };
2376
2376
}
2377
2377
} else {
2378
2378
if (!operation.GetForceCommit () && operation.GetCommitOffsetsBegin () > operation.GetCommitOffsetsEnd ()) {
@@ -2381,23 +2381,23 @@ std::pair<bool, bool> TPartition::ValidatePartitionOperation(const NKikimrPQ::TP
2381
2381
" Bad request (invalid range) " <<
2382
2382
" Begin " << operation.GetCommitOffsetsBegin () <<
2383
2383
" End " << operation.GetCommitOffsetsEnd ());
2384
- return {false , true };
2384
+ return {" Bad request (invalid range) " , true };
2385
2385
} else if (!operation.GetForceCommit () && userInfo.Offset != (i64 )operation.GetCommitOffsetsBegin ()) {
2386
2386
PQ_LOG_D (" Partition " << Partition <<
2387
2387
" Consumer '" << consumer << " '" <<
2388
2388
" Bad request (gap) " <<
2389
2389
" Offset " << userInfo.Offset <<
2390
2390
" Begin " << operation.GetCommitOffsetsBegin ());
2391
- return {false , true };
2391
+ return {" Bad request (gap) " , true };
2392
2392
} else if (!operation.GetForceCommit () && operation.GetCommitOffsetsEnd () > EndOffset) {
2393
2393
PQ_LOG_D (" Partition " << Partition <<
2394
2394
" Consumer '" << consumer << " '" <<
2395
2395
" Bad request (behind the last offset) " <<
2396
2396
" EndOffset " << EndOffset <<
2397
2397
" End " << operation.GetCommitOffsetsEnd ());
2398
- return {false , true };
2398
+ return {" Bad request (behind the last offset " , true };
2399
2399
}
2400
- return {true , true };
2400
+ return {" " , true };
2401
2401
}
2402
2402
}
2403
2403
@@ -2419,11 +2419,11 @@ TPartition::EProcessResult TPartition::BeginTransaction(const TEvPQ::TEvTxCalcPr
2419
2419
return EProcessResult::Blocked;
2420
2420
}
2421
2421
2422
- auto [r , real] = ValidatePartitionOperation (operation);
2423
- result = r ;
2422
+ auto [error , real] = ValidatePartitionOperation (operation);
2423
+ result = error. empty () ;
2424
2424
2425
2425
if (real) {
2426
- if (!r ) {
2426
+ if (!result ) {
2427
2427
bool isAffectedConsumer = AffectedUsers.contains (consumer);
2428
2428
2429
2429
if (!isAffectedConsumer) {
@@ -2433,7 +2433,7 @@ TPartition::EProcessResult TPartition::BeginTransaction(const TEvPQ::TEvTxCalcPr
2433
2433
}
2434
2434
consumers.insert (consumer);
2435
2435
}
2436
- if (!r ) {
2436
+ if (!result ) {
2437
2437
break ;
2438
2438
}
2439
2439
}
@@ -2929,12 +2929,12 @@ TPartition::EProcessResult TPartition::PreProcessImmediateTx(const NKikimrPQ::TE
2929
2929
return EProcessResult::ContinueDrop;
2930
2930
}
2931
2931
2932
- auto [r , real] = ValidatePartitionOperation (operation);
2933
- if (!r ) {
2932
+ auto [error , real] = ValidatePartitionOperation (operation);
2933
+ if (!error. empty () ) {
2934
2934
ScheduleReplyPropose (tx,
2935
2935
NKikimrPQ::TEvProposeTransactionResult::BAD_REQUEST,
2936
2936
NKikimrPQ::TError::BAD_REQUEST,
2937
- " incorrect request " );
2937
+ error );
2938
2938
return EProcessResult::ContinueDrop;
2939
2939
}
2940
2940
0 commit comments