Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoucheng361 committed Jan 5, 2025
1 parent 2a436d2 commit 9d44f26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/command/load_dump_bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ prepare_test_data(){
./juicefs mount -d $META_URL /tmp/jfs
threads=10
./juicefs mdtest $META_URL /bigdir --depth=1 --dirs=0 --files=$((FILE_COUNT_IN_BIGDIR/threads)) --threads=$threads --write=8192
./juicefs mdtest $META_URL /smalldir --depth=3 --dirs=10 --files=10 --threads=10 --write=8192
./juicefs mdtest $META_URL /smalldir --depth=2 --dirs=10 --files=10 --threads=10 --write=8192
}

if [[ "$START_META" == "true" ]]; then
Expand Down
27 changes: 14 additions & 13 deletions .github/scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import time
from minio import Minio

def flush_meta(meta_url):
def flush_meta(meta_url:str):
print(f'start flush meta: {meta_url}')
if meta_url.startswith('sqlite3://'):
path = meta_url[len('sqlite3://'):]
Expand All @@ -24,28 +24,29 @@ def flush_meta(meta_url):
if os.path.isdir(path):
shutil.rmtree(path)
print(f'remove badger dir {path} succeed')
elif meta_url.startswith('redis://'):
host_port= meta_url[8:].split('/')[0]
elif meta_url.startswith('redis://') or meta_url.startswith('tikv://'):
default_port = {"redis": 6379, "tikv": 2379}
protocol = meta_url.split("://")[0]
host_port= meta_url.split("://")[1].split('/')[0]
if ':' in host_port:
host = host_port.split(':')[0]
port = host_port.split(':')[1]
else:
host = host_port
port = 6379
db = meta_url[8:].split('/')[1]
if not db:
db = 0
port = default_port[protocol]
db = int(meta_url.split("://")[1].split('/')[1])
print(f'flushing {protocol}://{host}:{port}/{db}')
if protocol == 'redis':
run_cmd(f'redis-cli -h {host} -p {port} -n {db} flushdb')
elif protocol == 'tikv':
run_cmd(f'echo "delall --db {db} --yes" |tcli -pd {host}:{port}')
else:
db = int(db)
print(f'flush redis: {host}:{port}')
run_cmd(f'redis-cli -h {host} -p {port} -n {db} flushdb')
print(f'flush redis succeed')
raise Exception(f'{protocol} not supported')
print(f'flush {protocol}://{host}:{port}/{db} succeed')
elif meta_url.startswith('mysql://'):
create_mysql_db(meta_url)
elif meta_url.startswith('postgres://'):
create_postgres_db(meta_url)
elif meta_url.startswith('tikv://'):
run_cmd('echo "delall --yes" |tcli -pd localhost:2379')
elif meta_url.startswith('fdb://'):
run_cmd('''fdbcli -C /home/runner/fdb.cluster --exec "writemode on ; clearrange '' \xFF"''')
else:
Expand Down

0 comments on commit 9d44f26

Please sign in to comment.