IsNemoEqualTrue/monitor-table-change-with-sqltabledependency

Be able to clean up the server at will (DropDatabaseObjects)

Closed this issue · 3 comments

I am trying to migrate from an old version (4.6.0), and there was a functionality there that is missing now.

I want to clean up the server even if there was an exception creating the objects.
In the old version, DropDatabaseObjects could work unconditionnaly, dropping the objects that were created in this session or a previous one. Now, it needs _processableMessages to be complete, which is not the case if creation was unsuccessful.

Scenario to reproduce it, from whatever app using SqlTableDependency and deriving GetBaseObjectsNamingConvention to fix the objects suffix:

  • I create all objects, ok
  • I quit the application via the debugger (Shift-F5), the natural cleanup called by Stop via DropDatabaseObjects is not done
  • Next time, when trying to create objects, they already exist, which triggers an exception in CreateDatabaseObjects before returning _processableMessages. Then the call to DropDatabaseObjects is done but exits doing nothing.
  • Next time... go back to previous step.

If GetBaseObjectsNamingConvention is not overridden, then I suppose that it will work, but the server will keep unused garbage objects (untested).

Hi, the functionality to keep SqlTableDependency's database objects is not anymore present.
It is planned in release 9.x

Thanks for the quick answer.

I don't want to keep the objects, but to make sure all are really destroyed!

You mean then that in the scenario above, I have no choice but destroying all remaining objects manually on the server?

Looking forward to release 9!

"I have no choice but destroying all remaining objects manually on the server?" YES, you have.
I did from time to time when i interrupt my tests, but i did using SQL Server management studio, i start removing from the contract, then the messages, queue, service broker and the trigger and stored procedure.