-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make export-dir, source and target databases dynamic to enable parallel runs #2019
Changes from 19 commits
f4da0f4
ad054cb
1918713
335247a
1ea24a7
23942d0
7835cd3
41e0b18
4962c24
f903d09
eecd0e9
f70ea8b
901d774
d478e31
ccece7e
fa67610
bf31156
c6c16bc
ff7373a
be69d26
c49b3d1
a9035b7
a582746
0c88b8a
c6fa662
dcdc035
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ export REPO_ROOT="${PWD}" | |
export SCRIPTS="${REPO_ROOT}/migtests/scripts" | ||
export TESTS_DIR="${REPO_ROOT}/migtests/tests" | ||
export TEST_DIR="${TESTS_DIR}/${TEST_NAME}" | ||
export EXPORT_DIR=${EXPORT_DIR:-"${TEST_DIR}/export-dir"} | ||
export NORMALIZED_TEST_NAME="$(echo "$TEST_NAME" | tr '/-' '_')" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where do we get There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TEST_NAME is passed during the test invocation. |
||
|
||
export PYTHONPATH="${REPO_ROOT}/migtests/lib" | ||
export PATH="${PATH}:/usr/lib/oracle/21/client64/bin" | ||
|
@@ -31,13 +31,27 @@ else | |
source "${TEST_DIR}/env.sh" | ||
fi | ||
|
||
export EXPORT_DIR=${EXPORT_DIR:-"${TEST_DIR}/${NORMALIZED_TEST_NAME}_fallf_export-dir"} | ||
if [ -n "${SOURCE_DB_SSL_MODE}" ]; then | ||
EXPORT_DIR="${EXPORT_DIR}_ssl" | ||
fi | ||
|
||
if [ "${SOURCE_DB_TYPE}" = "oracle" ] | ||
then | ||
source ${SCRIPTS}/${SOURCE_DB_TYPE}/live_env.sh | ||
else | ||
source ${SCRIPTS}/${SOURCE_DB_TYPE}/env.sh | ||
fi | ||
|
||
if [[ "${SOURCE_DB_TYPE}" == "postgresql" || "${SOURCE_DB_TYPE}" == "mysql" ]]; then | ||
export SOURCE_DB_NAME=${SOURCE_DB_NAME:-"${NORMALIZED_TEST_NAME}_fallf"} | ||
elif [[ "${SOURCE_DB_TYPE}" == "oracle" ]]; then | ||
export SOURCE_DB_SCHEMA=${SOURCE_DB_SCHEMA:-"${NORMALIZED_TEST_NAME:0:10}_fallf"} && export SOURCE_DB_SCHEMA=${SOURCE_DB_SCHEMA^^} | ||
else | ||
echo "ERROR: Unsupported SOURCE_DB_TYPE: ${SOURCE_DB_TYPE}" | ||
exit 1 | ||
fi | ||
|
||
source ${SCRIPTS}/${SOURCE_DB_TYPE}/ff_env.sh | ||
|
||
source ${SCRIPTS}/yugabytedb/env.sh | ||
|
@@ -62,7 +76,8 @@ main() { | |
|
||
if [ "${SOURCE_DB_TYPE}" = "oracle" ] | ||
then | ||
create_ff_schema ${SOURCE_REPLICA_DB_NAME} | ||
create_source_db ${SOURCE_DB_SCHEMA} | ||
create_source_db ${SOURCE_REPLICA_DB_SCHEMA} | ||
run_sqlplus_as_sys ${SOURCE_REPLICA_DB_NAME} ${SCRIPTS}/oracle/create_metadata_tables.sql | ||
fi | ||
./init-db | ||
|
@@ -206,7 +221,12 @@ main() { | |
import_schema --post-snapshot-import true --refresh-mviews true | ||
|
||
step "Run snapshot validations." | ||
"${TEST_DIR}/validate" --live_migration 'true' --ff_enabled 'true' --fb_enabled 'false' | ||
"${TEST_DIR}/validate" --live_migration 'true' --ff_enabled 'true' --fb_enabled 'false' || { | ||
tail_log_file "yb-voyager-import-data.log" | ||
tail_log_file "yb-voyager-export-data-from-source.log" | ||
tail_log_file "yb-voyager-import-data-to-source-replica.log" | ||
exit 1 | ||
} | ||
|
||
step "Inserting new events to source" | ||
run_sql_file source_delta.sql | ||
|
@@ -286,7 +306,7 @@ main() { | |
|
||
step "Clean up" | ||
./cleanup-db | ||
rm -rf "${EXPORT_DIR}/*" | ||
rm -rf "${EXPORT_DIR}" | ||
run_ysql yugabyte "DROP DATABASE IF EXISTS ${TARGET_DB_NAME};" | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ export REPO_ROOT="${PWD}" | |
export SCRIPTS="${REPO_ROOT}/migtests/scripts" | ||
export TESTS_DIR="${REPO_ROOT}/migtests/tests" | ||
export TEST_DIR="${TESTS_DIR}/${TEST_NAME}" | ||
export EXPORT_DIR=${EXPORT_DIR:-"${TEST_DIR}/export-dir"} | ||
export NORMALIZED_TEST_NAME="$(echo "$TEST_NAME" | tr '/-' '_')" | ||
export QUEUE_SEGMENT_MAX_BYTES=400 | ||
|
||
export PYTHONPATH="${REPO_ROOT}/migtests/lib" | ||
|
@@ -37,6 +37,20 @@ else | |
source ${SCRIPTS}/${SOURCE_DB_TYPE}/env.sh | ||
fi | ||
|
||
export EXPORT_DIR=${EXPORT_DIR:-"${TEST_DIR}/${NORMALIZED_TEST_NAME}_live_export-dir"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this code is the same for all tests? |
||
if [ -n "${SOURCE_DB_SSL_MODE}" ]; then | ||
EXPORT_DIR="${EXPORT_DIR}_ssl" | ||
fi | ||
|
||
if [[ "${SOURCE_DB_TYPE}" == "postgresql" || "${SOURCE_DB_TYPE}" == "mysql" ]]; then | ||
export SOURCE_DB_NAME=${SOURCE_DB_NAME:-"${NORMALIZED_TEST_NAME}_live"} | ||
elif [[ "${SOURCE_DB_TYPE}" == "oracle" ]]; then | ||
export SOURCE_DB_SCHEMA=${SOURCE_DB_SCHEMA:-"${NORMALIZED_TEST_NAME:0:10}_live"} && export SOURCE_DB_SCHEMA=${SOURCE_DB_SCHEMA^^} | ||
else | ||
echo "ERROR: Unsupported SOURCE_DB_TYPE: ${SOURCE_DB_TYPE}" | ||
exit 1 | ||
fi | ||
|
||
source ${SCRIPTS}/yugabytedb/env.sh | ||
|
||
source ${SCRIPTS}/functions.sh | ||
|
@@ -56,6 +70,10 @@ main() { | |
pushd ${TEST_DIR} | ||
|
||
step "Initialise source database." | ||
if [ "${SOURCE_DB_TYPE}" = "oracle" ] | ||
then | ||
create_source_db ${SOURCE_DB_SCHEMA} | ||
fi | ||
./init-db | ||
|
||
step "Grant source database user permissions for live migration" | ||
|
@@ -218,7 +236,7 @@ main() { | |
|
||
step "Clean up" | ||
./cleanup-db | ||
rm -rf "${EXPORT_DIR}/*" | ||
rm -rf "${EXPORT_DIR}" | ||
run_ysql yugabyte "DROP DATABASE IF EXISTS ${TARGET_DB_NAME};" | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why
:0:10
? pls add a comment.what is ^^?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ^^ to make the schema uppercase