Log in or sign up to continue

How to clean these globals

Hi Bob.

These will be picked up by either Purge running the all command, or by selecting "Messages" for TypesToPurge in either one.

The MessageBodyS should be purged when the "BodiesToo" tick box is selected in the task. The description for the BodiesToo  option is: "Delete message bodies whenever their message header is deleted. This is off by default because some Productions may use message objects that are part of a larger environment and not transitory." so it may be that your task was left with the defaults and this has built up.

Thank you Julian.

Purge task was done. But the size of the overall continues. Checked the 'Ens.MessageHeader' table and there are records for 2016.

Hi Bob. Do you have KeepIntegrity selected?

I ask because the only thing I can see which might point in the right direction is that the selection of message headers when KeepIntegrity is selected does a "select top 100000000" and your Ens.MessageBodyS is a digit greater (10 digits vs 9), so it could be that the items are somehow being missed? If this is the case, running the purge without the Keep integrity selected might work?

Also, I assume you are getting a success status from the task running?

Hi Julian.

KeepIntegrity has been selected.

I suspect that other developers ran months ago without KeepIntegrity.

Apparently these old records are not being captured by the cleanup task.

How can I clean these old records.

Hi Bob. Please can you try running the task without KeepIntegrity selected?

If this doesn't resolve your problem, I'm all out of ideas.

Not work.

Thank you Julian.

The status of old messages has been changed to 'Suspended'

It was possible to erase them through the portal.

This Ens.MessageBodyS has not been cleaned. How to solve?

Hi Bob.

I ran a comparison against the two Tasks to find the answer.

Basically they're almost identical, except that Ens.Util.Tasks.PurgeMessageBank includes the ability to purge "Message Bank Events" and "Message Bank Messages" using the "ALL" Parameter in TypesToPurge or by individually selecting them. So using Ens.Util.Tasks.Purge with all selected will not touch the Message Bank.

My guess would be that Intersystems either added Ens.Util.Tasks.PurgeMessageBank when the Message Bank functionality became available and didn't want to edit the Ens.Util.Tasks.Purge task so that ALL started to include purging the message bank, or Ens.Util.Tasks.Purge exists to be able to have a task which can purge all except the message bank so that customers that would like to purge all except the message bank can do so with one task rather than 7 separate tasks.

If you're unable to purge Message Headers that are beyond the retention period with KeepIntegrity turned off, you may need to clean up your indices.  In a Cache terminal, execute the method below in the namespace where your Ensemble production is defined:

> Do ##class(Ens.MessageHeader).%ValidateIndices("",1)

Depending on the number of message headers, this may take a while to run ... on one system I've worked with it took more than a month.

You may want to also check for orphaned message bodies. You can determine if you have any by issuing the following SQL query from the SQL shell:

> Do $system.SQL.Shell()

>> SELECT COUNT(*) FROM EnsLib_HL7.Message HL7 LEFT JOIN Ens.MessageHeader hdr ON HL7.Id=hdr.MessageBodyId WHERE hdr.MessageBodyId IS NULL

Cleaning up the orphaned message bodies is yet another task, but let's see if you have any first ...