This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=failure gen service | |
After=syslog.target network.target | |
[Service] | |
SyslogIdentifier=failure-gen | |
ExecStart=/opt/onfailure-test/failure-gen /opt/onfailure-test/aaa | |
ExecStopPost=/bin/bash -c '/bin/systemctl status failure-gen | /usr/bin/mailx -Ssendwait -s "[failure-gen] failure notification" [email protected]' | |
Restart=always | |
RestartSec=15s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go run tikv-assembly.go -f "port 20160" -i lo0 | |
2018/12/29 20:17:17 Starting capture on interface "lo0" | |
2018/12/29 20:17:17 reading in packets | |
2018/12/29 20:17:26 127.0.0.1:64989 -> 127.0.0.1:20160 /tikvpb.Tikv/KvPrewrite context:<region_id:2 region_epoch:<conf_ver:1 version:1 > peer:<id:3 store_id:1 > > mutations:<key:"usertable:a" value:"\010\000\002\0020" > primary_lock:"usertable:a" start_version:405297128206237697 lock_ttl:3000 | |
2018/12/29 20:17:26 127.0.0.1:20160 -> 127.0.0.1:64989 /tikvpb.Tikv/KvPrewrite | |
2018/12/29 20:17:26 127.0.0.1:64995 -> 127.0.0.1:20160 /tikvpb.Tikv/KvCommit context:<region_id:2 region_epoch:<conf_ver:1 version:1 > peer:<id:3 store_id:1 > > start_version:405297128206237697 keys:"usertable:a" commit_version:405297128206237698 | |
2018/12/29 20:17:26 127.0.0.1:20160 -> 127.0.0.1:64995 /tikvpb.Tikv/KvCommit | |
2018/12/29 20:17:29 127.0.0.1:64999 -> 127.0.0.1:20160 /tikvpb.Tikv/KvGet context:<region_id:2 region_epoch:<conf_ver:1 version:1 > peer:<id:3 store_id:1 > > key:"usertable:a" version:4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// manager hold status | |
// groovy hold stage | |
def cfg = [:] | |
cfg["type"] = "dm-cluster" | |
cfg["size"] = {"tikv":{"size":3,"version":"111"}, | |
"tidb":{"size":1,"version":"x"}, | |
"pd":{"size":1,"version":"x"}, | |
"mysql":{"size":2,"version":"y"}, | |
"dm":{"version":"z"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// manager hold status | |
// groovy hold stage | |
def cfg = [:] | |
cfg["type"] = "tidb-cluster" | |
cfg["size"] = {"tikv":{"size":3,"version":"111"},"tidb":{"size":1,"version":"x"},"pd":{"size":1,"version":"x"}} | |
def cat = new Cat(cfg) // Cat is an function, type specify what kind of cat should be start | |
def monitor = new Monitor() // when script is quit, monitor will quit | |
def reportor = new Reportor("oncall-sre") // if it create repotor, then default reportor will not report |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Related to https://issues.jenkins-ci.org/browse/JENKINS-26481 | |
abcs = ['a', 'b', 'c'] | |
node('master') { | |
stage('Test 1: loop of echo statements') { | |
echo_all(abcs) | |
} | |
stage('Test 2: loop of sh commands') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
interface=em1 | |
ip=172.16.10.52 | |
ip2=172.16.10.53 | |
ip3=172.16.10.54 | |
delay1=1ms | |
delay2=2ms | |
delay3=3ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
interface=lo | |
ip=10.0.0.1 | |
delay=100ms | |
tc qdisc add dev $interface root handle 1: prio | |
tc filter add dev $interface parent 1:0 protocol ip prio 1 u32 match ip dst $ip flowid 2:1 | |
tc qdisc add dev $interface parent 1:1 handle 2: netem delay $delay |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
from functools import wraps | |
threads = [] | |
def run_in_thread(join=False): | |
def decorator(f): | |
@wraps(f) | |
def wrapper(*args, **kwds): | |
t = threading.Thread(target=f,args=args,kwargs=kwds) | |
threads.append(t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
(loop for key being the hash-keys of hash-table collect key) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
mapcar function &rest lists+ => result-list | |
参数和值 | |
function --- 一个 function 指示符 | |
list --- 一个 list | |
描述 | |
mapcar 使用 function 对 lists 的 元素进行一个个求值 |