From ac7cdcd95011eb044e0298ac7894a44b008e259d Mon Sep 17 00:00:00 2001 From: Mitya_Eremeev Date: Thu, 13 Feb 2025 19:16:23 +0300 Subject: [PATCH] Do AXFR with latest data Primary Designate updates zone and notifies Secondary Designate simultaneously. That's why Secondary Designate doesn't do AXFR or gets the previous version. Now Primary Designate updates zone and backend. If backend is updated successfuly, then Designate notifies Secondary Designate. Closes-Bug: #2098388 Change-Id: Ib0c8523e47c61638b3f579091a1955c96aa81a6b --- designate/tests/unit/workers/test_service.py | 6 +++--- designate/worker/service.py | 14 +++++++------- .../fix-axfr-actions-order-4fa6c792bcfe67a9.yaml | 9 +++++++++ 3 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/fix-axfr-actions-order-4fa6c792bcfe67a9.yaml diff --git a/designate/tests/unit/workers/test_service.py b/designate/tests/unit/workers/test_service.py index b7e1d21e9..38ce74da2 100644 --- a/designate/tests/unit/workers/test_service.py +++ b/designate/tests/unit/workers/test_service.py @@ -251,7 +251,7 @@ class WorkerServiceTest(oslotest.base.BaseTestCase): self.zone_params ) - self.service._executor.run.assert_called_with([mock_zone_action()]) + self.service._executor.run.assert_has_calls(mock_zone_action(), list()) @mock.patch.object(service.zonetasks, 'ZoneAction') @mock.patch.object(service.zonetasks, 'SendNotify') @@ -280,8 +280,8 @@ class WorkerServiceTest(oslotest.base.BaseTestCase): self.zone_params ) - self.service._executor.run.assert_called_with( - [mock_zone_action(), mock_send_notify()] + self.service._executor.run.assert_has_calls( + mock_zone_action(), [mock_send_notify()] ) def test_get_pool(self): diff --git a/designate/worker/service.py b/designate/worker/service.py index 2f2c690cb..abf5f03da 100644 --- a/designate/worker/service.py +++ b/designate/worker/service.py @@ -142,20 +142,20 @@ class Service(service.RPCService): def _do_zone_action(self, context, zone, zone_params=None): pool = self.get_pool(zone.pool_id) - all_tasks = [ - zonetasks.ZoneAction(self.executor, context, pool, zone, - zone.action, zone_params) - ] - + zone_action = zonetasks.ZoneAction( + self.executor, context, pool, zone, zone.action, zone_params) + all_tasks_result = self.executor.run(zone_action) # Send a NOTIFY to each also-notifies + also_notifies_tasks = list() for also_notify in pool.also_notifies: notify_target = AlsoNotifyTask() notify_target.options = {'host': also_notify.host, 'port': also_notify.port} - all_tasks.append(zonetasks.SendNotify(self.executor, + also_notifies_tasks.append(zonetasks.SendNotify(self.executor, zone, notify_target)) - return self.executor.run(all_tasks) + all_tasks_result.extend(self.executor.run(also_notifies_tasks)) + return all_tasks_result @rpc.expected_exceptions() def create_zone(self, context, zone): diff --git a/releasenotes/notes/fix-axfr-actions-order-4fa6c792bcfe67a9.yaml b/releasenotes/notes/fix-axfr-actions-order-4fa6c792bcfe67a9.yaml new file mode 100644 index 000000000..f663f5a5c --- /dev/null +++ b/releasenotes/notes/fix-axfr-actions-order-4fa6c792bcfe67a9.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + If primary zone is updated, Designate does two actions simultaneously: + 1) sends NOTIFY to secondary DNS server + 2) updates its backend + Notification is significantly faster then backend update. So secondary DNS + server gets previous zone version (SOA). + Now it's fixed. Designate sends NOTIFY after successful backend update.