Skip to content

Commit 944657b

Browse files
authored
Merge pull request #261 from yczhang1017/main
2 parents cad3b74 + 0ce16ad commit 944657b

13 files changed

+96
-52
lines changed

tigergraph/README.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,52 +73,43 @@ This section explains how to set up the database for the benchmarking **using Do
7373
The instruction assumes that you are starting in the `tigergraph` subfolder of the project root directory (`ldbc_snb_interactive_impls/tigergraph`).
7474

7575
#### Prepare the dataset
76-
Set the following environment variables based on your data source:
77-
78-
To use the test data set SF-0.003, run:
76+
Set the following environment variables based on your data source (the example below uses the test data set SF-0.003):
7977
```bash
8078
export TIGERGRAPH_DATA_DIR=`pwd`/test-data/social_network
8179
```
80+
#### Start database and load data
81+
:warning: Be careful -- this stops the currently running (containerized) TigerGraph database and deletes all of its data.
8282

83-
#### Start the database
8483
To start the database, run the following [script](./scripts/start.sh):
85-
```
84+
```bash
85+
./scripts/stop.sh # if you have an existing TG database
86+
# wait several seconds for docker to reset
8687
./scripts/start.sh
8788
```
8889

89-
It will start a single node TigerGraph database and all required services.
90+
It will start a single node TigerGraph database and all required services. Note the license in the container is a trial license supporting at most 100GB data. For benchmarks on SF-100 and larger, you need to obtain a license after running `start.sh`. We have an example command in the end of `start.sh`.
9091

91-
You can verify the readiness of TigerGraph by visiting it's console in the browser: `http://localhost:14240/`
92-
93-
#### Load the data
9492
To set up the database, run the following [script](./scripts/setup.sh):
9593
```bash
9694
./scripts/setup.sh
9795
```
98-
It leverages the fact, that the TigerGraph container has the `$TIGERGRAPH_DATA_DIR`, `setup` and `queries` directories mounted as volumes.
99-
(The configuration is stored in [vars.sh](./scripts/vars.sh).)
96+
This step may take a while (several minutes), as it is responsible for defining the queries, loading jobs, loading the data and installing the queries. After the data is ready, you can explore the graph using TigerGraph GraphStudio in the browser: `http://localhost:14240/`. By default, the docker terminal can be accessed via `ssh tigergraph@localhost -p 14022` with password tigergraph, or using Docker command `docker exec --user tigergraph -it snb-interactive-tigergraph bash`.
10097

101-
If you have your data located elsewhere, please update `vars.sh` or run the setup script with parameters:
98+
The above scripts can be executed with a single command:
10299
```bash
103-
./scripts/setup.sh <<dataset dir>> <<query dir>>
100+
scripts/load-in-one-step.sh
104101
```
105102

106-
This step may take a while (several minutes), as it is responsible for defining the queries, loading jobs, loading the data
107-
and installing (optimizing and compiling on the server) the queries.
108-
109103
## Running the benchmark
110104

111-
To run the scripts of benchmark framework, edit the `driver/{create-validation-parameters,validate,benchmark}.properties` files,
112-
then run their script, one of:
105+
To run the scripts of benchmark framework, edit the `driver/{create-validation-parameters,validate,benchmark}.properties` files, then run their script, one of:
113106

114107
```bash
115108
driver/create-validation-parameters.sh
116109
driver/validate.sh
117110
driver/benchmark.sh
118111
```
119112

120-
:warning: Our DateTime library does not support dateTime precision to milliseconds. We use INT for datetime right now.
121-
:warning: SNB data sets of **different scale factors require different configurations** for the benchmark runs. Therefore, make sure you use the correct values (update_interleave and query frequencies) based on the files provided in the [`sf-properties/` directory](../sf-properties).
122-
123-
> **Warning:** Note that if the default workload contains updates which are persisted in the database. Therefore, the database needs to be re-loaded between steps – otherwise repeated updates would insert duplicate entries.*
113+
SNB data sets of **different scale factors require different configurations** for the benchmark runs. Therefore, make sure you use the correct values (update_interleave and query frequencies) based on the files provided in the [`sf-properties/` directory](../sf-properties).
124114

