summaryrefslogtreecommitdiffstats
path: root/src/main/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scripts')
-rw-r--r--src/main/scripts/dataRestoreFromSnapshot.sh6
-rw-r--r--src/main/scripts/dataRestoreFromSnapshotMulti.sh52
-rw-r--r--src/main/scripts/dataSnapshot.sh9
-rw-r--r--src/main/scripts/dynamicPayloadGenerator.sh10
-rw-r--r--src/main/scripts/dynamicPayloadPartial.sh2
-rw-r--r--src/main/scripts/preDataRestore.sh44
-rw-r--r--src/main/scripts/run_Migrations.sh2
7 files changed, 115 insertions, 10 deletions
diff --git a/src/main/scripts/dataRestoreFromSnapshot.sh b/src/main/scripts/dataRestoreFromSnapshot.sh
index 405a667..20bd0a8 100644
--- a/src/main/scripts/dataRestoreFromSnapshot.sh
+++ b/src/main/scripts/dataRestoreFromSnapshot.sh
@@ -21,10 +21,10 @@ if [ "$#" -lt 1 ]; then
fi
source_profile;
-export PRE_JAVA_OPTS=${PRE_JAVA_OPTS:--Xms6g -Xmx8g};
+export JAVA_PRE_OPTS=${JAVA_PRE_OPTS:--Xms6g -Xmx8g};
#### Step 1) clear out the database
-execute_spring_jar org.onap.aai.datasnapshot.DataSnapshot ${PROJECT_HOME}/resources/logback.xml "CLEAR_ENTIRE_DATABASE" "$1" "$2"
+execute_spring_jar org.onap.aai.datasnapshot.DataSnapshot ${PROJECT_HOME}/resources/logback.xml "-c" "CLEAR_ENTIRE_DATABASE" "-f" "$1"
if [ "$?" -ne "0" ]; then
echo "Problem clearing out database."
exit 1
@@ -39,7 +39,7 @@ fi
#### Step 3) reload the data from a snapshot file
-execute_spring_jar org.onap.aai.datasnapshot.DataSnapshot ${PROJECT_HOME}/resources/logback.xml "RELOAD_DATA" "$1"
+execute_spring_jar org.onap.aai.datasnapshot.DataSnapshot ${PROJECT_HOME}/resources/logback.xml "-c" "RELOAD_DATA" "-f" "$1"
if [ "$?" -ne "0" ]; then
echo "Problem reloading data into the database."
end_date;
diff --git a/src/main/scripts/dataRestoreFromSnapshotMulti.sh b/src/main/scripts/dataRestoreFromSnapshotMulti.sh
new file mode 100644
index 0000000..1e322dc
--- /dev/null
+++ b/src/main/scripts/dataRestoreFromSnapshotMulti.sh
@@ -0,0 +1,52 @@
+#!/bin/ksh
+#
+# NOTE - this is the updated version of this script which uses multi-threaded reload code
+#
+# This script uses the dataSnapshot and SchemaGenerator (via GenTester) java classes to restore
+# data to a database by doing three things:
+# 1) clear out whatever data and schema are currently in the db
+# 2) rebuild the schema (using the SchemaGenerator)
+# 3) reload data from the passed-in datafile (which must found in the dataSnapShots directory and
+# contain an xml view of the db data).
+#
+
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
+start_date;
+check_user;
+
+if [ "$#" -lt 1 ]; then
+ echo "Illegal number of parameters"
+ echo "usage: $0 previous_snapshot_filename"
+ exit 1
+fi
+
+source_profile;
+export JAVA_PRE_OPTS=${JAVA_PRE_OPTS:--Xms6g -Xmx8g};
+
+#### Step 1) clear out the database
+execute_spring_jar org.onap.aai.datasnapshot.DataSnapshot ${PROJECT_HOME}/resources/logback.xml "-c" "CLEAR_ENTIRE_DATABASE" "-f" "$1"
+if [ "$?" -ne "0" ]; then
+ echo "Problem clearing out database."
+ exit 1
+fi
+
+#### Step 2) rebuild the db-schema
+execute_spring_jar org.onap.aai.schema.GenTester ${PROJECT_HOME}/resources/logback.xml "GEN_DB_WITH_NO_DEFAULT_CR"
+if [ "$?" -ne "0" ]; then
+ echo "Problem rebuilding the schema (SchemaGenerator)."
+ exit 1
+fi
+
+#### Step 3) reload the data from a snapshot file
+
+execute_spring_jar org.onap.aai.datasnapshot.DataSnapshot ${PROJECT_HOME}/resources/logback.xml "-c" "MULTITHREAD_RELOAD" "-f" "$1"
+if [ "$?" -ne "0" ]; then
+ echo "Problem reloading data into the database."
+ end_date;
+ exit 1
+fi
+
+end_date;
+exit 0
diff --git a/src/main/scripts/dataSnapshot.sh b/src/main/scripts/dataSnapshot.sh
index f380e85..ca3b033 100644
--- a/src/main/scripts/dataSnapshot.sh
+++ b/src/main/scripts/dataSnapshot.sh
@@ -23,6 +23,15 @@ fi
start_date;
check_user;
source_profile;
+
+# Only sourcing the file aai-graphadmin-tools-vars for dataSnapshot
+# Do not source this for dataRestore or otherwise
+# both taking a snapshot and restoring from a snapshot
+# will use the same amount of memory but restoring from snapshot
+# will use a lot more memory than taking a snapshot
+if [ -f "$PROJECT_HOME/resources/aai-graphadmin-tools-vars.sh" ]; then
+ source $PROJECT_HOME/resources/aai-graphadmin-tools-vars.sh
+fi;
execute_spring_jar org.onap.aai.datasnapshot.DataSnapshot $PROJECT_HOME/resources/logback.xml "$@"
end_date;
exit 0
diff --git a/src/main/scripts/dynamicPayloadGenerator.sh b/src/main/scripts/dynamicPayloadGenerator.sh
index 3d30790..2140354 100644
--- a/src/main/scripts/dynamicPayloadGenerator.sh
+++ b/src/main/scripts/dynamicPayloadGenerator.sh
@@ -136,15 +136,15 @@ while getopts ":f:s:d:n:c:i:m:o:p:" opt; do
echo 'Done'
-set -A nodes pserver cloud-region availability-zone tenant zone complex
-
+set -A nodes customer service-subscription service pserver cloud-region availability-zone tenant zone complex
#Create empty partial file
> $INPUT_DATASNAPSHOT_FILE".partial"
for nodeType in ${nodes[@]}
- do
- grep "aai-node-type.*\"value\":\"$nodeType\"" $INPUT_DATASNAPSHOT_FILE >>$INPUT_DATASNAPSHOT_FILE'.partial'
- done
+ do
+ grep "aai-node-type.*\"value\":\"$nodeType\"" $INPUT_DATASNAPSHOT_FILE'.P'* >>$INPUT_DATASNAPSHOT_FILE'.out'
+ cat $INPUT_DATASNAPSHOT_FILE'.out' | cut -d':' -f2- > $INPUT_DATASNAPSHOT_FILE'.partial'
+ done
execute_spring_jar org.onap.aai.dbgen.DynamicPayloadGenerator ${PROJECT_HOME}/resources/dynamicPayloadGenerator-logback.xml -s ${VALIDATE_SCHEMA} \
diff --git a/src/main/scripts/dynamicPayloadPartial.sh b/src/main/scripts/dynamicPayloadPartial.sh
index 8021aa6..77b2919 100644
--- a/src/main/scripts/dynamicPayloadPartial.sh
+++ b/src/main/scripts/dynamicPayloadPartial.sh
@@ -3,7 +3,7 @@
#Create empty partial snapshot file
INPUT_DATASNAPSHOT_FILE=$1
-set -A nodes pserver cloud-region availability-zone tenant zone complex
+set -A nodes customer service-subscription service pserver cloud-region availability-zone tenant zone complex
> $INPUT_DATASNAPSHOT_FILE".partial"
for nodeType in ${nodes[@]}
diff --git a/src/main/scripts/preDataRestore.sh b/src/main/scripts/preDataRestore.sh
new file mode 100644
index 0000000..c176a1a
--- /dev/null
+++ b/src/main/scripts/preDataRestore.sh
@@ -0,0 +1,44 @@
+#!/bin/ksh
+#
+# This script does just the first two steps of our normal dataRestoreFromSnapshot script.
+# This should only be needed if we are trouble-shooting and need to run step 3 (the
+# actual call to dataSnapshot) separately with different input params.
+#
+# This script does these two steps:
+# 1) clear out whatever data and schema are currently in the db
+# 2) rebuild the schema (using the SchemaGenerator)
+#
+
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
+start_date;
+check_user;
+
+if [ "$#" -lt 1 ]; then
+ echo "Illegal number of parameters"
+ echo "usage: $0 previous_snapshot_filename"
+ exit 1
+fi
+
+source_profile;
+export JAVA_PRE_OPTS=${JAVA_PRE_OPTS:--Xms6g -Xmx8g};
+
+#### Step 1) clear out the database
+execute_spring_jar org.onap.aai.datasnapshot.DataSnapshot ${PROJECT_HOME}/resources/logback.xml "CLEAR_ENTIRE_DATABASE" "$1" "$2"
+if [ "$?" -ne "0" ]; then
+ echo "Problem clearing out database."
+ exit 1
+fi
+
+#### Step 2) rebuild the db-schema
+execute_spring_jar org.onap.aai.schema.GenTester ${PROJECT_HOME}/resources/logback.xml "GEN_DB_WITH_NO_DEFAULT_CR"
+if [ "$?" -ne "0" ]; then
+ echo "Problem rebuilding the schema (SchemaGenerator)."
+ exit 1
+fi
+
+
+
+end_date;
+exit 0
diff --git a/src/main/scripts/run_Migrations.sh b/src/main/scripts/run_Migrations.sh
index 2b0f5c5..cbfe335 100644
--- a/src/main/scripts/run_Migrations.sh
+++ b/src/main/scripts/run_Migrations.sh
@@ -30,7 +30,7 @@ start_date;
check_user;
source_profile;
-ARGS="-c ${PROJECT_HOME}/resources/etc/appprops/janusgraph-realtime.properties";
+ARGS="-c ${PROJECT_HOME}/resources/etc/appprops/janusgraph-migration.properties";
if [ -f "$PROJECT_HOME/resources/application.properties" ]; then
# Get the application properties file and look for all lines