aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Veselov <sergeyveselov@ydb.tech>2024-04-19 19:32:32 +0300
committerGitHub <noreply@github.com>2024-04-19 19:32:32 +0300
commit88fefcb6dd3dc017d02f358601746cc4628c01f1 (patch)
treea136164f9988a98d5d2ebe6e1b69985a66d961c6
parentd5b74e34cc79635f39250b4d229f72734c589f77 (diff)
downloadydb-88fefcb6dd3dc017d02f358601746cc4628c01f1.tar.gz
fix failing on verify in sqs when throttling budget is over and action does not require existing queue (#3938)
-rw-r--r--ydb/core/ymq/actor/action.h4
-rw-r--r--ydb/core/ymq/actor/service.cpp1
-rw-r--r--ydb/tests/functional/sqs/common/test_throttling_nonexistent_queue.py27
3 files changed, 28 insertions, 4 deletions
diff --git a/ydb/core/ymq/actor/action.h b/ydb/core/ymq/actor/action.h
index 8ea1cb814c..a594f5eafe 100644
--- a/ydb/core/ymq/actor/action.h
+++ b/ydb/core/ymq/actor/action.h
@@ -649,6 +649,8 @@ private:
}
}
+ Y_ABORT_UNLESS(SchemeCache_);
+
bool isACLProtectedAccount = Cfg().GetForceAccessControl();
if (!IsCloud() && (SecurityToken_ || (Cfg().GetForceAccessControl() && (isACLProtectedAccount = IsACLProtectedAccount(UserName_))))) {
this->Become(&TActionActor::WaitAuthCheckMessages);
@@ -666,8 +668,6 @@ private:
return;
}
- Y_ABORT_UNLESS(SchemeCache_);
-
RequestSchemeCache(GetActionACLSourcePath()); // this also checks that requested queue (if any) does exist
RequestTicketParser();
} else {
diff --git a/ydb/core/ymq/actor/service.cpp b/ydb/core/ymq/actor/service.cpp
index 04498866da..9181d88d9b 100644
--- a/ydb/core/ymq/actor/service.cpp
+++ b/ydb/core/ymq/actor/service.cpp
@@ -685,6 +685,7 @@ void TSqsService::AnswerThrottled(TSqsEvents::TEvGetConfiguration::TPtr& ev) {
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");
auto answer = MakeHolder<TSqsEvents::TEvConfiguration>();
answer->Throttled = true;
+ answer->SchemeCache = SchemeCache_;
Send(ev->Sender, answer.Release());
}
diff --git a/ydb/tests/functional/sqs/common/test_throttling_nonexistent_queue.py b/ydb/tests/functional/sqs/common/test_throttling_nonexistent_queue.py
index 2ed57a9ac3..05d4abc70c 100644
--- a/ydb/tests/functional/sqs/common/test_throttling_nonexistent_queue.py
+++ b/ydb/tests/functional/sqs/common/test_throttling_nonexistent_queue.py
@@ -5,8 +5,11 @@ from hamcrest import assert_that, raises
from ydb.tests.library.sqs.test_base import KikimrSqsTestBase
+throttling_exception_pattern = ".*</Message><Code>ThrottlingException</Code>.*"
+
class TestSqsThrottlingOnNonexistentQueue(KikimrSqsTestBase):
+
def test_throttling_on_nonexistent_queue(self):
queue_url = self._create_queue_and_assert(self.queue_name, False, True)
nonexistent_queue_url = queue_url + "_nonex"
@@ -21,8 +24,6 @@ class TestSqsThrottlingOnNonexistentQueue(KikimrSqsTestBase):
except Exception:
pass
- throttling_exception_pattern = ".*</Message><Code>ThrottlingException</Code>.*"
-
assert_that(
get_attributes_of_nonexistent_queue,
raises(
@@ -46,3 +47,25 @@ class TestSqsThrottlingOnNonexistentQueue(KikimrSqsTestBase):
pattern=throttling_exception_pattern
)
)
+
+ def test_action_which_does_not_requere_existing_queue(self):
+ queue_url = self._create_queue_and_assert(self.queue_name, False, True)
+ nonexistent_queue_url = queue_url + "_nonex"
+
+ def get_attributes_of_nonexistent_queue():
+ self._sqs_api.get_queue_attributes(nonexistent_queue_url)
+
+ # Draining budget
+ for _ in range(16):
+ try:
+ get_attributes_of_nonexistent_queue()
+ except Exception:
+ pass
+
+ assert_that(
+ lambda: self._sqs_api.get_queue_url(self.queue_name + "_nonex"),
+ raises(
+ RuntimeError,
+ pattern=throttling_exception_pattern
+ )
+ )