Monday, 17 September 2007

Bug: Cluster synchronisation of already-deleted session files

Cluster synchronisation could loop with a failed copy transaction when, while processing a backlog of synchronisation transactions, a copy transaction for a session ({\tt .hds}), active session ({\tt .hda}), or remember me ({\tt .hdr}) file was executed after the file in question had been deleted at the close of the session. I added code, similar to the September 5 fix for deletion transactions, which considers copy transactions which fail due to nonexistence of the source file as having completed normally.

Bug: Cluster synchronisation of files containing ISO-8859 unescaped characters

Cluster synchronisation transaction files were written in UTF-8, but {\tt ClusterSync.pl} failed to open them in this mode. This caused file names which contained ISO-8859 characters above the 7 bit ASCII range which we do not escape to be misinterpreted when the transaction was read, resulting in a signature verification failure for the transaction. I added a ``{\tt :utf8}'' specification to the open of the transaction file so it will be read correctly. I also set {\tt STDOUT} to UTF-8 mode so that error messages are printed in that mode. The log file remains in ISO-8859 mode, as that will handle all characters which we do not escape.

Wednesday, 5 September 2007

Bug/admin: Global statistics for recently-created accounts

Global statistics computation became confused when presented with a user account which had a database entry for the first month in the statistics computation interval (currently 30 days), but in which the first weight entry was after the start of the interval. The code which computes the user's trend slope would pass undefined trend items to the fitter, generating a snowdrift of (otherwise harmless) warning messages. I added a test for undefined trend values returned by the aggregator, which causes the coverage of such users' logs to be deemed incomplete and thus excluded from the summary trend analysis.

Bug: Trend propagation from an empty initial log

Propagation from an initial month in the database with no weight entries to subsequent months would reference an undefined trend value for the month. I added code to set the trend carry-forward to zero in this case, as a trend of zero is our indication that no trend carry-forward exists. Since the undefined trend value would be treated as zero, this caused no problems but produced a warning message in the error log.

Feature/admin: Report number of accounts using Web badges in global statistics

Added a line to the Open Accounts summary in the Global Statistics page which shows the number of accounts which have Web badge generation enabled.

Documentation: Global statistics section in style sheet

Corrected the description of the global statistics table section in the {\tt hdiet.css} style sheet and removed a reference to a nonexistent macro for synthetic data generation style definitions.

Bug: Cluster synchronisation loop attempting to delete file

The {\tt ClusterSync.pl} program could go into an infinite loop if given a transaction which requested the deletion of a file which was not present on the destination cluster host. This situation could occur due to race conditions in which a RememberMe file was created and replaced almost instantaneously. I added code which detects this case and considers the deletion transaction as having been completed successfully if the file is found not to exist on the destination host. The error handling has been restructured to allow other such special cases to be handled should they arise.

Bug: Trend propagation to monthly logs in the future

If a user makes log entries in a month in the future (for example, to add ``to do'' items in the comment field), the future month would be assigned a trend carry-forward at the time it was created, but the carry-forward would not be updated when weight entries were made in the current month because trend propagation was triggered only for entries in months prior to the ``current month'' in the user's time zone. This was an example of the sinfulness of premature optimisation---compared to the cost of updating the chart for an entry in a monthly log, checking the user directory for subsequent months, even if in the future, to which the trend should be propagated is negligible. I removed the unwarranted ``optimisation'' from ``Write updated log item back to database'', causing a check for trend propagation to be performed for all weight changes in monthly logs. (Reported by Anna E. Sage.)