云
昨天 bd9c8a5c560083bcb6d0a9c010f56e1f9cf83df6
1
2
3
4
5
6
7
8
9
10
11
12
13
import sys,json
from pathlib import Path
P=Path(__file__).parent
sys.path.insert(0,str(P.parent/'iqc-import-20261012/deps'))
import pymysql
c=pymysql.connect(host='36.213.150.237',port=10000,user='root',password=sys.stdin.readline().strip(),database='mom-hm',charset='utf8mb4',cursorclass=pymysql.cursors.DictCursor,connect_timeout=10,read_timeout=15)
with c.cursor() as q:
 q.execute("SELECT IS_USED_LOCK('sales-mps-20261012') holder");holder=q.fetchone()['holder']
 if holder:
  q.execute('SELECT ID,TIME,STATE,LEFT(INFO,160) query FROM information_schema.processlist WHERE ID=%s',(holder,));print(json.dumps(q.fetchall(),ensure_ascii=False,default=str))
  q.execute('SELECT trx_state,trx_wait_started,trx_rows_locked,trx_rows_modified FROM information_schema.innodb_trx WHERE trx_mysql_thread_id=%s',(holder,));print(json.dumps(q.fetchall(),ensure_ascii=False,default=str))
 else:print('No active own transaction')
c.close()