115+
* The default workload contains updates which are persisted in the database. Therefore, **the database needs to be reloaded or restored from backup before each run**. Use the provided `scripts/backup-database.sh` and `scripts/restore-database.sh` scripts to achieve this.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CREATE OR REPLACE QUERY interactiveInsert2(UINT personId, UINT postId, INT creationDate) {
2-
INSERT INTO Person (PRIMARY_ID) VALUES (personId);
3-
INSERT INTO Post (PRIMARY_ID) VALUES (postId);
2+
INSERT INTO Person (id) VALUES (personId);
3+
INSERT INTO Post (id) VALUES (postId);
44
INSERT INTO LIKES (FROM, TO, creationDate) VALUES (personId Person, postId Post, creationDate);
55
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CREATE OR REPLACE QUERY interactiveInsert3(UINT personId, UINT commentId, INT creationDate) {
2-
INSERT INTO Person (PRIMARY_ID) VALUES (personId);
3-
INSERT INTO Comment (PRIMARY_ID) VALUES (commentId);
2+
INSERT INTO Person (id) VALUES (personId);
3+
INSERT INTO Comment (id) VALUES (commentId);
44
INSERT INTO LIKES (FROM, TO, creationDate) VALUES(personId Person, commentId Comment, creationDate);
55
}

tigergraph/queries/interactiveInsert4.gsql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CREATE OR REPLACE QUERY interactiveInsert4(UINT forumId, STRING forumTitle, UINT moderatorPersonId, INT creationDate, SET<VERTEX<Tag>> tagIds) {
22
INSERT INTO Forum VALUES(forumId, forumTitle, creationDate);
3-
INSERT INTO Person (PRIMARY_ID) VALUES(moderatorPersonId);
3+
INSERT INTO Person (id) VALUES(moderatorPersonId);
44
INSERT INTO HAS_MODERATOR VALUES(forumId, moderatorPersonId Person);
55
tmp = {tagIds};
66
tmp =
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CREATE OR REPLACE QUERY interactiveInsert5(UINT personId, UINT forumId, INT joinDate) {
2-
INSERT INTO Forum (PRIMARY_ID) VALUES (forumId);
3-
INSERT INTO Person (PRIMARY_ID) VALUES (personId);
2+
INSERT INTO Forum (id) VALUES (forumId);
3+
INSERT INTO Person (id) VALUES (personId);
44
INSERT INTO HAS_MEMBER VALUES(forumId Forum, personId Person, joinDate);
55
}

tigergraph/queries/interactiveInsert6.gsql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
//IS_LOCATED_IN country is inserted as an attribute
1616
INSERT INTO Post VALUES(postId, imageFile, creationDate, locationIP, browserUsed, language, content, length, countryId);
17-
INSERT INTO Person (PRIMARY_ID) VALUES(authorPersonId);
18-
INSERT INTO Forum (PRIMARY_ID) VALUES(forumId);
17+
INSERT INTO Person (id) VALUES(authorPersonId);
18+
INSERT INTO Forum (id) VALUES(forumId);
1919
INSERT INTO HAS_CREATOR VALUES(postId Post, authorPersonId Person);
2020
INSERT INTO CONTAINER_OF VALUES(forumId Forum, postId Post);
2121

tigergraph/queries/interactiveInsert7.gsql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ CREATE OR REPLACE QUERY interactiveInsert7(
1212
SET<VERTEX<Tag>> tagIds) {
1313

1414
INSERT INTO Comment VALUES(commentId, creationDate, locationIP, browserUsed, content, length, countryId);
15-
INSERT INTO Person (PRIMARY_ID) VAlUES (authorPersonId);
15+
INSERT INTO Person (id) VAlUES (authorPersonId);
1616
INSERT INTO HAS_CREATOR VALUES(commentId Comment, authorPersonId Person);
1717
IF replyToPostId > 0 THEN
18-
INSERT INTO Post (PRIMARY_ID) VALUES(replyToPostId);
18+
INSERT INTO Post (id) VALUES(replyToPostId);
1919
INSERT INTO REPLY_OF (FROM, TO) VALUES(commentId, replyToPostId Post);
2020
END;
2121
IF replyToCommentId > 0 THEN
22-
INSERT INTO Comment (PRIMARY_ID) VALUES(replyToCommentId);
22+
INSERT INTO Comment (id) VALUES(replyToCommentId);
2323
INSERT INTO REPLY_OF (FROM, TO) VALUES(commentId, replyToCommentId Comment);
2424
END;
2525
tmp = {tagIds};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CREATE OR REPLACE QUERY interactiveInsert8(UINT person1Id, UINT person2Id, INT creationDate) {
2-
INSERT INTO Person (PRIMARY_ID) VALUES (person1Id);
3-
INSERT INTO Person (PRIMARY_ID) VALUES (person2Id);
2+
INSERT INTO Person (id) VALUES (person1Id);
3+
INSERT INTO Person (id) VALUES (person2Id);
44
INSERT INTO KNOWS (FROM, TO, creationDate) VALUES(person1Id, person2Id, creationDate);
55
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
set -o pipefail
5+
6+
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
7+
cd ..
8+
9+
. scripts/vars.sh
10+
11+
echo "==============================================================================="
12+
echo "Backup the TIGERGRAPH database"
13+
echo "-------------------------------------------------------------------------------"
14+
echo "TIGERGRAPH_VERSION: ${TIGERGRAPH_VERSION}"
15+
echo "TIGERGRAPH_CONTAINER_NAME: ${TIGERGRAPH_CONTAINER_NAME}"
16+
echo "==============================================================================="
17+
18+
docker exec --user tigergraph --interactive --tty ${TIGERGRAPH_CONTAINER_NAME} bash -c \
19+
"export PATH=/home/tigergraph/tigergraph/app/cmd:\$PATH; \
20+
gadmin config set System.Backup.Local.Enable true; \
21+
gadmin config set System.Backup.Local.Path /home/tigergraph/backup; \
22+
gadmin config apply -y;
23+
export GSQL_USERNAME=tigergraph; \
24+
export GSQL_PASSWORD=tigergraph; \
25+
gbar backup -t snb-backup"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
set -o pipefail
5+
6+
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
7+
cd ..
8+
9+
. scripts/vars.sh
10+
11+
scripts/stop.sh
12+
sleep 4
13+
scripts/start.sh
14+
scripts/setup.sh

0 commit comments

Comments
 (0)