Compare commits

..

1 Commits

Author SHA1 Message Date
Marko Budiselic
15fee55fa1 Add debugging tools 2023-06-15 10:52:58 +00:00
9 changed files with 81 additions and 193 deletions

View File

@@ -196,7 +196,22 @@ jobs:
- name: Run integration tests
run: |
tests/integration/run.sh
cd tests/integration
for name in *; do
if [ ! -d $name ]; then continue; fi
pushd $name >/dev/null
echo "Running: $name"
if [ -x prepare.sh ]; then
./prepare.sh
fi
if [ -x runner.py ]; then
./runner.py
elif [ -x runner.sh ]; then
./runner.sh
fi
echo
popd >/dev/null
done
- name: Run cppcheck and clang-format
run: |

View File

@@ -146,7 +146,22 @@ jobs:
- name: Run integration tests
run: |
tests/integration/run.sh
cd tests/integration
for name in *; do
if [ ! -d $name ]; then continue; fi
pushd $name >/dev/null
echo "Running: $name"
if [ -x prepare.sh ]; then
./prepare.sh
fi
if [ -x runner.py ]; then
./runner.py
elif [ -x runner.sh ]; then
./runner.sh
fi
echo
popd >/dev/null
done
- name: Run cppcheck and clang-format
run: |

View File

@@ -146,7 +146,22 @@ jobs:
- name: Run integration tests
run: |
tests/integration/run.sh
cd tests/integration
for name in *; do
if [ ! -d $name ]; then continue; fi
pushd $name >/dev/null
echo "Running: $name"
if [ -x prepare.sh ]; then
./prepare.sh
fi
if [ -x runner.py ]; then
./runner.py
elif [ -x runner.sh ]; then
./runner.sh
fi
echo
popd >/dev/null
done
- name: Run cppcheck and clang-format
run: |

View File

@@ -146,7 +146,22 @@ jobs:
- name: Run integration tests
run: |
tests/integration/run.sh
cd tests/integration
for name in *; do
if [ ! -d $name ]; then continue; fi
pushd $name >/dev/null
echo "Running: $name"
if [ -x prepare.sh ]; then
./prepare.sh
fi
if [ -x runner.py ]; then
./runner.py
elif [ -x runner.sh ]; then
./runner.sh
fi
echo
popd >/dev/null
done
- name: Run cppcheck and clang-format
run: |

View File

@@ -1 +0,0 @@
*.log

View File

@@ -1,47 +0,0 @@
#!/bin/bash -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
print_help() {
echo -e "$0 => run all under tests/integration"
echo -e "$0 folder_name => run single test under tests/integration"
exit 1
}
test_one() {
cd "$DIR"
integration_test_folder_name="$1"
pushd "$integration_test_folder_name" >/dev/null
echo "Running: $integration_test_folder_name"
if [ -x prepare.sh ]; then
./prepare.sh
fi
if [ -x runner.py ]; then
./runner.py
elif [ -x runner.sh ]; then
./runner.sh
fi
echo
popd >/dev/null
}
test_all() {
cd "$DIR"
for name in *; do
if [ ! -d "$name" ]; then continue; fi
test_one "$name"
done
}
if [ "$#" -eq 0 ]; then
test_all
else
if [ "$#" -gt 1 ]; then
print_help
else
if [ -d "$DIR/$1" ]; then
test_one "$1"
else
print_help
fi
fi
fi

View File

