From c1ce32ac943f559b5ada73c3b88d924a1a415aa2 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 12 May 2015 15:48:42 -0400 Subject: [PATCH] (fix) now handle very large amount of participants correctly (#3175) --- Documentation/SOGoInstallationGuide.asciidoc | 7 +++ NEWS | 1 + SOPE/GDLContentStore/appointment-oracle.ocs | 2 +- SOPE/GDLContentStore/appointment.ocs | 2 +- Scripts/sql-update-2.1.17_to_2.1.18-mysql.sh | 57 ++++++++++++++++++++ Scripts/sql-update-2.1.17_to_2.1.18.sh | 54 +++++++++++++++++++ 6 files changed, 121 insertions(+), 2 deletions(-) create mode 100755 Scripts/sql-update-2.1.17_to_2.1.18-mysql.sh create mode 100755 Scripts/sql-update-2.1.17_to_2.1.18.sh diff --git a/Documentation/SOGoInstallationGuide.asciidoc b/Documentation/SOGoInstallationGuide.asciidoc index e74cf48b0..4f35a7e47 100644 --- a/Documentation/SOGoInstallationGuide.asciidoc +++ b/Documentation/SOGoInstallationGuide.asciidoc @@ -2714,6 +2714,13 @@ sudo -u sogo mv ~/GNUstep/Defaults/.GNUstepDefaults \ ~/GNUstep/Defaults/GNUstepDefaults.old ---- +h|2.1.18 +|Run the shell script `sql-update-2.1.17_to_2.1.18.sh` or +`sql-update-2.1.18_to_2.1.18-mysql.sh` (if you use MySQL). + +This will grow the "participant states" field of calendar tables to a larger +size. + h|2.0.4 |The parameter _SOGoForceIMAPLoginWithEmail_ is now deprecated and is replaced by _SOGoForceExternalLoginWithEmail_ (which extends the diff --git a/NEWS b/NEWS index 12680c84c..23e65b00e 100644 --- a/NEWS +++ b/NEWS @@ -49,6 +49,7 @@ Bug fixes - now set MeetingMessageType only for EAS 14.1 - now correctly handle external invitations using EAS - now correctly handle multiple email addresses in the GAL over EAS (#3102) + - now handle very large amount of participants correctly (#3175) 2.2.17a (2015-03-15) -------------------- diff --git a/SOPE/GDLContentStore/appointment-oracle.ocs b/SOPE/GDLContentStore/appointment-oracle.ocs index e5ab7197b..845c933b6 100644 --- a/SOPE/GDLContentStore/appointment-oracle.ocs +++ b/SOPE/GDLContentStore/appointment-oracle.ocs @@ -131,7 +131,7 @@ }, { columnName = c_partstates; - sqlType = "VARCHAR2(255)"; + sqlType = "CLOB"; allowsNull = YES; }, { diff --git a/SOPE/GDLContentStore/appointment.ocs b/SOPE/GDLContentStore/appointment.ocs index d17e7d69f..926df67b8 100644 --- a/SOPE/GDLContentStore/appointment.ocs +++ b/SOPE/GDLContentStore/appointment.ocs @@ -131,7 +131,7 @@ }, { columnName = c_partstates; - sqlType = "VARCHAR(255)"; + sqlType = "TEXT"; allowsNull = YES; }, { diff --git a/Scripts/sql-update-2.1.17_to_2.1.18-mysql.sh b/Scripts/sql-update-2.1.17_to_2.1.18-mysql.sh new file mode 100755 index 000000000..0a1dfb522 --- /dev/null +++ b/Scripts/sql-update-2.1.17_to_2.1.18-mysql.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +set -e + +# This script only works with MySQL +# updates c_partstates to mediumtext. +# http://www.sogo.nu/bugs/view.php?id=3175 +# the field length was actually changed in v2.2.18 + +defaultusername=$USER +defaulthostname=127.0.0.1 +defaultdatabase=$USER +indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}') +if [ -z "$indextable" ]; then + echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2 + exit 1 +fi + +read -p "Username ($defaultusername): " username +read -p "Hostname ($defaulthostname): " hostname +read -p "Database ($defaultdatabase): " database + +if [ -z "$username" ] +then + username=$defaultusername +fi + +if [ -z "$hostname" ] +then + hostname=$defaulthostname +fi + +if [ -z "$database" ] +then + database=$defaultdatabase + fi + +sqlscript="" + +function growVC() { + oldIFS="$IFS" + IFS=" " + part="`echo -e \"ALTER TABLE $table MODIFY c_partstates mediumtext;\\n\"`"; + sqlscript="$sqlscript$part" + IFS="$oldIFS" +} + +echo "This script will ask for the sql password twice" >&2 +echo "Converting c_partstates from VARCHAR(255) to mediumtext in calendar quick tables" >&2 +tables=`mysql -p -s -u $username -h $hostname $database -e "select SUBSTRING_INDEX(c_quick_location, '/', -1) from $indextable where c_path3 = 'Calendar';"` + +for table in $tables; +do + growVC +done + +echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database diff --git a/Scripts/sql-update-2.1.17_to_2.1.18.sh b/Scripts/sql-update-2.1.17_to_2.1.18.sh new file mode 100755 index 000000000..9312a1a33 --- /dev/null +++ b/Scripts/sql-update-2.1.17_to_2.1.18.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +set -e +# This script only works with PostgreSQL +# updates c_partstates to text. +# http://www.sogo.nu/bugs/view.php?id=3175 +# the field length was actually changed in v2.2.18 + +defaultusername=$USER +defaulthostname=localhost +defaultdatabase=$USER +#indextable=sogo_folder_info +indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}') +if [ -z "$indextable" ]; then + echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2 + exit 1 +fi + +read -p "Username ($defaultusername): " username +read -p "Hostname ($defaulthostname): " hostname +read -p "Database ($defaultdatabase): " database + +if [ -z "$username" ] +then + username=$defaultusername +fi +if [ -z "$hostname" ] +then + hostname=$defaulthostname +fi +if [ -z "$database" ] +then + database=$defaultdatabase +fi + +sqlscript="" + +function growVC() { + oldIFS="$IFS" + IFS=" " + part="`echo -e \"ALTER TABLE $table ALTER COLUMN c_partstates TYPE TEXT;\\n\"`"; + sqlscript="$sqlscript$part" + IFS="$oldIFS" +} + +echo "Converting c_cycleinfo from VARCHAR(255) to TEXT in calendar quick tables" >&2 +tables=`psql -t -U $username -h $hostname $database -c "select split_part(c_quick_location, '/', 5) from $indextable where c_path3 = 'Calendar';"` + +for table in $tables; +do + growVC +done + +echo "$sqlscript" | psql -q -e -U $username -h $hostname $database