CE 11: Missing index leads to 99% load on server

I have installed Seafile CE 11 today as docker container and did some sync tests.
Later I have recognized one process with 99% load on the server.

Here are the findings and the cure:

  • Seafile CE 11, New Installation

    MariaDB 10.11.16

    FileHistory table is missing an index on repo_id_path_md5

    Symptom: 99% CPU load after a short period of operation

    Fix: CREATE INDEX ix_FileHistory_md5_timestamp ON seahub_db.FileHistory (repo_id_path_md5, timestamp);

11 is a pretty old version. Is there some specific reason you aren’t using the current version for your deployment? It’s pretty likely that if this is a bug it has been fixed in the new version.

I have the same issue on CE 12.0 (seafileltd/seafile-mc:12.0-latest).

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
485913 minio-u+  20   0 2600008 203456   6784 S  98.7   2.5  23:26.65 mariadbd

After
MariaDB [(none)]> CREATE INDEX ix_FileHistory_md5_timestamp ON seahub_db.FileHistory (repo_id_path_md5, timestamp);

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                         
 485913 minio-u+  20   0 2600308 237168   7936 S   0.0   2.9  28:03.05 mariadbd   

I consider this a bug.

Reported it at -github.com/haiwen/seafile/issues

Edit:

I see now, CE 13 is also marked as stable now, I will test it also.

The issue is checked on GitHub now.