Skip to content

Commit 3b63279

Browse files
author
neekyjiang
committed
feat: 1.删除归档 2.处理主键冲突的异常
1 parent 2a1f8f2 commit 3b63279

File tree

46 files changed

+90
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+90
-4
lines changed

bin/mtls-auto-fill

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ def parser_cmd_args():
3535
args.add_argument("--table",type=str,default="t",help="表名")
3636
args.add_argument("--rows",type=int,default=100,help="要插入的行数")
3737
args.add_argument("--process",type=int,default=1,help="并发的进程数")
38+
args.add_argument("--ssl_disabled",type=bool, default=False, help="是否禁用 SSL")
3839
args.add_argument("action",choices=('review','execute'))
3940
return args.parse_args()
4041

4142

42-
def insert(host="127.0.0.1",port=3306,user="apuser",password="mtls@0352",database="tempdb",table="t",rows=100):
43+
def insert(host="127.0.0.1",port=3306,user="apuser",password="mtls@0352",ssl_disabled=False,database="tempdb",table="t",rows=100):
4344
"""
4445
4546
"""
@@ -58,7 +59,7 @@ def insert(host="127.0.0.1",port=3306,user="apuser",password="mtls@0352",databas
5859
cnx = None
5960
start_at = datetime.now()
6061
try:
61-
cnx = connector.connect(host=host,port=port,user=user,password=password)
62+
cnx = connector.connect(host=host,port=port,user=user,password=password,ssl_disabled=ssl_disabled)
6263
cursor = cnx.cursor()
6364

6465
for i in range(rows):
@@ -127,7 +128,7 @@ def main():
127128
stats.append(_)
128129
else:
129130
# 单进程压力测试
130-
tmp = insert(args.host,args.port,args.user,args.password,args.database,args.table,args.rows)
131+
tmp = insert(args.host,args.port,args.user,args.password,args.ssl_disabled,args.database,args.table,args.rows)
131132
stats.append(tmp)
132133

133134
print("\nReport:")

bin/mtls-ps-mem

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env python3
2+
#-*- coding: UTF-8 -*-
3+
4+
"""
5+
每秒打印一下进程的内存使用情况
6+
"""
7+
8+
import os
9+
import datetime
10+
import argparse
11+
from mtls.ps.mem import mem_info_generator
12+
from mtls.ps.mem import global_connection_memory_generator
13+
from mtls.kits import fileformat
14+
15+
16+
name = os.path.basename(__file__)
17+
18+
def parser_cmd_args():
19+
"""
20+
处理命令行参数
21+
"""
22+
args = argparse.ArgumentParser(name)
23+
args.add_argument('--user',type=str,default='')
24+
args.add_argument('--password',type=str,default='')
25+
args.add_argument('--port',type=int,default=3306)
26+
args.add_argument("pid",type=int)
27+
return args.parse_args()
28+
29+
30+
def main():
31+
args = parser_cmd_args()
32+
pid = args.pid
33+
if args.user != '':
34+
for mem_info in mem_info_generator(pid):
35+
print(f"{datetime.datetime.now().isoformat(' ','seconds')} pid={pid} vms={fileformat(mem_info.vms)} rss={fileformat(mem_info.rss)} dirty={fileformat(mem_info.dirty)}")
36+
else:
37+
g = global_connection_memory_generator()
38+
next(g)
39+
for mem_info in mem_info_generator(pid):
40+
global_conn_mem_size = next(g)
41+
print(f"{datetime.datetime.now().isoformat(' ','seconds')} pid={pid} vms={fileformat(mem_info.vms)} rss={fileformat(mem_info.rss)} global_conn_mem={fileformat(global_conn_mem_size)}")
42+
43+
44+
if __name__ == "__main__":
45+
main()
-17.6 KB
Binary file not shown.
-17.6 KB
Binary file not shown.
-18 KB
Binary file not shown.
-18.4 KB
Binary file not shown.
-19 KB
Binary file not shown.
-19 KB
Binary file not shown.
-18.9 KB
Binary file not shown.
-19.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)