Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rda_python_common"
version = "2.0.7"
version = "2.0.8"
authors = [
{ name="Zaihua Ji", email="[email protected]" },
]
Expand Down
9 changes: 5 additions & 4 deletions src/rda_python_common/PgDBI.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,12 @@ def aborttran(autocommit = True):
#
def record_dscheck_error(errmsg, logact = PGDBI['EXITLG']):

cnd = PgLOG.PGLOG['DSCHECK']['chkcnd']
check = PgLOG.PGLOG['DSCHECK']
chkcnd = check['chkcnd'] if 'chkcnd' in check else "cindex = {}".format(check['cindex'])
dflags = check['dflags'] if 'dflags' in check else ''
if PgLOG.PGLOG['NOQUIT']: PgLOG.PGLOG['NOQUIT'] = 0
dflags = PgLOG.PGLOG['DSCHECK']['dflags']

pgrec = pgget("dscheck", "mcount, tcount, lockhost, pid", cnd, logact)
pgrec = pgget("dscheck", "mcount, tcount, lockhost, pid", chkcnd, logact)
if not pgrec: return 0
if not pgrec['pid'] and not pgrec['lockhost']: return 0
(chost, cpid) = PgLOG.current_process_info()
Expand All @@ -350,7 +351,7 @@ def record_dscheck_error(errmsg, logact = PGDBI['EXITLG']):
if pgrec['tcount'] > 1: errmsg = "Try {}: {}".format(pgrec['tcount'], errmsg)
record['errmsg'] = errmsg

return pgupdt("dscheck", record, cnd, logact)
return pgupdt("dscheck", record, chkcnd, logact)

#
# local function to log query error
Expand Down
9 changes: 5 additions & 4 deletions src/rda_python_common/pg_dbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,11 @@ def aborttran(self, autocommit = True):
# record error message to dscheck record and clean the lock
def record_dscheck_error(self, errmsg, logact = None):
if logact is None: logact = self.PGDBI['EXITLG']
cnd = self.PGLOG['DSCHECK']['chkcnd']
check = PgLOG.PGLOG['DSCHECK']
chkcnd = check['chkcnd'] if 'chkcnd' in check else "cindex = {}".format(check['cindex'])
dflags = check['dflags'] if 'dflags' in check else ''
if self.PGLOG['NOQUIT']: self.PGLOG['NOQUIT'] = 0
dflags = self.PGLOG['DSCHECK']['dflags']
pgrec = self.pgget("dscheck", "mcount, tcount, lockhost, pid", cnd, logact)
pgrec = self.pgget("dscheck", "mcount, tcount, lockhost, pid", chkcnd, logact)
if not pgrec: return 0
if not pgrec['pid'] and not pgrec['lockhost']: return 0
(chost, cpid) = self.current_process_info()
Expand All @@ -271,7 +272,7 @@ def record_dscheck_error(self, errmsg, logact = None):
errmsg = self.break_long_string(errmsg, 512, None, 50, None, 50, 25)
if pgrec['tcount'] > 1: errmsg = "Try {}: {}".format(pgrec['tcount'], errmsg)
record['errmsg'] = errmsg
return self.pgupdt("dscheck", record, cnd, logact)
return self.pgupdt("dscheck", record, chkcnd, logact)

# local function to log query error
def qelog(self, dberror, sleep, sqlstr, vals, pgcnt, logact = None):
Expand Down