1

Topic: Sogo - Exchange max table name length limit

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.5-1
- Linux/BSD distribution name and version: Debian Jessie 8.5
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): NginX
- Manage mail accounts with iRedAdmin-Pro? No, not yet
- Related log if you're reporting an issue:  in post
====

I have an iRedMail installation that works well (webmail, sogo web, imap using thunderbird -  all works) but some account cannot access it using exchange (in android - account - exchange).
This installation is used as mail server for a long domain name organization (a_22_character_long_domain.org).

After some digging, I found that there are errors in /var/log/sogo.conf

EXCEPTION: <NSException: 0x7f57fcff8a60> NAME:MAPIStoreIOException REASON:could not create special table 'sogo_cache_folder_firstname_D_lastname_A_a_22_character_long_domain_D_org' INFO:(null)

I think I stumble upon this bug https://sogo.nu/bugs/view.php?id=3447

My question : Is there a way to make that special table name shorter? Which configuration should I change?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Sogo - Exchange max table name length limit

Obviously, it's a SOGo bug, it creates 6 SQL tables for each mail user.

The good news, although SOGo team didn't fix this 7-month long bug, you still have an alternative solution with SOGo-3.x. With this new solution, you just need 9 SQL tables in total in `sogo` database. Note: it "fixes" the long sql table name issue, because it doesn't create new SQL table at all.

DISCLAIMER: You MUST try below solution in a testing machine BEFORE you do it in production, i don't take any responsibility for data lose. You have been warned.

Steps:

*) Update that bug in SOGo bug tracker, so that SOGo team will realize this is a critical bug and fix it.
*) Deploy the latest iRedMail-0.9.5-1 on a NEW virtual machine.
*) Login to SOGo webmail, and generate some data in calendar and contacts.
*) Backup the whole 'sogo' SQL database, and its config file /etc/sogo/sogo.conf.
*) Stop SOGo service.
*) Stop memcached service.
*) Convert old data to new format by running one shell script shipped in SOGo package. You can find it with command 'dpkg -L sogo | grep 'combined'. Sample output (on CentOS):

/usr/share/doc/sogo-3.1.4/sql-update-3.0.0-to-combined-mysql.sh
/usr/share/doc/sogo-3.1.4/sql-update-3.0.0-to-combined.sh

If you are running iRedMail with OpenLDAP or MySQL/MariaDB, you need the first one: sql-update-3.0.0-to-combined-mysql.sh. Now run it:

bash /usr/share/doc/sogo-3.1.4/sql-update-3.0.0-to-combined-mysql.sh

*) Open /etc/sogo/sogo.conf, make sure you have 3 NEW parameters (and correct values): OCSCacheFolderURL , OCSStoreURL, OCSAclURL. If not, add them manually:

OCSCacheFolderURL = "mysql://sogo:<password>@127.0.0.1:3306/sogo/sogo_cache_folder";
OCSStoreURL = "mysql://sogo:<password>@127.0.0.1:3306/sogo/sogo_store";
OCSAclURL = "mysql://sogo:<password>@127.0.0.1:3306/sogo/sogo_acl";

*) Start memcached service.
*) Start SOGo service.
*) Login to SOGo webmail, make sure no data lost.

if data was lost, please check SOGo log file to see whether or not it has some error: /var/log/sogo/sogo.log. And, ask for support in SOGo mailing list. Don't forget to attach the detailed steps you did.

3

Re: Sogo - Exchange max table name length limit

There are some steps that I'm still not clear. I think some some step are missing in:

ZhangHuangbin wrote:

*) Deploy the latest iRedMail-0.9.5-1 on a NEW virtual machine.
*) Login to SOGo webmail, and generate some data in calendar and contacts.

and

ZhangHuangbin wrote:

*) Convert old data to new format by running one shell script shipped in SOGo package.

What should I do with the OLD data. Should I

*) restore the OLD data to the NEW virtual machine THEN convert to new format.

or

*) Convert the newly generated data in the NEW virtual machine THEN merge it IN the OLD machine.

or

*) Convert the newly generated data in the NEW virtual machine THEN merge the OLD DATA into the NEW machine.

4

Re: Sogo - Exchange max table name length limit

*) This short tutorial and new VM are just helping you understand the whole process. You should do the same procedure on your production server eventually.
*) The purpose of generating some data on new VM is used to make sure your data won't lose after the process. If it's ok, you can do it on your production server.

5

Re: Sogo - Exchange max table name length limit

OK. Thank you.

.. and I already updated the bug on sogo bug tracker.

6

Re: Sogo - Exchange max table name length limit

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.5-1
- Linux/BSD distribution name and version: Ubuntu 16.04.1 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mariadb
- sogo nightly 3.1.5.20160812-1 from packages.inverse.ca
====

For my environment, sogo's script to switch to the combined schema:

- did not add the OCSCacheFolderURL parameter to sogo.conf at all
- did not include the sogo sql password in OCSStoreURL or OCSAclURL parameters
- did not create the new sogo_cache_folder table (this is probably normal)
- did not remove all the old sogo_cache_folder_user_domain tables (it dropped most, but left a handful behind)

The first two were easy to fix by editing sogo.conf. 

The new sogo_cache_folder table was not created by the script, but sogo itself autocreated the table.

As for the leftover old cache tables, I'm 99.99% sure I can go ahead and drop them, but they aren't hurting anything so I'm not in a hurry.  I'll keep an eye on the file mod dates under /var/lib/mysql/sogo and if they don't change in a month then the tables can go.

Hope this helps somebody.

7

Re: Sogo - Exchange max table name length limit

Hi deltatango, thanks for sharing.

I suggest you post these issues to SOGo mailing list, AND its bug tracker. So that SOGo developers can fix them.