diff options
author | Marko Kreen | 2012-11-01 12:18:07 +0000 |
---|---|---|
committer | Marko Kreen | 2012-11-02 08:40:09 +0000 |
commit | 9fb75b521939537803ce1942009478902918cbda (patch) | |
tree | 76199ab0ba6350c6e0a4715eeac8752fa16bca4b | |
parent | 7a27122a063e58ed9e9c375744cdb01ec8a49933 (diff) |
find_copy_source: also return downstream worker name
-rw-r--r-- | python/londiste/table_copy.py | 2 | ||||
-rw-r--r-- | python/londiste/util.py | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/python/londiste/table_copy.py b/python/londiste/table_copy.py index b529771a..f325a7c2 100644 --- a/python/londiste/table_copy.py +++ b/python/londiste/table_copy.py @@ -252,7 +252,7 @@ class CopyTable(Replicator): # do we have node here? if 'copy_node' in attrs: if attrs['copy_node'] == '?': - source_node, source_location = find_copy_source(self, + source_node, source_location, wname = find_copy_source(self, self.queue_name, self.copy_table_name, source_node, source_location) else: # take node from attrs diff --git a/python/londiste/util.py b/python/londiste/util.py index 398f1992..db7e72fe 100644 --- a/python/londiste/util.py +++ b/python/londiste/util.py @@ -21,8 +21,12 @@ def find_copy_source(script, queue_name, copy_table_name, node_name, node_locati @param copy_table_name: name of the table @param node_name: target node name @param node_location: target node location - @returns (node_name, node_location) of source node + @returns (node_name, node_location, downstream_worker_name) of source node """ + + # None means no steps upwards were taken, so local consumer is worker + worker_name = None + while 1: src_db = script.get_database('_source_db', connstr = node_location, autocommit = 1) src_curs = src_db.cursor() @@ -56,7 +60,7 @@ def find_copy_source(script, queue_name, copy_table_name, node_name, node_locati if got: script.log.info("Node %s seems good source, using it", info['node_name']) - return node_name, node_location + return node_name, node_location, worker_name if info['node_type'] == 'root': raise skytools.UsageError("Found root and no source found") @@ -64,4 +68,5 @@ def find_copy_source(script, queue_name, copy_table_name, node_name, node_locati # walk upwards node_name = info['provider_node'] node_location = info['provider_location'] + worker_name = info['worker_name'] |