From a2215462bc40971b0278d430badfa32585bdb889 Mon Sep 17 00:00:00 2001 From: mirocow Date: Tue, 16 Feb 2016 14:38:39 +0400 Subject: [PATCH] fix segment (rm and load) --- restore.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/restore.sh b/restore.sh index f6203cb..a3e3dae 100755 --- a/restore.sh +++ b/restore.sh @@ -110,10 +110,12 @@ restore() split -l $CONFIG_CHUNK "$DIR/$TABLE.txt" ${TABLE}_part_ for segment in ${TABLE}_part_*; do time mysql --defaults-extra-file=$CONFIG_FILE $BDD --local-infile -e "SET foreign_key_checks = 0; SET unique_checks = 0; SET sql_log_bin = 0; - LOAD DATA LOCAL INFILE '$DIR/$BDD/$TABLE.txt' + LOAD DATA LOCAL INFILE '$DIR/$BDD/$segment' INTO TABLE $TABLE; SET foreign_key_checks = 1; SET unique_checks = 1; SET sql_log_bin = 1;" - rm $segment + if [ -f "$DIR/$BDD/$segment" ]; then + rm $segment + fi done if [ ! -f "$DIR/$BDD/$TABLE.txt.bz2" ]; then f_log "> $TABLE"