Skip to content

Commit 92995ff

Browse files
committed
Try to improve DB filling in container [fix]
1 parent c3de449 commit 92995ff

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

run/_common

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ script_dir="$(dirname "$script_path")"
1515
proj_root_dir="$(cd "$script_dir"/..; pwd)"
1616
build_dir="$proj_root_dir/build"
1717
data_dir="${DATA_DIR:-$build_dir/data}"
18-
db_dir="${DB_DIR:-$build_dir/rdf_db}"
18+
db_base_dir="${DB_BASE_DIR:-$build_dir/rdf_db}"
19+
db_dir="$db_base_dir/active"
20+
db_tmp_dir="$db_base_dir/tmp"
21+
db_bak_dir="$db_base_dir/backup"
1922
res_dir="${RES_DIR:-$proj_root_dir/res}"
2023

2124
# See: https://stackoverflow.com/a/7335120/586229

run/fill-db

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,11 @@ then
173173
done
174174
fi
175175

176-
tmp_db_dir="${db_dir}_tmp"
177-
bak_db_dir="${db_dir}_bak"
178-
179176
echo
180-
echo "Setting up the DB in '$db_dir' (temp dir: '$tmp_db_dir') ..."
177+
echo "Setting up the DB in '$db_dir' (temp dir: '$db_tmp_dir') ..."
181178

182-
rm -Rf "$tmp_db_dir"
183-
mkdir -p "$tmp_db_dir"
179+
rm -Rf "$db_tmp_dir"
180+
mkdir -p "$db_tmp_dir"
184181
echo "Loading data into the DB ..."
185182
# --loader=parallel \
186183
time find \
@@ -189,7 +186,7 @@ time find \
189186
-name "*.ttl" \
190187
-print0 \
191188
| xargs -0 "$jena_db_data_injector" \
192-
--loc "$tmp_db_dir" \
189+
--loc "$db_tmp_dir" \
193190
--syntax turtle \
194191
2>&1 | awk -v ORS='' \
195192
'
@@ -230,11 +227,11 @@ END {
230227
echo
231228
if [ -e "$db_dir" ]
232229
then
233-
rm -Rf "$bak_db_dir"
234-
mv "$db_dir" "$bak_db_dir"
235-
echo "The old DB is now at '$bak_db_dir'."
230+
rm -Rf "$db_bak_dir"
231+
mv "$db_dir" "$db_bak_dir"
232+
echo "The old DB is now at '$db_bak_dir'."
236233
fi
237-
mv "$tmp_db_dir" "$db_dir"
234+
mv "$db_tmp_dir" "$db_dir"
238235
echo "done. (Setting up the DB)"
239236

240237
echo

0 commit comments

Comments
 (0)