Skip to content

Commit 1520164

Browse files
YMQ Verify fix (#3945)
Co-authored-by: Sergey Veselov <[email protected]>
1 parent b571990 commit 1520164

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

ydb/core/ymq/actor/action.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,8 @@ class TActionActor
649649
}
650650
}
651651

652+
Y_ABORT_UNLESS(SchemeCache_);
653+
652654
bool isACLProtectedAccount = Cfg().GetForceAccessControl();
653655
if (!IsCloud() && (SecurityToken_ || (Cfg().GetForceAccessControl() && (isACLProtectedAccount = IsACLProtectedAccount(UserName_))))) {
654656
this->Become(&TActionActor::WaitAuthCheckMessages);
@@ -666,8 +668,6 @@ class TActionActor
666668
return;
667669
}
668670

669-
Y_ABORT_UNLESS(SchemeCache_);
670-
671671
RequestSchemeCache(GetActionACLSourcePath()); // this also checks that requested queue (if any) does exist
672672
RequestTicketParser();
673673
} else {

ydb/core/ymq/actor/service.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ void TSqsService::AnswerThrottled(TSqsEvents::TEvGetConfiguration::TPtr& ev) {
685685
RLOG_SQS_REQ_DEBUG(ev->Get()->RequestId, "Throttled because of too many requests for nonexistent queue [" << ev->Get()->QueueName << "] for user [" << ev->Get()->UserName << "] while getting configuration");
686686
auto answer = MakeHolder<TSqsEvents::TEvConfiguration>();
687687
answer->Throttled = true;
688+
answer->SchemeCache = SchemeCache_;
688689
Send(ev->Sender, answer.Release());
689690
}
690691

ydb/tests/functional/sqs/common/test_throttling_nonexistent_queue.py

+24-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from ydb.tests.library.sqs.test_base import KikimrSqsTestBase
66

7+
throttling_exception_pattern = ".*</Message><Code>ThrottlingException</Code>.*"
8+
79

810
class TestSqsThrottlingOnNonexistentQueue(KikimrSqsTestBase):
911

@@ -21,8 +23,6 @@ def get_attributes_of_nonexistent_queue():
2123
except Exception:
2224
pass
2325

24-
throttling_exception_pattern = ".*</Message><Code>ThrottlingException</Code>.*"
25-
2626
assert_that(
2727
get_attributes_of_nonexistent_queue,
2828
raises(
@@ -46,3 +46,25 @@ def get_attributes_of_nonexistent_queue():
4646
pattern=throttling_exception_pattern
4747
)
4848
)
49+
50+
def test_action_which_does_not_requere_existing_queue(self):
51+
queue_url = self._create_queue_and_assert(self.queue_name, False, True)
52+
nonexistent_queue_url = queue_url + "_nonex"
53+
54+
def get_attributes_of_nonexistent_queue():
55+
self._sqs_api.get_queue_attributes(nonexistent_queue_url)
56+
57+
# Draining budget
58+
for _ in range(16):
59+
try:
60+
get_attributes_of_nonexistent_queue()
61+
except Exception:
62+
pass
63+
64+
assert_that(
65+
lambda: self._sqs_api.get_queue_url(self.queue_name + "_nonex"),
66+
raises(
67+
RuntimeError,
68+
pattern=throttling_exception_pattern
69+
)
70+
)

0 commit comments

Comments
 (0)