on 2017 Apr 22 2:13 PM
Suppose the two partner computers have their system clocks set differently; what does CURRENT TIMESTAMP return after an HA failover?
When successive runs of dbbackup -r rename the current log on the primary server to yymmddxx.log, this file could be renamed on partner 1, then on partner 2, then on partner 1 and so on; what determines the date portion of the yymmddxx.log file name?
What determines the Windows file timestamp on the yymmddxx.log file?
Does the Windows file timestamp agree with the yymmdd portion of the file name? (think backups at midnight 🙂
Which one should be used to determine the file age when deleting old files? (file name or timestamp)
Note: The HA system makes sure both partner computers get copies of all the yymmddxx.log files, so that's not a problem.
[edit test]
Request clarification before answering.
You've asked lots of questions here - hopefully this answers all of them!
As stated in the docs: "The information CURRENT TIMESTAMP returns is equivalent to the information returned by the GETDATE and NOW functions." These should all be giving the date and time according to the system clock of the machine the server is running on. The time returned by CURRENT_TIMESTAMP is completely unaffected by an HA failover.
The date portion of yymmddxx.log file name is determined by the system clock on the primary at rename time. This same filename is communicated to the mirror/copynodes and used when they also rename the file, which means the "yymmdd" may not be accurate according to the system clock on those machines if they are in a different timezone.
The Windows file timestamp should be the system time of the creation of the file on the local machine - so, on a mirror/copynode, the timestamp will definitely not match the Windows file timestamp of the same file on the Primary (file creation on the mirror/copynode is after the file creation on the primary), and it might not match the yymmddxx.log file name if the servers are in different timezones.
If your ultimate goal here is to write an event to delete logs that are exactly 7 days old, I think the most accurate solution is to use the method Volker has suggested: store the renamed file name and date/time in the database and use this information in the event to delete logs. As discussed earlier, since filenames (yymmddxx.log) and Windows timestamps could be different depending on whether there has been a failover or not, relying on these is going to result in a certain amount of inaccuracy. (Which may be fine if you want to delete files approximately 7 days old, but not if you want exactly 7 days.)
Note that the deletion of files is propagated from the primary to any mirror/copynodes automatically, so the event doesn't need to run anywhere else. At least that's a bit of a help 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
9 | |
9 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.