views:

207

answers:

9

Hi!

I just got a mail saying that I have to change a config value at 2009-09-01 (new taxes). Our normal approach for this would be to to awake at 2009-08-31 at 23:59 and then just change the value manually. Which not is a big problem since this don't happens to often. But it makes me wonder how other people handle issues like this.

So! How do you handle date specific config changes?

(We are working in asp.net but I don't think this has to be language specific)

Br
Carl Bergquist

+2  A: 

In linux, there is a command "at" for batch execution.
See "man at" for details.

Neeraj
The name for the scheduling command is the same on Windows. Though, having a scheduling service at your disposal is not the entire solution to the problem.
Martin Liversage
+18  A: 

I'd normally store this kind of data in a database table like this

Key,  Value,  EffectiveFrom,  EffectiveTo
-----------------------------------------
VAT,    15.0,      20081201,     20091231
VAT,    17.5,      20100101,         NULL

I'd then use the EffectiveFrom and EffectiveTo dates to chose the value that is effective at the given time. If the rate is open ended then the effecive to could either by NULL or 99991231.

This also allows you to go back without having to change the config. E.g. if someone asks you to recalculate the tax for the previous month before the rate change.

pjp
I have considered this solution. Be we don't use databases for all of our services and therefore rather not use databases as a generic solution.
Carl Bergquist
You could implement something similar using a file.
pjp
problem with this is, that you have to consume every value one by one. But you could use the same thing, but as value write an ini-filename/destination and then you have an ini file with your solution. Furthermore you could use an independant program to handle this.
StampedeXV
I'm with pjp here - a "database" doesn't have to be a huge server based entity, a plain file can be a database and (generalising like crazy) the "right" solution for this sort of problem where we're talking about data that will have clearly defined, known in advance, change dates is to store the data in such a way that you can load and select the appropriate values at run time - removing the the necessity to run updates and hence reducing the possibility of error (in the update not running or the changes being wrong).
Murph
+1  A: 

That depends totally on the situation and the technology.

pjp's idea is good, if you get your config from a database, or as metadata to define the valid time for whole config sets/files.

Another might be: just prepare a new configfile with the new entries and swap them at midnight (probably with a restart of the service/program) whatever. Swapping them would be possible with at (as given bei Neeraj) ...

If timing is a problem you should handle the change, or at least the timing of the change on the running server (to avoid time out of synch problems).

StampedeXV
+2  A: 

To be honest, waking up near the time and changing it seems to be the simplest and cheapest approach. All of the technical solutions are fine, but it depends where you work.

In our environment it would be cheaper and simpler to get someone to wake up and make the change than to redevelop the functionality of a piece of software that already works. It certainly involves less testing, development overhead and costs which means we would tend to solve the problem as you do, manually.

Tollo
Yes I agree, in most cases this is the best solution.
Carl Bergquist
The approach scales very poorly when your process is allowed to take any number of such requests... I would argue that it's best to also wake up the person who requested the change and get them to verify it as soon as it's in place. This additional step helps cut down on the number of these requests you'll get in the future.
ifatree
I think it depends where you work as to how it scales. Typically for us the technical solutions are expensive to implement, require a massive number of resources (running project managing release processes testing risk management etc. etc.) Bringing on line a large number of very cheap (offshore) resources to perform specific tasks is much simpler and cheaper for this type of work.
Tollo
A: 

I've seen the hybrid approach. Instead of actually changing the data model to include EffectiveDate/EndDate or manually changing the values yourself, schedule a script to change the values automatically. Also, be sure to have a solid test plan that will validate all changes.

However, this type of manual change can have a dramatic impact on reporting. If previous transactions join directly to the tables being changed, numbers in historical reports could change in a very bad way. There really is no "right" answer.

User1
+1  A: 

Hi,

We got same kind of problem some time before and handled using the following approach. this is suitable if you are well known to the source that orginates the configuration changes..

In our case, the source exposed a webservice (actualy a third party) which will return a modified config details. And there is a windows service running on our server which keeps on polling the webservice and will update the configuration file if there is any change.

this works perfectly in our case..

You can make use of this approach by changing the polling webservice part to your source of config change (say reading changes from some disk path). But am not sure how this is possible reading config changes from email.

Cheers

Rames Vel

Ramesh Vel
A: 

If I'm not able to do something like pjp's solution, I'd use either a scheduled task or a server job to update it automatically at the right time. But...I'd probably still be awake checking it had worked.

CodeByMoonlight
+1  A: 

Why not just make a shell script to swap out the files. run it in cron and switch the files out a minute before and send an alert text if NOT successful and an email if successful.

This is an example on a Linux box but I think you get the point and can do this on a Windows box.

Script:

cp /path/to/old/config /path/to/backup/dir/config.timestamp
cp /path/to/new/config

if(/path/to/new/config exsits) {
 sendSuccessEmail();
} else {
 sendPanicTextAlert();
}

cron:

59 23 31 8 *  /path/to/script.sh

you could test this as well before hand just point to some dummy directories and file

Phill Pafford
You could do the same thing in Windows with a basic Schedulled Task if you didn't want to actually code anything.
Gineer
You would still need to code the script change as well as the alert process. I agree that Scheduled Tasks and Cron Jobs are about the same thing though
Phill Pafford
A: 

Look the best solution would be to parameterise your config file and add things like when a certain entry should be used from. This would negate the need for any copying or swapping of files and your application would simply deal with it. (That goes for a config file approach or a database)

If you cannot change the current systems and you have to go with swapping the config files, then you also have two options:

  1. Use a scheduled task to kick off a batch job or even a VBScript or PowerShell script (which ever you feel comfortable with) Make sure you set up the correct credentials to be able to do this at the middle of the night and you could also add some checking and mitigation into this approach.
  2. Write a windows Service that does this for you. Here you have all the flexibility you need. Code it to do whatever it needs to do, do all the checks you need to (so that you can keep sleeping rather than making sure it actually worked) etc, etc. You service would then even take care of the scheduling aspect and all will be good. Here you could use xml DOM object and xPath and not replace the file, but simply update the specific entries as required.

Remember that any change to the config file would cause your site to restart, so make sure you take care of all the other housekeeping stuff that this could cause. (Although this would be exactly the same if you where sitting there in the middle of the night copying file around)

Gineer