# 第1步: SELECT * FROM information_schema.innodb_locks ; # 第2步:1,2没有特别的先后顺序,之后为了确定trx_requested_lock_id以及是谁获取了锁lock_trx_id + local_data SELECT * FROM information_schema.innodb_trx t where t.trx_state = 'LOCK WAIT'; # 第3步:找到对应的执行语句 select * from information_schema.PROCESSLIST t where t.id = {lock_trx_id}
show variables like 'innodb_lock_wait_timeout'; +--------------------------+-------+ |Variable_name | Value | +--------------------------+-------+ | innodb_lock_wait_timeout| 50 | +--------------------------+-------+
withopen('/Users/chenyuan/Desktop/report_mock.127.0.0.1.txt') as f: all = f.read().strip() out = [] for one inall.split('----------------------------------------------------\n'): r = parse_one(one) out.append((r['host'], r['size'], r['conns'], r['l_avg'], r['l_50'], r['l_90'], r['l_99'], r['qps'], r['mbps'])) out.sort() for o in out: print('\t'.join([str(i) for i in o]))
If the server acquires metadata locks for a statement that is syntactically valid but fails during execution, it does not release the locks early. Lock release is still deferred to the end of the transaction because the failed statement is written to the binary log and the locks protect log consistency.
也就是说除了语法错误,其他错误语句获取到的锁在这个事务提交或回滚之前,仍然不会释放掉。because the failed statement is written to the binary log and the locks protect log consistency 但是解释这一行为的原因很难理解,因为错误的语句根本不会被记录到二进制日志。
#! /bin/bash # 目录空间 HOME_DIR="/Users/chenyuan" WORK_DIR=$HOME_DIR"/Workspaces/xxx" // 替换为你的工作目录 # 过滤目录 EXCLUDE_DIR_OR_FILE=("cr-test-demo" "git_batch_co_brach.sh" "git_batch_co_push_remote.sh" "git_batch_co_merge_push_remote.sh") # 分支名字 OLD_BR_NAME="$1" NEW_BR_NAME="$2" # 校验参数 if [ -f $OLD_BR_NAME ]; then echo "Please input your old branch name." exit 0 fi
if [ -f $NEW_BR_NAME ]; then echo "Please input your new branch name." exit 0 fi # 切换到某个分支 function gitCheckoutBrachAndPushRemote() { echo "-------- $1 --------" cd "$1" pwd git checkout $OLD_BR_NAME git fetch git pull git checkout -b $NEW_BR_NAME $OLD_BR_NAME git push --set-upstream origin $NEW_BR_NAME echo "success push branch " $NEW_BR_NAME " to remote" } ## get all folder in "$WORK_DIR" for i in `ls "$WORK_DIR"`;do cd "$WORK_DIR" if [[ -d $i ]] && [[ ! "${EXCLUDE_DIR_OR_FILE[@]}" =~ "${i}" ]];then gitCheckoutBrachAndPushRemote "$i" fi done
#! /bin/bash # 目录空间 HOME_DIR="/Users/chenyuan" WORK_DIR=$HOME_DIR"/Workspaces/xxx" // 替换为你的工作目录 # 过滤目录 EXCLUDE_DIR_OR_FILE=("cr-test-demo" "git_batch_co_brach.sh" "git_batch_co_push_remote.sh" "git_batch_co_merge_push_remote.sh") # 分支名字 TAG_NAME=$1 # 校验参数 if [ -f $TAG_NAME ]; then echo "Please input your tag name." exit 0 fi # 切换到某个分支 function doSomething() { cd "$1" pwd git fetch git checkout master git tag -a $TAG_NAME -m "创建分支$TAG_NAME" echo "success create tag " $TAG_NAME git push origin --tags echo "success push tag to remote" $TAG_NAME } ## get all folder in "$WORK_DIR" for i in `ls "$WORK_DIR"`;do cd "$WORK_DIR" if [[ -d $i ]] && [[ ! "${EXCLUDE_DIR_OR_FILE[@]}" =~ "${i}" ]];then doSomething "$i" fi done
具体使用,首先切换为master分支。
1
./git_batch_tag_push.sh v1.0.0
06-批量mvn打包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#! /bin/bash # 目录空间 HOME_DIR="/Users/chenyuan" WORK_DIR=$HOME_DIR"/Workspaces/xxx" // 替换为你的工作目录 # 需要deploy的工程 NEED_DEPLOY_DIR_OR_FILE=("xxxx") // 这里添加你要打包的项目名称,空格分开 ## get all folder in "$WORK_DIR" for i in "${NEED_DEPLOY_DIR_OR_FILE[@]}";do #cd"$WORK_DIR" echo "$WORK_DIR/$i"; cd "$WORK_DIR/$i"; git pull mvn install deploy -Dpmd.skip=true -Dcheckstyle.skip=true -Dmaven.test.skip=true done