summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMarko Kreen2011-10-21 10:35:17 +0000
committerMarko Kreen2011-10-21 10:35:17 +0000
commit3427ec84f10af95a9c5acc2d1bbc4a88f25ecb4c (patch)
treed42432323faca4df05ab0c356333e2a940edee69 /python
parent37ec8fc09ba897b02a1ca871055eb69a00deceae (diff)
londiste.handlers.dispatch: cache dist fields
Diffstat (limited to 'python')
-rw-r--r--python/londiste/handlers/dispatch.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/python/londiste/handlers/dispatch.py b/python/londiste/handlers/dispatch.py
index 5d08f225..f5d48f57 100644
--- a/python/londiste/handlers/dispatch.py
+++ b/python/londiste/handlers/dispatch.py
@@ -374,6 +374,7 @@ class BulkLoader(BaseBulkTempLoader):
def __init__(self, table, pkeys, log, conf):
BaseBulkTempLoader.__init__(self, table, pkeys, log, conf)
self.method = self.conf['method']
+ self.dist_fields = None
# is temp table created
self.temp_present = False
@@ -451,12 +452,15 @@ class BulkLoader(BaseBulkTempLoader):
self.table, len(op_map['I']), len(op_map['U']), len(op_map['D'])))
# fetch distribution fields
- dist_keys = self.find_dist_fields(curs)
- self.log.debug("PKey fields: %s Dist fields: %s" % (
- ",".join(self.pkeys), ",".join(dist_keys)))
- for key in dist_keys:
- if key not in self.keys:
- self.keys.append(key)
+ if self.dist_fields is None:
+ self.dist_fields = self.find_dist_fields(curs)
+ self.log.debug("Key fields: %s Dist fields: %s" % (
+ ",".join(self.pkeys), ",".join(self.dist_fields)))
+ # add them to key
+ for key in self.dist_fields:
+ if key not in self.keys:
+ self.keys.append(key)
+
# check if temp table present
self.check_temp(curs)
# process I,U,D