Converting .mysql_history Files to New Format

When I upgraded one of my servers from Fedora 20 to 21 recently, I noticed that – among a few other issues – the command line history of my mysql client was missing. Too me, this is valuable information and documentation, even. So I investigated and found, that the file format for the .mysql_history seemed to have changed and the client had just discarded my old data. The new file now contains various characters (including ‘space’) in octal notation and it starts with a special marker line:

_HiStOrY_V2_

I assume that this change might have been caused by either MariaDB or Fedora itself having switched from readline to using libedit.

#!/usr/bin/env php
<?php
$oldData = file($argv[1]);
foreach ($oldData as $line) {
    readline_add_history($line);
}
readline_write_history($argv[2]);

The PHP package that comes with Fedora 21 seems to be using the same library. So, after restoring my old .mysql_history from backup it was easily converted to the new format using but a few lines of PHP code:

./convert_history.php ~/.mysql_history.bkp ~/.mysql_history

 

 

Fixed Weave Sync Again

After I upgraded my Weave server to API version 1.0, syncing my bookmarks between browsers no longer worked alright. At first, I didn’t really notice because Weave Sync still seemed to work but just not — well, just not always. Fuzzy symptoms that kept me from investigating for some time.

Then, almost by accident, I noticed Jason Frisvold’s post on the mozilla-labs-weave group. He describes exactly the same problems I was having and points to the solution: when I upgraded the user API database table I missed the necessary changes to the WBO table. Most notably, the column containing the modification time of an object has been changed from

`modified` decimal(12,2) DEFAULT NULL

to

`modified` bigint(20) DEFAULT NULL

This resulted in all my bookmark records having a modification time of 9999999999.99 which explains why the syncing would no longer work as expected.

Mozilla Weave Server Upgrade to API Version 1.0

For about half a year I have been using the Mozilla Weave Sync plug-in to synchronize the Firefox data from various systems with my own Weave server. Updating the plug-in during this time has been no problem at all, except getting used to the repeated complete UI overhauls.

Keeping the server component updated, or even knowing when such an updated was required by a new version of the plug-in was not quite as easy.  After my recent upgrade to the first beta release 1.0b1 of the plug-in, the sync process failed again, indicating that an upgrade of the server might be needed.

On the server side, the directory and URL layout has been changed, making it somewhat clearer now.  I gathered the necessary changes from the Mozilla Labs wiki, from the pages describing the setup of the sync and user service.

The sync would still not work at this point, but now I could see why in the server’s error log:  for the MySQL table users, the column username no longer was the primary key. Instead, the developers added a synthetic primary key id to the table. Simply dropping the old key and creating the new one helped to get my weave server up and running again:

ALTER TABLE users DROP PRIMARY KEY;
ALTER TABLE users ADD COLUMN id int(11) NOT NULL PRIMARY KEY auto_increment;