Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Thread latency?

Author  Topic 

10Pints
Starting Member

3 Posts

Posted - 2012-07-09 : 07:47:51
Hi
I have an occasional issue which is puzzling me:
We have an application that writes to file (camera recording data), stores the filepaths in a SQL table and changes the files and folders fairly frequently, when this happens it updates a SQL tables.

I am writing a separate service to monitor that the system does indeed write to file regularly. This queries the system for the cameras and their current file paths, then periodically checks the modified timestamp on the file. When this is older than now - a threshold we raise an alarm.

The issue: occasionally my code detects the file has not been written to - it then checks the database to see that the file has not been changed - (the monitored system will update the file tables) I get the old file paths back. So using the VC 2005 C++ debugger I break at this point in my code and go back and rerun the query ... then I get the new paths.???
So I tried on the first detection of no write - to set an entry in map to and recheck on the next polling cycle (8 seconds later in the test case) quite often this too fails.
But if then step through with the debugger - re run the query - and It returns the new file path! Aghhh!!!

Is there a way I can force SQL Server to flush any internal caches perhaps?
Any thoughts would be very much appreciated!

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-07-09 : 07:51:41
Doubt if it's sql server.
Try using the profiler to see if the query is being run on the database.
I suspect there is something which caches the data for a time and you need to change it to refresh on every query.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

10Pints
Starting Member

3 Posts

Posted - 2012-07-09 : 08:54:43
Yes reckon so.
I see you are a CAMRA man! Ideal!
I need to figure out where the details are being cached and a way to clean the cache.
We have no SLA on the server code doing its thing with in a defined time frame.

I will investigate further
Many thanks for tips

Have you tried Stanway's special ?

10Pints
Go to Top of Page

10Pints
Starting Member

3 Posts

Posted - 2012-07-11 : 03:00:12
Sorted: it was nothing to do with SQL Server - it was due to the fact that windows does not necesarily update the last modified timestamp regularly on a file.

Thanks Nigel for your help

10P
Go to Top of Page
   

- Advertisement -