Skip to content

Commit 329f48d

Browse files
siarheivesialoualexnick88
authored andcommitted
fix failing on verify in sqs when throttling budget is over and action does not require existing queue (#3938)
1 parent 8be657b commit 329f48d

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

ydb/core/ymq/actor/action.h

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
from ydb.tests.library.sqs.test_base import KikimrSqsTestBase
66

77

8+
throttling_exception_pattern = ".*</Message><Code>ThrottlingException</Code>.*"
9+
810
class TestSqsThrottlingOnNonexistentQueue(KikimrSqsTestBase):
911

12+
1013
def test_throttling_on_nonexistent_queue(self):
1114
queue_url = self._create_queue_and_assert(self.queue_name, False, True)
1215
nonexistent_queue_url = queue_url + "_nonex"
@@ -21,8 +24,6 @@ def get_attributes_of_nonexistent_queue():
2124
except Exception:
2225
pass
2326

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

0 commit comments

Comments
 (0)