Re: Reversing transactions on a large scale

Lists: pgsql-general
From: snacktime <snacktime(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Reversing transactions on a large scale
Date: 2008-11-20 23:36:52
Message-ID: 1f060c4c0811201536p548a1cbcv932509fd52fc5a4d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Right now we are running mysql as that is what was there when I
entered the scene. We might switch to postgres, but I'm not sure if
postgres makes this any easier.

We run a couple of popular games on social networking sites. These
games have a simple economy,and we need to be able to time warp the
economy back in time, which means reverting a whole lot of
transactions and inventories. Our games generate around 1 million
user transactions per hour, which results in inserts/updates on 4
times that many rows. Using PIT recovery would be a very reliable
way to accomplish this, but I'm wondering how long it would take. If
it takes a full day to roll back an hour of game time, then I need to
find another solution.

Chris


From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: snacktime <snacktime(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Reversing transactions on a large scale
Date: 2008-11-21 00:06:05
Message-ID: dcc563d10811201606m38d4ce25x57d97a4680849f01@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Thu, Nov 20, 2008 at 4:36 PM, snacktime <snacktime(at)gmail(dot)com> wrote:
> Right now we are running mysql as that is what was there when I
> entered the scene. We might switch to postgres, but I'm not sure if
> postgres makes this any easier.
>
> We run a couple of popular games on social networking sites. These
> games have a simple economy,and we need to be able to time warp the
> economy back in time, which means reverting a whole lot of
> transactions and inventories. Our games generate around 1 million
> user transactions per hour, which results in inserts/updates on 4
> times that many rows. Using PIT recovery would be a very reliable
> way to accomplish this, but I'm wondering how long it would take. If
> it takes a full day to roll back an hour of game time, then I need to
> find another solution.

PITR is pretty fast, since it sequentially applies changes to the
database as fast as it can. Your hardware has a lot to do with this
though. Applying changes to a machine with plenty of memory, fast
CPUs, and a big rockin RAID-10 array will of course be much faster
than doing the same thing on a laptop.

If you make "base" sets every night at midnight with snapshots, then
it shouldn't take too long. Is this gonna be a regular thing, or is
this more of an occasional occurance when things in the game go
horribly wrong?


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: snacktime <snacktime(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Reversing transactions on a large scale
Date: 2008-11-21 00:48:22
Message-ID: 22981.1227228502@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

> On Thu, Nov 20, 2008 at 4:36 PM, snacktime <snacktime(at)gmail(dot)com> wrote:
>> Right now we are running mysql as that is what was there when I
>> entered the scene. We might switch to postgres, but I'm not sure if
>> postgres makes this any easier.
>>
>> We run a couple of popular games on social networking sites. These
>> games have a simple economy,and we need to be able to time warp the
>> economy back in time, which means reverting a whole lot of
>> transactions and inventories. Our games generate around 1 million
>> user transactions per hour, which results in inserts/updates on 4
>> times that many rows.

Just out of curiosity, I'm wondering how you make that happen now with
mysql.

regards, tom lane


From: snacktime <snacktime(at)gmail(dot)com>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Reversing transactions on a large scale
Date: 2008-11-21 21:38:51
Message-ID: 1f060c4c0811211338wacead1eof703e85e3265a78b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Thu, Nov 20, 2008 at 4:06 PM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:
> On Thu, Nov 20, 2008 at 4:36 PM, snacktime <snacktime(at)gmail(dot)com> wrote:
>> Right now we are running mysql as that is what was there when I
>> entered the scene. We might switch to postgres, but I'm not sure if
>> postgres makes this any easier.
>>
>> We run a couple of popular games on social networking sites. These
>> games have a simple economy,and we need to be able to time warp the
>> economy back in time, which means reverting a whole lot of
>> transactions and inventories. Our games generate around 1 million
>> user transactions per hour, which results in inserts/updates on 4
>> times that many rows. Using PIT recovery would be a very reliable
>> way to accomplish this, but I'm wondering how long it would take. If
>> it takes a full day to roll back an hour of game time, then I need to
>> find another solution.
>
> PITR is pretty fast, since it sequentially applies changes to the
> database as fast as it can. Your hardware has a lot to do with this
> though. Applying changes to a machine with plenty of memory, fast
> CPUs, and a big rockin RAID-10 array will of course be much faster
> than doing the same thing on a laptop.
>
> If you make "base" sets every night at midnight with snapshots, then
> it shouldn't take too long. Is this gonna be a regular thing, or is
> this more of an occasional occurance when things in the game go
> horribly wrong?
>

It's primarily for when a bug screws up the economy, or if someone
finds a way to hack the economy. Unfortunately these things happen
now and then. Plus, these games are relatively short lived. We might
get a million users the first month, but a year later the game is
dead. So a generic solution using something like PITR would be good.
It's not worth it to do it in code with the game having such a short
lifespan.

Chris