Skip to content

Commit b07a66c

Browse files
author
zaihuaji
committed
check 'chkcnd' in PGLOG['DSCHECK']
1 parent 1f22b7f commit b07a66c

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "rda_python_common"
7-
version = "2.0.7"
7+
version = "2.0.8"
88
authors = [
99
{ name="Zaihua Ji", email="zji@ucar.edu" },
1010
]

src/rda_python_common/PgDBI.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,12 @@ def aborttran(autocommit = True):
323323
#
324324
def record_dscheck_error(errmsg, logact = PGDBI['EXITLG']):
325325

326-
cnd = PgLOG.PGLOG['DSCHECK']['chkcnd']
326+
check = PgLOG.PGLOG['DSCHECK']
327+
chkcnd = check['chkcnd'] if 'chkcnd' in check else "cindex = {}".format(check['cindex'])
328+
dflags = check['dflags'] if 'dflags' in check else ''
327329
if PgLOG.PGLOG['NOQUIT']: PgLOG.PGLOG['NOQUIT'] = 0
328-
dflags = PgLOG.PGLOG['DSCHECK']['dflags']
329330

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

353-
return pgupdt("dscheck", record, cnd, logact)
354+
return pgupdt("dscheck", record, chkcnd, logact)
354355

355356
#
356357
# local function to log query error

src/rda_python_common/pg_dbi.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,11 @@ def aborttran(self, autocommit = True):
248248
# record error message to dscheck record and clean the lock
249249
def record_dscheck_error(self, errmsg, logact = None):
250250
if logact is None: logact = self.PGDBI['EXITLG']
251-
cnd = self.PGLOG['DSCHECK']['chkcnd']
251+
check = PgLOG.PGLOG['DSCHECK']
252+
chkcnd = check['chkcnd'] if 'chkcnd' in check else "cindex = {}".format(check['cindex'])
253+
dflags = check['dflags'] if 'dflags' in check else ''
252254
if self.PGLOG['NOQUIT']: self.PGLOG['NOQUIT'] = 0
253-
dflags = self.PGLOG['DSCHECK']['dflags']
254-
pgrec = self.pgget("dscheck", "mcount, tcount, lockhost, pid", cnd, logact)
255+
pgrec = self.pgget("dscheck", "mcount, tcount, lockhost, pid", chkcnd, logact)
255256
if not pgrec: return 0
256257
if not pgrec['pid'] and not pgrec['lockhost']: return 0
257258
(chost, cpid) = self.current_process_info()
@@ -271,7 +272,7 @@ def record_dscheck_error(self, errmsg, logact = None):
271272
errmsg = self.break_long_string(errmsg, 512, None, 50, None, 50, 25)
272273
if pgrec['tcount'] > 1: errmsg = "Try {}: {}".format(pgrec['tcount'], errmsg)
273274
record['errmsg'] = errmsg
274-
return self.pgupdt("dscheck", record, cnd, logact)
275+
return self.pgupdt("dscheck", record, chkcnd, logact)
275276

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

0 commit comments

Comments
 (0)