diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/londiste/compare.py | 7 | ||||
| -rw-r--r-- | python/londiste/handler.py | 2 | ||||
| -rw-r--r-- | python/londiste/handlers/dispatch.py | 6 |
3 files changed, 11 insertions, 4 deletions
diff --git a/python/londiste/compare.py b/python/londiste/compare.py index ff304f0a..a92ae513 100644 --- a/python/londiste/compare.py +++ b/python/londiste/compare.py @@ -35,9 +35,14 @@ class Comparator(Syncer): # get sane query v1 = src_db.server_version v2 = dst_db.server_version - if (v1 < 80400 or v2 < 80400) and v1 != v2: + if v1 < 80300 or v2 < 80300: + # 8.2- does not have record to text and text to bit casts, so we need to use a bit of evil hackery + q = "select count(1) as cnt, sum(bit_in(textout('x'||substr(md5(textin(record_out(_COLS_))),1,16)), 0, 64)::bigint) as chksum from only _TABLE_" + elif (v1 < 80400 or v2 < 80400) and v1 != v2: + # hashtext changed in 8.4 so we need to use md5 in case there is 8.3 vs 8.4+ comparison q = "select count(1) as cnt, sum(('x'||substr(md5(_COLS_::text),1,16))::bit(64)::bigint) as chksum from only _TABLE_" else: + # this way is much faster than the above q = "select count(1) as cnt, sum(hashtext(_COLS_::text)::bigint) as chksum from only _TABLE_" q = self.cf.get('compare_sql', q) diff --git a/python/londiste/handler.py b/python/londiste/handler.py index d19b517f..51fa603a 100644 --- a/python/londiste/handler.py +++ b/python/londiste/handler.py @@ -333,6 +333,8 @@ def _parse_arglist(arglist): def create_handler_string(name, arglist): handler = name + if name.find('(') >= 0: + raise Exception('invalid handler name: %s' % name) if arglist: args = _parse_arglist(arglist) astr = skytools.db_urlencode(args) diff --git a/python/londiste/handlers/dispatch.py b/python/londiste/handlers/dispatch.py index ecbc6285..9acc43ce 100644 --- a/python/londiste/handlers/dispatch.py +++ b/python/londiste/handlers/dispatch.py @@ -44,8 +44,8 @@ table_mode: * ignore - all events are ignored part_func: - database function to use for creating partition table. if not found then - parent table is cloned. default is {londiste|public}.create_partition + database function to use for creating partition table. + default is {londiste|public}.create_partition part_mode: * batch_time - partitioned by batch creation time (default) @@ -76,7 +76,7 @@ part_name: part_template: custom sql template for creating partition table. if omitted then partition - function is used. when function is missing then parent table is cloned. + function is used. template variables: * dest - destination table name. result on part_name evaluation * part - same as dest |
