提交 aa5fe3d5 编写于 作者: O Omer Arap

Update utilities to capture hyperloglog counter

This commit updates the GPSD utility to capture the value of the column
`stainherit` and also the HLL counters stored in column `stavalues4`
generated for sample/full table scan based HLL analyze in `pg_statistic`
table.

This commit also updates minirepro utility to capture hyperloglog
counter
Signed-off-by: NEkta Khanna <ekhanna@pivotal.io>
上级 9c1b1ae3
......@@ -113,17 +113,26 @@ def dumpStats(cur):
for vals in ResultIter(cur):
rowVals = ["\t'%s.%s'::regclass" % tuple(vals[1::-1])]
i = 0
hll = False
if vals[3][0] == '_':
rowTypes = types + [vals[3]] * 4
else:
rowTypes = types + [vals[3] + '[]'] * 4
for val, typ in zip(vals[5:], rowTypes):
i = i + 1
if i == 9 and (val == 5 or val == 6):
hll = True
if val is None:
val = 'NULL'
elif isinstance(val, (str, unicode)) and val[0] == '{':
val = val.replace("'", "''").replace('\\', '\\\\')
val = "E'" + val + "'"
rowVals.append('\t{0}::{1}'.format(val, typ))
if i == 21 and hll == True:
rowVals.append('\t{0}::{1}'.format(val, 'bytea[]'))
else:
rowVals.append('\t{0}::{1}'.format(val, typ))
print pstring.format(vals[0], vals[2], ',\n'.join(rowVals))
......
......@@ -64,7 +64,7 @@ from optparse import OptionParser
from pygresql import pgdb
from datetime import datetime
version = '1.12'
version = '1.13'
PATH_PREFIX = '/tmp/'
PGDUMP_FILE = 'pg_dump_out.sql'
sysnslist = "('pg_toast', 'pg_bitmapindex', 'pg_catalog', 'information_schema', 'gp_toolkit')"
......@@ -249,17 +249,26 @@ def dump_stats(cur, oid_str, f_out):
starelid = "'%s.%s'::regclass" % (E(vals[1]), E(vals[0]))
rowVals = ["\t%s" % (starelid)]
schemaname = vals[1]
i = 0
hll = False
if vals[3][0] == '_':
rowTypes = types + [vals[3]] * 4
else:
rowTypes = types + [vals[3] + '[]'] * 4
for val, typ in zip(vals[5:], rowTypes):
i = i + 1
if i == 9 and (val == 5 or val == 6):
hll = True
if val is None:
val = 'NULL'
elif isinstance(val, (str, unicode)) and val[0] == '{':
val = "E'%s'" % E(val)
rowVals.append('\t{0}::{1}'.format(val, typ))
if i == 21 and hll == True:
rowVals.append('\t{0}::{1}'.format(val, 'bytea[]'))
else:
rowVals.append('\t{0}::{1}'.format(val, typ))
# For non-catalog tables we don't need to delete stats first
# stats need to be deleted only for catalog tables
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册