Migmqlog is new in IBM MQ v9.0.4 and it migrates your queue manager’s recovery log. On Windows, it enables you to put your queue manager’s log on an Advanced Format (AF) disk. On Windows and Unix, it also enables you to change the log type of existing queue managers from linear to circular or from circular to linear. Please note you don’t need to run it just to migrate to v9.0.4. So if you have circular queue managers but would like to take advantage of the linear logging enhancements that we made in v9.0.2, you can now use migmqlog to do just that.

Advanced Format disks

The sector size of a disk is the minimum amount of data that is written to disk in each write. Disks can have a sector size of 512 bytes or 4096 bytes (4k). AF disks have a sector size of 4k and can be either 512e (emulation) or 4k native.

Before MQ v9.0.4 on Windows, MQ did not support putting a queue manager’s log on a disk with a sector size greater than 512 bytes. So AF disks were not supported. Queue managers would start on AF emulation disks but not on 4k native. But queue managers would not have data integrity on either AF emulation or 4k native disks. MQ has always supported putting queue files on an AF disk, as well as putting a log on an AF disk on Unix platforms. It’s just queue managers on Windows that were originally created before v9.0.4 that need migrating for their log to use an AF disk. Any queue manager created at v904 can use an AF disk without migration.

Now with v9.0.4, you can migrate your log onto an AF disk so that your queue manager will have data integrity using it. Here’s an example….

C:\>migmqlog -m qma -ld f:\logs
AMQ7701I: migmqlog command is starting.
AMQ7736I: MIGMQLOG read 50340212 bytes of log data and wrote 50364416 bytes of log data. 3 log extents were migrated and 0 log extents were deleted. Log alignment is 4096 bytes.
AMQ7702I: migmqlog command has finished successfully.

I created this queue manager on Windows on v8 and its logs were originally in C:\ProgramData\IBM\MQ\log\qma. This is fine because my C: drive is not on an AF disk. When I migrated to v9.0.4, I also happened to buy an AF disk and mapped it as my F: drive. Before I ran migmqlog, I stopped my queue manager and backed it up. I checked that f:\logs was plenty big enough to migrate the log into. The log may grow slightly during migration and migmqlog will need space to write a few extra temporary extents as well. Then I ran migmqlog to migrate the logs, putting the migrated logs in f:\logs. Migmqlog also updated qm.ini for me as well so that when I start my queue manager it will pick up the migrated log.

Instead of migrating to a new location using -ld, you can migrate “in place” by not specifying -ld. However it may be more convenient to use -ld to put the migrated log on the new AF disk. Also by using -ld, if you encounter problems, you still have a usable unmigrated log. If you decide to migrate in place and you encounter a power failure, just run the same migmqlog command again on the partially migrated log and it will complete the migration for you. Starting a queue manager with a partially migrated log won’t work.

Converting between linear and circular log types

When you create your queue manager you get to decide whether you want it to use linear or circular logging. Before v9.0.4 you couldn’t change that decision, unless you deleted and recreated it. But now with v9.0.4 you can use migmqlog to convert your linear queue manager to circular or convert your circular queue manager to linear. If you’re not sure what linear or circular means or what the advantages or disadvantages of them are, read https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.con.doc/q018440_.htm . You still can’t change the logfilepages (-lf) after you’ve created your queue manager. But of course, you can change the numbers of primaries (-lp) and secondaries (-ls) just by restarting your queue manager.

So here’s how I converted my circular queue manager to linear using v9.0.4 on AIX…

$ migmqlog -m qma -ll
AMQ7701I: migmqlog command is starting.
AMQ7735I: MIGMQLOG converted the log type for queue manager qma from CIRCULAR to LINEAR.
AMQ7736I: MIGMQLOG read 35188 bytes of log data and wrote 2172 bytes of log data. 0 log extents were migrated and 0 log extents were deleted. Log alignment is 4096 bytes.
AMQ7702I: migmqlog command has finished successfully.

Before I ran migmqlog, I stopped my queue manager and backed it up. I checked that /var/mqm/log/qma was plenty big enough to migrate the log into. The log may grow slightly during migration and migmqlog will need space to write a few extra temporary extents as well.

The -ll option means “convert to linear”, as opposed to -lc which means “convert to circular”. Here I’m migrating “in place” but I could have used the -ld option to specify a new location for the log. Specifying -ld is preferable because if you encounter problems, you still have the unmigrated log. If you decide to migrate in place and you encounter a power failure, just run the same migmqlog command again on the partially migrated log and it will complete the migration for you. Starting a queue manager with a partially migrated log won’t work.

If you have migrated from circular to linear, you need to think about recording media images and deleting (or reusing) log extents that are not needed for media or restart recovery. Migmqlog complements the linear logging enhancements we made in v9.0.2, so you can use it to take advantage of those enhancements even though you started with circular queue managers. For more information about the v9.0.2 linear logging enhancements, see my previous blog article https://www.ibm.com/developerworks/community/blogs/messaging/entry/Logger_enhancements_for_MQ_v9_0_2?lang=en .

If you have just migrated to linear, the easiest way to manage your log extents is to set LogManagement=Automatic in qm.ini. But alternatively you could use manual log management and delete superfluous log extents yourself. Although migmqlog updates LogType and LogPath in qm.ini, it will not update LogManagement for you.

With linear logging, you need to record media images regularly during the workload otherwise your log will grow indefinitely, and you will not be able to recover damaged objects until a first media image is recorded for each object. So as soon as you have migrated to linear, manually record a media image of all objects using rcdmqimg -m -t all '*'. The easiest way to regularly record media images thereafter is to use automatic recording of media images by setting ALTER QMGR IMGSCHED(AUTO) along with IMGLOGLN. Migmqlog will not update the IMG queue manager attributes for you, because you need to decide how you want them.

No matter whether you use migmqlog to convert between linear and circular, or whether you use it to migrate to an AF disk, migmqlog will always migrate the log so it could be used on an AF disk. Migmqlog usually takes a few seconds to run but it could take minutes or even hours on a large log on a slow system. So it prints out messages periodically to let you know its progress.

For more information about logging in IBM MQ, see https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.con.doc/q018410_.htm .

Leave a Reply