summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMarko Kreen2011-12-29 12:55:40 +0000
committerMarko Kreen2011-12-29 12:55:40 +0000
commit26c943faf137742f7caa856a6208550f5e7ccdb1 (patch)
tree1e78af5febef047a432894e1d9dad2f29d5ff087 /python
parentfa83935e0c7c05acff70621e470cfb42e68910d9 (diff)
londiste.syncer: load per-table handler
this is preparation for compare/repair for subset of table.
Diffstat (limited to 'python')
-rw-r--r--python/londiste/syncer.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/python/londiste/syncer.py b/python/londiste/syncer.py
index b5dd58d0..65fbb6e7 100644
--- a/python/londiste/syncer.py
+++ b/python/londiste/syncer.py
@@ -3,12 +3,17 @@
"""
import sys, time, skytools
+from londiste.handler import build_handler, load_handler_modules
class ATable:
def __init__(self, row):
self.table_name = row['table_name']
self.dest_table = row['dest_table'] or row['table_name']
self.merge_state = row['merge_state']
+ attrs = row['table_attrs'] or ''
+ self.table_attrs = skytools.db_urldecode(attrs)
+ hstr = self.table_attrs.get('handler', '')
+ self.plugin = build_handler(self.table_name, hstr, row['dest_table'])
class Syncer(skytools.DBScript):
"""Walks tables in primary key order and checks if data matches."""
@@ -35,6 +40,8 @@ class Syncer(skytools.DBScript):
if self.pidfile:
self.pidfile += ".repair"
+ load_handler_modules(self.cf)
+
def set_lock_timeout(self, curs):
ms = int(1000 * self.lock_timeout)
if ms > 0:
@@ -74,7 +81,7 @@ class Syncer(skytools.DBScript):
Returns tuple of (dict(name->ATable), namelist)"""
curs = db.cursor()
- q = "select table_name, merge_state, dest_table"\
+ q = "select table_name, merge_state, dest_table, table_attrs"\
" from londiste.get_table_list(%s) where local"
curs.execute(q, [self.queue_name])
rows = curs.fetchall()