Delayed cleanup of deleted portal pages

When you delete a page the portal server also deletes all its derived pages and dependent resources. This information is stored in the database so deleting all the resource might take long time. As administrator you have two choices for when the actual deletion should happen

  • Immediately: That means as soon as you delete the portal page all its dependent resources get deleted immediately

  • Delayed deletion: If you choose this option then that means when you delete the page it does not actually get deleted instead portal will only mark the page and its dependent resources as deleted and make sure that users are not able to access these deleted pages but the actual deletion is done by the ResourceCleanup task which runs on every Saturday at 8 PM by default.

You can configure delayed cleanup of resources by setting value of scheduler.cleanup.enabled property to true in the DataStoreService. If you dont want delayed cleanup set it to false.

Now if you set the delayed cleanup then you might face one problem. Lets say you deleted a page then if you try to recreate that page immediately you might get DuplicateKey exception because that page is not actually deleted. In that case you can execute XMLAccess task using Task.xml file which is available in PortalServer/doc/xml-samples directory as input file.

xmlaccess.bat -in c:\WebSphere\PortalServer\doc\xml-samples\Task.xml -out c:\temp\taskresult.xml -url http://localhost:10040/wps/config -user wasadmin -password wasadmin

When you run the cleanup task, the XML configuration interface only schedules the task to be run in WebSphere Application Server and returns. This does not necessarily mean that IBM WebSphere Application Server runs the task immediately. To determine when a task started and ended, check the portal log SystemOut.log for the EJPDE0002I and EJPDE0003I messages.

[5/9/09 11:29:27:319 PDT] 00000027 SchedulerTask I handleEvent() EJPDE0005I: Task with ID 4957 was started.
[5/9/09 11:29:28:069 PDT] 00000027 SchedulerTask I handleEvent() EJPDE0007I: Task with ID 4957 has finished.
[5/9/09 11:29:28:100 PDT] 00000027 SchedulerTask I handleEvent() EJPDE0006I: RUN ONCE Task with ID 4957 has completed.

These messages confirm that the cleanup task has successfully completed. After you have confirmed this, you can run the XML script for re-creating a page with the same object ID as it had before the deletion.

If you want to change the schedule of when ResourceCleanup task runs then you can use XMLAccess and use the sample Task.xml file to figure out how to schedule a task.

No comments: