From 7a0c4d248257259612d3471ab42669ca9d90c573 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 24 Nov 2014 22:05:07 +0900 Subject: [PATCH] Remove invalid connection checking in db_replicator Account/Container-replicator checks connection generation and timeout in HTTP REPLICATE Request in _repl_to_node, but it doesn't really checks connection but only construction of ReplConnection class. This patch removes that invalid checking. Change-Id: Ie6b4062123d998e69c15638b741e7d1ba8a08b62 Closes-Bug: #1359018 --- swift/common/db_replicator.py | 9 ++------- test/unit/common/test_db_replicator.py | 5 ----- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/swift/common/db_replicator.py b/swift/common/db_replicator.py index c03a13790a..6fcd425647 100644 --- a/swift/common/db_replicator.py +++ b/swift/common/db_replicator.py @@ -35,7 +35,7 @@ from swift.common.utils import get_logger, whataremyips, storage_directory, \ from swift.common import ring from swift.common.http import HTTP_NOT_FOUND, HTTP_INSUFFICIENT_STORAGE from swift.common.bufferedhttp import BufferedHTTPConnection -from swift.common.exceptions import DriveNotMounted, ConnectionTimeout +from swift.common.exceptions import DriveNotMounted from swift.common.daemon import Daemon from swift.common.swob import Response, HTTPNotFound, HTTPNoContent, \ HTTPAccepted, HTTPBadRequest @@ -370,12 +370,7 @@ class Replicator(Daemon): :returns: True if successful, False otherwise """ - with ConnectionTimeout(self.conn_timeout): - http = self._http_connect(node, partition, broker.db_file) - if not http: - self.logger.error( - _('ERROR Unable to connect to remote server: %s'), node) - return False + http = self._http_connect(node, partition, broker.db_file) sync_args = self._gather_sync_args(info) with Timeout(self.node_timeout): response = http.replicate('sync', *sync_args) diff --git a/test/unit/common/test_db_replicator.py b/test/unit/common/test_db_replicator.py index 67faa330d9..02c3345d20 100644 --- a/test/unit/common/test_db_replicator.py +++ b/test/unit/common/test_db_replicator.py @@ -1230,11 +1230,6 @@ class TestReplToNode(unittest.TestCase): self.assertEquals(self.replicator._repl_to_node( self.fake_node, FakeBroker(), '0', self.fake_info), None) - def test_repl_to_node_http_connect_fails(self): - self.replicator._http_connect = lambda *args: None - self.assertEquals(self.replicator._repl_to_node( - self.fake_node, FakeBroker(), '0', self.fake_info), False) - def test_repl_to_node_not_response(self): self.http = mock.Mock(replicate=mock.Mock(return_value=None)) self.assertEquals(self.replicator._repl_to_node(