Saturday, November 17, 2012

0-byte and 1-byte files in workflow directory

As content is created and moves through workflow, editors can make notes in the "Action Taken" and "Action To Take" fields. These notes are stored in urlcolumns in Assignment, and so appear as files in workflow directory, which is the "defdir" for the Assignment table.

In some earlier versions of CS there is an issue whereby if an editor does not provide a comment with their action, a 0-byte or 1-byte file is still created anyway. If workflow is heavily used, then many of these files may be created, causing:
  • consumption of inodes on the shared disk
  • performance impact, as some workflow tags used by the UI will read these files whilst checking assignments
In one production system, in the space of one year since go-live 260'000 0-byte and 47'000 1-byte files were created, and editorial performance had noticeably dropped as a result.

This issue is resolved from CS 7.5.0 patch 5 onwards, 0-byte and 1-byte files are no longer created although though the fix will not remove any existing ones.

It is possible to remove these 0-byte and 1-byte files, but since references exist to them from the Assignment table, you must remove those references too. Here is a script that can clean them up. Take a full backup first, then change ‘workflowdir’ in the script to point to the correct workflow folder.  The script will output two things:
  • A SQL script "aupdate.sql" to run on the db, that will remove the references to the 0-byte and 1-byte files
  • Another shell script "adelete.sh" that will actually delete 0-byte and 1-byte files
After running aupdate.sql and adelete.sh, you will need to restart (or flush resultset cache on Assignment table).

#!/bin/sh

workflowdir=/home/csuser/Shared/workflow
rm -f /tmp/aupdate.sql
rm -f /tmp/adelete.sh

cd $workflowdir
find . -size 0c > /tmp/0bytelist
find . -size 1c > /tmp/1bytelist
for i in `cat /tmp/0bytelist /tmp/1bytelist`; do
  filename=`echo $i | cut -c3-`
  echo "update Assignment set urlassigncomment = '' where urlassigncomment = '$filename'  " >> /tmp/aupdate.sql
  echo "update Assignment set urlgroupcomment = '' where urlgroupcomment = '$filename'  " >> /tmp/aupdate.sql
  echo "update Assignment set urlclearcomment = '' where urlclearcomment = '$filename'  " >> /tmp/aupdate.sql
  echo "rm -f $workflowdir$filename" >> /tmp/adelete.sh
done

echo Found `wc -l /tmp/0bytelist` 0-byte files in workflow
echo Found `wc -l /tmp/1bytelist` 1-byte files in workflow
echo Run /tmp/aupdate.sql in sqlplus
echo Run /tmp/adelete.sh in the shell 


No comments:

Post a Comment