Skip to content

Conversation

@andylemin
Copy link
Contributor

@andylemin andylemin commented Jan 19, 2026

MySQL CNID Backend: improve charset performance, TCP performance, and test container config

  • Enable TCP_NODELAY for MySQL/MariaDB TCP connections to reduce query latency
  • Reduce connection/read/write timeouts from 600s to 30s
  • Set UTF-8 charset (utf8mb4) at connection time for UTF-8 volumes (avoid repeated dynamic detection overhead)
  • Add improved logging for connection info and table creation
  • Enhanced Docker entrypoint to support MySQL/MariaDB testing via TCP and Socket
  • Add mariadb package to Alpine testsuite Dockerfile
  • Update afp.conf documentation for MySQL backend options

…ner config

- Enable TCP_NODELAY for MySQL/MariaDB TCP connections to reduce query latency
- Reduce connection/read/write timeouts from 600s to 30s
- Set UTF-8 charset (utf8mb4) at connection time for UTF-8 volumes (avoid repeated dynamic detection overhead)
- Add improved logging for connection info and table creation
- Enhanced Docker entrypoint to support MySQL/MariaDB testing via TCP and Socket
- Add mariadb package to Alpine testsuite Dockerfile
- Update afp.conf documentation for MySQL backend options
@sonarqubecloud
Copy link

@andylemin andylemin changed the title MySQL CNID Backend: improve performance, TCP support, and test container config MySQL CNID Backend: improve charset performance, TCP performance, and test container config Jan 19, 2026
fi

echo "*** MySQL CNID backend configured: host='$AFP_CNID_SQL_HOST', user='$AFP_CNID_SQL_USER', db='$AFP_CNID_SQL_DB'"
# Start MariaDB server if using localhost or 127.0.0.1 - for container-local database
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do I understand it correctly that this is a local mariadb configuration strictly for testing Unix sockets in a container, or is it something that someone could reasonably choose for a production container deployment too?

depending on the answer, I may have follow-up suggestions. :)

Copy link
Contributor Author

@andylemin andylemin Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, both!

It was setup to support setting the MySQL host to "localhost" (test Unix socket), or "127.0.0.1" (test TCP without Nagle).

But yes, you could add this to the production container with "localhost" and then it would be production ready

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then my suggestion would be that we test this configuration in the github workflow, in an additional job!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, yes agreed. I'll finish the clean up on this tonight

Comment on lines +272 to +274
mac charset = ${AFP_MAC_CHARSET:-MAC_ROMAN}
unix charset = ${AFP_UNIX_CHARSET:-UTF8}
vol charset = ${AFP_VOL_CHARSET:-UTF8}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these could be useful for the general public, so please document them in distrib/docker/README.md !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.
Added as I needed to test the charset used with MySQL.

Also want to debug why everything but MacRoman reports as an invalid charset for the Mac charset.

Comment on lines +506 to +507
> On Windows systems, TCP is always used regardless of this setting since
> Unix sockets are not supported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since netatalk doesn't run on Windows, I wonder if it's redundant to describe this caveat?

LOG(log_info, logtype_cnid,
"MySQL CNID backend: host='%s', user='%s', database='%s'",
obj->options.cnid_mysql_host ? obj->options.cnid_mysql_host : "(default)",
obj->options.cnid_mysql_user ? obj->options.cnid_mysql_user : "(none)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it can be seen as security sensitive to log usernames?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Logging is done safely and with the correct permissions, but yes I agree, I'll remove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants