Apparently myisamchk Doesn’t Understand 2-Digit Numbers (MySQL)

MySql Logo

myisamchk If you’re reading this, it’s probably because you’re trying to run myisamchk on a large table and you want to set the –sort_buffer_size to some large value. That’s advisable, of course. However, it seems that some versions of MySQL don’t understand a 2-digit value for that parameter. I was trying to do the following: myisamchk -f -r –update-state –key_buffer_size=4G –sort_buffer_size=16G –read_buffer_size=32M –write_buffer_size=32M /var/sql/myisam-temp/mastersitedb/applicants_master_search – recovering (with sort) MyISAM-table ‘/var/sql/myisam-temp/mastersitedb/applicants_master_search’ Data records: 0 – Fixing index 1 myisamchk: error: myisam_sort_buffer_size is too small MyISAM-table ‘/var/sql/myisam-temp/mastersitedb/applicants_master_search’ is not fixed because of errors Try fixing it by using the –safe-recover (-o), the –force (-f) option or by not using the –quick (-q) flag If you’re getting an error like that, try using … Continue reading

Redundant email servers with soft-fail (450) vs. hard-fail (550)

postfix_soft_fail

I manage a fairly large number of incoming mail exchangers, which are numerous both to handle large message volumes as well as to provide redundancy. In most cases, these mail servers are Postfix with MySQL providing virtual alias maps, transport maps, relay domains, and virtual alias domains. Unfortunately the Postfix+MySQL implementation isn’t always 100% great. On very rare occasions the Postfix instance may fail to communicate with the MySQL server, for any number of reasons. From the perspective of the sender’s MX, this usually results in a 550 status code (often given as “Relay access denied”). This is a hard-fail, in that it tells the upstream MX that the recipient they’re trying to reach is permanently unavailable. The upstream MX … Continue reading

Using Postfix with MySQL Stored Procedures? (Just Use Functions)

postfix_random

If you’re like me and want to use Postfix with a MySQL backend, you may have also wanted to be able to call stored procedures from Postfix. Unfortunately, MySQL stored procs return multiple resultsets while Postfix’s call to the MySQL C API can only process a single resultset.  I banged my head against the wall for a while until I realized that a function called from a SELECT statement would return a Postfix-friendly single resultset. For example, this would be a perfectly acceptable virtual alias map file: user = mailreader password = somepassword dbname = mail_config query = SELECT retval FROM (SELECT fnPostfixVirtualAliasMapGet(‘%s’) AS retval) t WHERE t.retval IS NOT NULL; hosts = 127.0.0.1 This is useful if, for example, … Continue reading