forked from apple/foundationdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Local python test for FDB
Jingyu Zhou edited this page Jan 20, 2023
·
13 revisions
../foundationdb/tests/loopback_cluster/run_cluster.sh ../cbuild_output/ 1 "../cbuild_output/bin/fdbcli -C loopback-cluster-1/fdb.cluster"
# ../src/foundationdb/tests/loopback_cluster/run_custom_cluster.sh . --stateless_count 4 --stateless_taskset 0xf --logs_count 8 --storage_count 20 --logs_taskset 0xff0 --storage_taskset 0xffff000
# bin/fdbcli -C ./loopback-cluster/fdb.cluster --exec 'status json' > json
# bin/fdbserver -C ./loopback-cluster/fdb.cluster -r consistencycheck
/opt/rh/rh-python38/root/usr/bin/python3.8 "/root/src/foundationdb/tests/TestRunner/tmp_cluster.py" "--build-dir" "/root/build_output" "--" "/root/build_output/bin/fdb_c_unit_tests" "@CLUSTER_FILE@" "fdb"
/opt/rh/rh-python38/root/usr/local/lib64/python3.8/site-packages/
# pip install foundationdb==7.1.3
# cat fdb.cluster
abc:def@127.0.0.1:4500
# mkdir -p /root/cluster/data/s1 /root/cluster/log/s1 /root/cluster/data/s2 /root/cluster/log/s2
# ./fdbserver -p auto:4500 -d /root/cluster/data/s1/ -L /root/cluster/log/s1/ &
# ./fdbserver -p auto:4501 -d /root/cluster/data/s2/ -L /root/cluster/log/s2/ &
FDB_NETWORK_OPTION_TRACE_ENABLE="." LD_LIBRARY_PATH=/root/cluster/ python client.py
pip install foundationdb==7.1.2
import fdb
import os
import random
fdb.api_version(710)
db = fdb.open()
counter = 0
for i in range(100):
key = b"test_%d" % random.randrange(0, 100000000)
val = b"value_%d" % random.randrange(0, 10000000)
print("Writing: ", key, val, db)
db[key] = val
assert val == db[key]
fdbcli --exec "configure new ssd single"
FDB_NETWORK_OPTION_TRACE_ENABLE="." LD_LIBRARY_PATH=/root/cluster/ python client.py
../src/foundationdb/tests/loopback_cluster/run_custom_cluster.sh . --knobs "--knob_enable_version_vector=1 --knob_enable_version_vector_tlog_unicast=1 --knob_blocking_peek_timeout=.001 --knob_ratekeeper_print_limit_reason=1 --knob_proxy_use_resolver_private_mutations=1" --stateless_count 4 --stateless_taskset 0xf --logs_count 8 --storage_count 420 --logs_taskset 0xff0 --storage_taskset 0xffff000
LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH ./bin/mako -a 710 --cluster=./loopback-cluster/fdb.cluster --mode build --rows 100000 --procs 2 --vallen=2048
LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH ./bin/mako -a 710 --cluster=./loopback-cluster/fdb.cluster --mode run --rows 40 --procs 1 --threads 1 --transaction "g70" --seconds 180 --tps 100
LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH ./bin/mako -a 710 --cluster=./loopback-cluster/fdb.cluster --mode run --rows 40 --procs 1 --threads 1 --transaction "g70" --seconds 180 --tps 100
LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH ./bin/mako -a 710 --cluster=./loopback-cluster/fdb.cluster --mode run --rows 40 --procs 1 --threads 1 --transaction "g70" --seconds 180 --tps 100
import fdb
import sys
cluster_file="loopback-cluster/fdb.cluster"
if len(sys.argv) == 2:
cluster_file = sys.argv[1]
fdb.api_version(710)
db=fdb.open(cluster_file)
tr=db.create_transaction()
tr.options.set_read_system_keys()
x=list(fdb.locality.get_boundary_keys(db,b'mako\x00',b'mako\xff'))
start_addresses = [fdb.locality.get_addresses_for_key(tr,k) for k in x[:-1]]
a=[s.wait() for s in start_addresses]
for i in range(0,len(a)):
print('start key:', x[i], 'address:', a[i])