Missing message content in tickets

Two weeks ago our company upgraded our RT server from version 2.x to
version 3.4.2. I used the rt-2.0-to-dumpfile and dumpfile-to-rt-3.0
scripts to transfer the database. The dumpfile-to-rt-3.0 script
required some major modifications (mostly due to bad email addresses in
the database), but we got most of that worked out and everything seemed
to be working.

Just yesterday one of our users reported that a bunch of the content in
some of the tickets he was working on has disappeared. I still have the
old RT2 system running on a different server, so I was able to confirm
that in some, but not all, of the comments and correspondence of a
single ticket, the content is missing in RT3 but it shows up in RT2.

I dug into the database and found that the content is actually stored in
there. It’s just not showing up on the web page.

In my initial investigation, the only distinguishing characteristic I
could find among the content that is invisible versus the ones which are
displayed is that the attachments whose content is missing all have had
"X-RT-Original-Encoding: iso-8859-1" added to the headers (which was not
present in the RT2 database) whereas the ones which were displayed had
an encoding of utf-8. After re-checking that theory just now, I see
that I was mistaken; there are comments with an iso-8859-1 encoding that
are properly displayed. Another idea was that the attachments with
missing comments have a Content-Type of multipart/mixed; however, there
too I see some multipart/mixed content which are properly displayed.

There is one more possibility which I just now noticed: the attachments
which don’t show up all have a non-zero value in the Parent field of the
Attachments table, while all the rest of the attachments have a value of
0 in this field. I tried clearing this field, and the content showed
up! Checking against the RT2 database, I discovered that the values in
the Parent field were exactly the same in RT3 as they were in RT2;
however, all of the attachment id’s have changed. Apparently, remapping
the Parent field was never handled in the dumpfile-to-rt-3.0 script.

Any suggestions on fixing the broken attachments, other than brute
force? There are over 24,500 attachments which need to be adjusted.

– Trevin Beattie