Skip to content

Commit e7724da

Browse files
authored
Revert "[EventHub] Raise error when primary key is rotated" (#37622)
* Revert "[EventHub] Raise error when primary key is rotated (#36245)" This reverts commit 3b2dfa4. * skip windows tests
1 parent ae22841 commit e7724da

File tree

11 files changed

+6
-26
lines changed

11 files changed

+6
-26
lines changed

sdk/eventhub/azure-eventhub/CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
### Bugs Fixed
1010

11-
- Fixed a bug where the consumer waited indefinitely when the primary key was rotated while receiving, rather than raising an authentication error. ([#33926](https://github.com/Azure/azure-sdk-for-python/issues/33926))
12-
1311
### Other Changes
1412

1513
## 5.12.1 (2024-06-11)

sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,6 @@ def receive(self, batch=False, max_batch_size=300, max_wait_time=None):
236236
# If optional dependency is not installed, do not retry.
237237
if isinstance(exception, ImportError):
238238
raise exception
239-
240-
# If authentication exception, do not retry.
241-
if isinstance(exception, self._amqp_transport.AUTHENTICATION_EXCEPTION):
242-
raise self._handle_exception(exception, is_consumer=True)
243-
244239
self._amqp_transport.check_link_stolen(self, exception)
245240
# TODO: below block hangs when retry_total > 0
246241
# need to remove/refactor, issue #27137

sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_base.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
ReceiveClient as uamqp_ReceiveClient,
3131
)
3232
from uamqp.authentication import JWTTokenAuth as uamqp_JWTTokenAuth
33-
from uamqp.errors import AuthenticationException as uamqp_AuthenticationException
3433

3534
except ImportError:
3635
pass
@@ -49,7 +48,6 @@
4948
from .._pyamqp.constants import (
5049
ConnectionState as pyamqp_ConnectionState
5150
)
52-
from .._pyamqp.error import AuthenticationException as pyamqp_AuthenticationException
5351

5452
class AmqpTransport(ABC): # pylint: disable=too-many-public-methods
5553
"""
@@ -78,9 +76,6 @@ class AmqpTransport(ABC): # pylint: disable=too-many-public-methods
7876
USER_AGENT_SYMBOL: Union[uamqp_Types_AMQPSymbol, str, bytes]
7977
PROP_PARTITION_KEY_AMQP_SYMBOL: Union[uamqp_Types_AMQPSymbol, str, bytes]
8078

81-
# exceptions
82-
AUTHENTICATION_EXCEPTION: Union["uamqp_AuthenticationException", "pyamqp_AuthenticationException"]
83-
8479
@staticmethod
8580
@abstractmethod
8681
def build_message(**kwargs: Any) -> Union["uamqp_Message", "pyamqp_Message"]:

sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_pyamqp_transport.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ class PyamqpTransport(AmqpTransport): # pylint: disable=too-many-public-method
7272

7373
ERROR_CONDITIONS = [condition.value for condition in errors.ErrorCondition]
7474

75-
# define exceptions
76-
AUTHENTICATION_EXCEPTION = errors.AuthenticationException
77-
7875
@staticmethod
7976
def build_message(**kwargs):
8077
"""

sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_uamqp_transport.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ class UamqpTransport(AmqpTransport): # pylint: disable=too-many-public-method
122122
USER_AGENT_SYMBOL = types.AMQPSymbol("user-agent")
123123
PROP_PARTITION_KEY_AMQP_SYMBOL = types.AMQPSymbol(PROP_PARTITION_KEY)
124124

125-
# define exceptions
126-
AUTHENTICATION_EXCEPTION = errors.AuthenticationException
127-
128125
@staticmethod
129126
def build_message(**kwargs):
130127
"""

sdk/eventhub/azure-eventhub/azure/eventhub/aio/_connection_manager_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(
6262
**kwargs: Any
6363
) -> None:
6464
self._loop = kwargs.get("loop")
65-
self._lock = Lock(loop=self._loop) # pylint: disable=unexpected-keyword-arg
65+
self._lock = Lock(loop=self._loop)
6666
self._conn: Optional[Union[uamqp_ConnectionAsync, ConnectionAsync]] = None
6767

6868
self._container_id = container_id

sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_base_async.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class AmqpTransportAsync(ABC): # pylint: disable=too-many-public-methods
7979
USER_AGENT_SYMBOL: Union[uamqp_Types_AMQPSymbol, Literal["user-agent"]]
8080
PROP_PARTITION_KEY_AMQP_SYMBOL: Union[uamqp_Types_AMQPSymbol, Literal[b'x-opt-partition-key']]
8181

82+
8283
@staticmethod
8384
@abstractmethod
8485
def build_message(**kwargs: Any) -> Union["uamqp_Message", "pyamqp_Message"]:

sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_pyamqp_transport_async.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,6 @@ async def _receive_task(consumer, max_batch_size):
278278
# If optional dependency is not installed, do not retry.
279279
if isinstance(exception, ImportError):
280280
raise exception
281-
# If authentication exception, do not retry.
282-
if isinstance(exception, errors.AuthenticationException):
283-
raise await consumer._handle_exception(exception)
284281
if (
285282
isinstance(exception, errors.AMQPLinkError)
286283
and exception.condition == errors.ErrorCondition.LinkStolen # pylint: disable=no-member

sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_uamqp_transport_async.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,6 @@ async def receive_messages_async(
283283
except asyncio.CancelledError: # pylint: disable=try-except-raise
284284
raise
285285
except Exception as exception: # pylint: disable=broad-except
286-
# If authentication exception, do not retry.
287-
if isinstance(exception, errors.AuthenticationException):
288-
raise await consumer._handle_exception(exception)
289286
if (
290287
isinstance(exception, errors.LinkDetach)
291288
and exception.condition == constants.ErrorCodes.LinkStolen # pylint: disable=no-member

sdk/eventhub/azure-eventhub/tests/livetest/asynctests/test_properties_async.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# license information.
55
# --------------------------------------------------------------------------
66

7+
import sys
78
import pytest
89

910
from azure.eventhub.aio import (
@@ -101,6 +102,7 @@ async def test_get_partition_ids(auth_credentials_async, uamqp_transport):
101102
assert partition_ids == ["0", "1"]
102103

103104

105+
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Large negative timestamp to datetime conversion fails on Windows with: https://bugs.python.org/issue36439")
104106
@pytest.mark.liveTest
105107
@pytest.mark.asyncio
106108
async def test_get_partition_properties(auth_credentials_async, uamqp_transport):

sdk/eventhub/azure-eventhub/tests/livetest/synctests/test_properties.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# license information.
55
# --------------------------------------------------------------------------
66

7+
import sys
78
import pytest
89

910
from azure.eventhub import EventHubSharedKeyCredential
@@ -97,7 +98,7 @@ def test_get_partition_ids(auth_credentials, uamqp_transport):
9798
partition_ids = client.get_partition_ids()
9899
assert partition_ids == ["0", "1"]
99100

100-
101+
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Large negative timestamp to datetime conversion fails on Windows with: https://bugs.python.org/issue36439")
101102
@pytest.mark.liveTest
102103
def test_get_partition_properties(auth_credentials, uamqp_transport):
103104
fully_qualified_namespace, eventhub_name, credential = auth_credentials

0 commit comments

Comments
 (0)