Skip to content

Commit 7700f39

Browse files
aaron-congojonathanl-bq
authored andcommitted
Fix failover2 wrong writer host
1 parent 57bd181 commit 7700f39

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

aws_advanced_python_wrapper/cluster_topology_monitor.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@
2020
from concurrent.futures import ThreadPoolExecutor
2121
from typing import TYPE_CHECKING, Dict, Optional
2222

23-
from aws_advanced_python_wrapper.errors import AwsWrapperError
2423
from aws_advanced_python_wrapper.host_availability import HostAvailability
2524
from aws_advanced_python_wrapper.hostinfo import HostInfo
2625
from aws_advanced_python_wrapper.utils.atomic import AtomicReference
2726
from aws_advanced_python_wrapper.utils.messages import Messages
28-
from aws_advanced_python_wrapper.utils.rds_utils import RdsUtils
29-
from aws_advanced_python_wrapper.utils.storage.storage_service import (
30-
StorageService, Topology)
27+
from aws_advanced_python_wrapper.utils.rdsutils import RdsUtils
3128
from aws_advanced_python_wrapper.utils.thread_safe_connection_holder import \
3229
ThreadSafeConnectionHolder
3330
from aws_advanced_python_wrapper.utils.utils import LogUtils
@@ -307,8 +304,8 @@ def _open_any_connection_and_update_topology(self) -> Topology:
307304
self._cluster_id, self._initial_host_info.host)
308305

309306
try:
310-
writer_id = self._topology_utils.get_writer_id_if_connected(
311-
conn, self._plugin_service.driver_dialect)
307+
writer_id = self._topology_utils.get_writer_host_if_connected(
308+
conn, self._plugin_service.driver_dialect)
312309
if writer_id:
313310
self._is_verified_writer_connection = True
314311
writer_verified_by_this_thread = True
@@ -317,10 +314,9 @@ def _open_any_connection_and_update_topology(self) -> Topology:
317314
writer_host_info = self._initial_host_info
318315
self._writer_host_info.set(writer_host_info)
319316
else:
320-
instance_template = self._get_instance_template(writer_id, conn)
321-
writer_host = instance_template.host.replace("?", writer_id)
322-
port = instance_template.port \
323-
if instance_template.is_port_specified() \
317+
writer_host = self._instance_template.host.replace("?", writer_id)
318+
port = self._instance_template.port \
319+
if self._instance_template.is_port_specified() \
324320
else self._initial_host_info.port
325321
writer_host_info = HostInfo(
326322
writer_host,

0 commit comments

Comments
 (0)