@@ -1,114 +0,0 @@
!/bin/bash -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd $DIR/../../build
query_list=(
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CALL dummy_query.dummy_read() YIELD *;"
"CALL dummy_query.dummy_write() YIELD *;"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
"CREATE (:Node)-[:CONNECTED]->(:Node);"
)
# Start the first memgraph instance
echo "Starting memgraph..."
./memgraph --log-level=TRACE --storage-recover-on-startup=true --storage-snapshot-interval-sec=600 --log-file=$DIR/memgraph.log --bolt-port 7687 --query-modules-directory=$DIR/query_modules &
sleep 5
# Capture the process ID (PID)
memgraph=$!
echo $memgraph
docker run -d -p 7688:7687 --name memgraph_docker memgraph/memgraph:2.8.0 --log-level=TRACE --storage-recover-on-startup=true --storage-snapshot-interval-sec=600 &
sleep 5
cd $DIR/query_modules
tar -cf - dummy_query.py | docker cp -a - memgraph_docker:/usr/lib/memgraph/query_modules/
docker exec -it -u 0 memgraph_docker bash -c "chown -R root:root /usr/lib/memgraph/query_modules"
docker_ip=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' memgraph_docker)
echo $docker_ip
#check docker query module ownership
docker exec -it memgraph_docker ls -l /usr/lib/memgraph/query_modules
# Function to execute query commands
execute_query_native() {
local query=$1
echo "$query" | mgconsole -host "127.0.0.1" -port 7687
}
execute_query_docker(){
local query=$1
echo "$query" | mgconsole -host "127.0.0.1" -port 7688
}
execute_query_docker "CALL mg.load_all();"
execute_query_docker "CALL dummy_query.dummy_read() YIELD *;"
function cleanup {
echo "Terminating child processes..."
echo "Stopping memgraph..."
kill -9 $memgraph
sleep 5
echo "Stopping memgraph_docker..."
docker stop memgraph_docker
echo "Removing memgraph_docker..."
docker rm memgraph_docker
echo "Script execution completed."
exit
}
trap cleanup SIGINT
previous_time=$(date +%s)
previous_minute=$(date +%M)
previous_hour=$(date +%H)
while true; do
current_time=$(date +%s)
current_minute=$(date +%M)
current_hour=$(date +%H)
if ((current_time - previous_time >= 5)); then
echo "Five seconds have passe running create query."
for query in "${query_list[@]}"; do
execute_query_native "$query" &
execute_query_docker "$query" &
done
previous_time=$current_time
fi
if [[ $current_minute != $previous_minute ]]; then
echo "One minute has passed running match query."
execute_query_native "MATCH (n)-[r]->(m) RETURN DISTINCT COUNT(n);" &
execute_query_docker "MATCH (n)-[r]->(m) RETURN DISTINCT COUNT(n);" &
previous_minute=$current_minute
fi
if [[ $current_hour != $previous_hour ]]; then
echo "One hour has passed running delete query."
execute_query_native "MATCH (n) DETACH DELETE n;" &
execute_query_docker "MATCH (n) DETACH DELETE n;" &
previous_hour=$current_hour
fi
done

View File

@@ -1,27 +0,0 @@
import random
import mgp
@mgp.read_proc
def dummy_read(
context: mgp.ProcCtx,
) -> mgp.Record(total_vertices=int, total_edges=int):
vertices = context.graph.vertices
total_edges = 0
for vertex in vertices:
for edge in vertex.out_edges:
total_edges += 1
return mgp.Record(total_vertices=len(vertices), total_edges=total_edges)
@mgp.write_proc
def dummy_write(
context: mgp.ProcCtx,
) -> mgp.Record(vertex=mgp.Vertex):
for i in range(0, 5):
node = context.graph.create_vertex()
node.add_label("Procedure_node")
node.properties.set("id", random.randint(0, 100000))
return mgp.Record(vertex=node)

17
tools/debug/run_under_gdb.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# Make sure Memgraph is compiled in RelWithDebInfo to get representative runs
# while also having debug symbols
# cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
source /opt/toolchain-v4/activate
cd $DIR/../../build
gdb --args ./memgraph \
--bolt-port 7687 \
--storage-properties-on-edges=true \
--storage-snapshot-interval-sec=60 \
--storage-wal-enabled=true \
--storage-recover-on-startup=true \
--storage-snapshot-on-exit=true "$1" # additional flags like telemetry