-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_data.sh
47 lines (39 loc) · 1.5 KB
/
generate_data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
DSGEN_PATH="/home/parallels/prac_bin/TPC-DS-Tool_v3.2.0/DSGen-software-code-3.2.0rc1"
# ==========================================================
# 函数: generate_dat_data
# 描述: 生成TPC-DS测试数据
# 确认程序在后台正确执行:
# ps -eo pid,user,%cpu,%mem,vsz,rss,tty,stat,start,time,etime,cmd | grep '[d]sdgen'
# ==========================================================
generate_dat_data() {
local TOOLS_DIR=${1:-"${DSGEN_PATH}/tools"}
local SCALE=${2:-10}
local child
cd "$TOOLS_DIR" || {
echo "无法进入目录 $TOOLS_DIR"
exit 1
}
for child in {1..4}; do
nohup /usr/bin/time ./dsdgen -scale "$SCALE" -dir ../tpcds_data/ \
-parallel 4 -child "${child}" >>../../tpcds_data.log 2>&1 &
done
}
# ==========================================================
# 函数: generate_query_data
# 描述: 生成TPC-DS查询SQL
# 确认程序在后台正确执行:
# ps -eo pid,user,%cpu,%mem,vsz,rss,tty,stat,start,time,etime,cmd | grep '[d]sqgen'
# ==========================================================
generate_query_data() {
local TPC_DIR=${DSGEN_PATH}
cd "$TPC_DIR/tools" || {
echo "无法进入目录 $TPC_DIR/tools"
exit 1
}
nohup /usr/bin/time ./dsqgen -output_dir ../tpcds_query/ \
-input ../query_templates/templates.lst -scale 1 -dialect postgresql \
-directory ../query_templates/ >>../../tpcds_query.log 2>&1 &
}
generate_dat_data "${DSGEN_PATH}/tools" 10
generate_query_data