Forum Discussion

sanderfiers's avatar
9 years ago

Application restart needs database restart also

Hi Can I create an extra dependency between this two main Resources I have? I have a Service Group with two main Agent Resources, next to the usual Resources (storage, networking, ...) : ...
  • sanderfiers's avatar
    9 years ago

    Hi Gaurav,

    Thanks for taking the time to reply.

    Yes, my first reaction to my customers request "to always restart the database prior to restarting the application, when the application crashes",
    was to implement a CleanProgram for the application Resource, that would next to killing the actual application, would also (first nice,then forced) restart the database. The application Resource didn't have a CleanProgram before, so that was a good idea anyways.
    And that was indeed the reason for my other thread regarding the CleanProgram and especially regarding its order.
    My only fear was that HAD, via the monitoring of the database Agent, would get notified that the database Resource is offline.
    During testing I found out that is was so fast that HAD never notices the database being offline. But maybe, this is because it's part of a CleanProgram?
    I don't really know, would be nice to know though.
    However, only a database-restart inside this CleanProgram does not always fullfill the requirements... so I was stumbled upon the idea of - like you call it - splitting the action.

    I found out via my customer that when the application crashes, most of the time, the process itself is gone (so no PID to kill).
    Hence why restarting the database via the CleanProgram of my application Resource is not always a solution.
    But, since the application can never functionally work without a fresh database restart, the database-restart can safely stay inside the CleanProgram of the application Resource.

    EDIT:
    Actually the database-restart is not needed at all in the CleanProgram of the application Resource, right?

    Because the StartProgram is always executed after a CleanProgram, the database will always be restarted via the StartProgram.
    Even worse, the CleanProgram will do an unncessary database-restart.


    Just incase the application is crashed but still has a PID, the CleanProgram will succesfully restart the database and next the application.

    To handle the issue when the appliation has crashed and no PID is available, I would modify the StartProgram of the application Resource.
    The StartProgram of the application Resource will always restart the database prior to starting the actual application.
    The only thing to verify is the duration of this all (especially when keeping the monitoring of the database Resource in mind).
    A bad consequence is that the database will be restarted unncessary during a normal online of the complete Service Group when starting or during failover.