#!/bin/bash
unzip -o apache-iotdb-1.1.2-all-bin.zip
unzip -o benchmark-iotdb-1.1-java8.zip
echo "#!/bin/sh
cd iot-benchmark-iotdb-1.1
echo \"DB_SWITCH=IoTDB-110-SESSION_BY_TABLET
HOST=127.0.0.1
PORT=6667
USERNAME=root
PASSWORD=root
DB_NAME=test
TOKEN=token
IS_DELETE_DATA=true
INIT_WAIT_TIME=3000
KAFKA_LOCATION=127.0.0.1:9092
ZOOKEEPER_LOCATION=127.0.0.1:2181
TOPIC_NAME=test-topic
LOOP=150
BENCHMARK_WORK_MODE=testWithDefaultPath
TEST_MAX_TIME=0
USE_MEASUREMENT=true
RESULT_PRECISION=0.1
BENCHMARK_CLUSTER=false
BENCHMARK_INDEX=0
IS_ALL_NODES_VISIBLE=false
IS_DOUBLE_WRITE=false
ANOTHER_DB_SWITCH=IoTDB-012-SESSION_BY_TABLET
ANOTHER_HOST=127.0.0.1
ANOTHER_PORT=6667
ANOTHER_USERNAME=root
ANOTHER_PASSWORD=root
ANOTHER_DB_NAME=test
ANOTHER_TOKEN=token
IS_COMPARISON=false
IS_POINT_COMPARISON=false
VERIFICATION_STEP_SIZE=10000
DEVICE_NUMBER=\$1
REAL_INSERT_RATE=1.0
SENSOR_NUMBER=\$3
IS_SENSOR_TS_ALIGNMENT=true
TS_ALIGNMENT_RATIO=1.0
IS_CLIENT_BIND=true
CLIENT_NUMBER=100
GROUP_NAME_PREFIX=g_
DEVICE_NAME_PREFIX=d_
SENSOR_NAME_PREFIX=s_
TAG_NAME_PREFIX=tag_
DEVICE_TAGS=
ENABLE_THRIFT_COMPRESSION=false
SG_STRATEGY=mod
GROUP_NUMBER=1
IOTDB_SESSION_POOL_SIZE=50
TEMPLATE=false
TEMPLATE_NAME=BenchmarkTemplate2
VECTOR=true
IOTDB_USE_DEBUG=false
IOTDB_USE_DEBUG_RATIO=0.01
HTTP_CLIENT_POOL_SIZE=1000
TIMESCALEDB_REPLICATION_FACTOR=1
TDENGINE_WAL_LEVEL=2
TDENGINE_REPLICA=3
POINT_STEP=5000
OP_MIN_INTERVAL=0
OP_MIN_INTERVAL_RANDOM=false
TIMESTAMP_PRECISION=ms
STRING_LENGTH=2
DOUBLE_LENGTH=2
INSERT_DATATYPE_PROPORTION=1:1:1:1:1:1
COMPRESSOR=SNAPPY
ENCODING_BOOLEAN=PLAIN
ENCODING_INT32=PLAIN
ENCODING_INT64=PLAIN
ENCODING_FLOAT=PLAIN
ENCODING_DOUBLE=PLAIN
ENCODING_TEXT=PLAIN
FILE_PATH=data/test
BIG_BATCH_SIZE=100
LINE_RATIO=1
SIN_RATIO=1
SQUARE_RATIO=1
RANDOM_RATIO=1
CONSTANT_RATIO=1
DATA_SEED=666
OPERATION_PROPORTION=1:0:0:0:0:0:0:0:0:0:0
WRITE_OPERATION_TIMEOUT_MS=120000
READ_OPERATION_TIMEOUT_MS=300000
BATCH_SIZE_PER_WRITE=\$2
DEVICE_NUM_PER_WRITE=1
CREATE_SCHEMA=true
START_TIME=2022-01-01T00:00:00+08:00
IS_COPY_MODE=false
IS_ADD_ANOMALY=false
ANOMALY_RATE=0.2
ANOMALY_TIMES=2
IS_OUT_OF_ORDER=true
OUT_OF_ORDER_MODE=POISSON
OUT_OF_ORDER_RATIO=0.5
IS_REGULAR_FREQUENCY=false
LAMBDA=2200.0
MAX_K=170000
IS_RECENT_QUERY=false
STEP_SIZE=1
QUERY_SENSOR_NUM=1
QUERY_DEVICE_NUM=1
QUERY_AGGREGATE_FUN=count
QUERY_INTERVAL=250000
QUERY_LOWER_VALUE=-5
GROUP_BY_TIME_UNIT=20000
QUERY_SEED=151658
WORKLOAD_BUFFER_SIZE=100
TEST_DATA_PERSISTENCE=None
RECORD_SPLIT=true
RECORD_SPLIT_MAX_LINE=10000000
TEST_DATA_STORE_IP=127.0.0.1
TEST_DATA_STORE_PORT=6667
TEST_DATA_STORE_DB=result
TEST_DATA_STORE_USER=root
TEST_DATA_STORE_PW=root
TEST_DATA_WRITE_TIME_OUT=300000
TEST_DATA_MAX_CONNECTION=1
REMARK=
MYSQL_REAL_INSERT_RATE=1.0
CSV_OUTPUT=true
IS_QUIET_MODE=true
LOG_PRINT_INTERVAL=30
NET_DEVICE=e
IOTDB_DATA_DIR=/home/iotdb/data/data
IOTDB_WAL_DIR=/home/iotdb/data/wal
IOTDB_SYSTEM_DIR=/home/iotdb/data/system
MONITOR_INTERVAL=0\" > conf/config.properties
./benchmark.sh > bench-log 2>&1
echo \$? > ~/test-exit-status
tail -n 100 bench-log > \$LOG_FILE" > apache-iotdb
chmod +x apache-iotdb
