From bc9daf45425cae5a401537b29c800a0ea215ebf6 Mon Sep 17 00:00:00 2001 From: Marcel Clausen Date: Thu, 8 Sep 2022 14:23:32 +0200 Subject: [PATCH 1/3] with this change the pg2sphinx trigger will continue its scan if one of the sphinx queries is invalid. this can happen during deploy days when new configs/images are already activated but the database has not yet been deployed. until now this scenario has not been catched by the except block because it is a ProgrammingError. --- scripts/pg2sphinx_trigger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pg2sphinx_trigger.py b/scripts/pg2sphinx_trigger.py index c18f6394..a95be4ac 100755 --- a/scripts/pg2sphinx_trigger.py +++ b/scripts/pg2sphinx_trigger.py @@ -37,7 +37,7 @@ def pg_get_tables(sql_query, sql_db): t.append(sql_db + '.' + table_i) t = list(set(t)) # get rid of duplicate entries in the list and sorting return ','.join(sorted(t)) - except psycopg2.OperationalError as err: + except (psycopg2.ProgrammingError, psycopg2.OperationalError) as err: sys.stderr.write( f"ERROR: wrong query detected in database: {sql_query}"\ f"\nquery:\n{sql_query}\nerror:\n{err}\n" From 4f8caef08af428400bf6ea7e9456e372ae1abd1f Mon Sep 17 00:00:00 2001 From: Marcel Clausen Date: Fri, 23 Sep 2022 17:51:38 +0200 Subject: [PATCH 2/3] add more infos to log output --- scripts/index-sync-rotate.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/index-sync-rotate.sh b/scripts/index-sync-rotate.sh index 2e8b857c..b9e32d83 100755 --- a/scripts/index-sync-rotate.sh +++ b/scripts/index-sync-rotate.sh @@ -138,6 +138,7 @@ for sphinx_index in ${SPHINX_INDEXES[@]}; do tmp_array=() while IFS= read -r -d '' new_file; do + echo "copy new file: $new_file" | json_logger INFO new_file=$(basename "${new_file}") # shellcheck disable=2001 new_file_renamed=$(sed 's/\.sp\(\w\)$/.new.sp\1/' <<< "${new_file}") @@ -158,11 +159,14 @@ for sphinx_index in ${SPHINX_INDEXES[@]}; do all_files_are_gone=false while ! ${all_files_are_gone}; do all_files_are_gone=true + echo "about to rotate ${sphinx_index}, waiting for ${new_files_merged[*]} to disappear" | json_logger INFO for new_file in ${new_files_merged[@]}; do # skip empty elements [[ -z ${new_file} ]] && continue [ -f "${SPHINX_VOLUME}${new_file}" ] && all_files_are_gone=false done + # shellcheck disable=SC2046 + ${all_files_are_gone} || echo "still exist:" $( cd "${SPHINX_VOLUME}"; ls "${new_files_merged[@]}" 2> /dev/null ) | json_logger INFO sleep 5 done fi From 82415bb8440e377d74aafb63e987db69055b924c Mon Sep 17 00:00:00 2001 From: Marcel Clausen Date: Fri, 23 Sep 2022 17:51:55 +0200 Subject: [PATCH 3/3] fix issue with address rotation without the dot in the -name parameter the address_metaphone* indexes have been synced and rotated too. since this index will be created right after the address index, it has been synced in an instable state into the docker volume. this has led to problems with the index rotation -> SegFault crash of searchd --- scripts/index-sync-rotate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/index-sync-rotate.sh b/scripts/index-sync-rotate.sh index b9e32d83..2cfcaae4 100755 --- a/scripts/index-sync-rotate.sh +++ b/scripts/index-sync-rotate.sh @@ -144,7 +144,7 @@ for sphinx_index in ${SPHINX_INDEXES[@]}; do new_file_renamed=$(sed 's/\.sp\(\w\)$/.new.sp\1/' <<< "${new_file}") cp -fa "${SPHINX_EFS}${new_file}" "${SPHINX_VOLUME}${new_file_renamed}" tmp_array+=("${new_file_renamed}") - done < <(find "${SPHINX_EFS}" -name "${sphinx_index}*" -print0) + done < <(find "${SPHINX_EFS}" -name "${sphinx_index}.*" -print0) if ((${#tmp_array[@]})); then # remove blank strings from array