Sunday, 2008-11-23

*** tpb has joined #tp00:00
*** ChanServ sets mode: +o tpb00:00
*** mithro has joined #tp00:38
*** mithro_ has joined #tp01:00
*** mithro has quit IRC01:01
mithro_bddebian: ping?01:36
*** JLP has quit IRC05:06
*** gau_veldt has quit IRC05:30
*** mithro_ is now known as mithro06:38
*** zzorn_ has quit IRC07:06
*** JLP has joined #tp07:30
JLPgood morning everyone07:30
mithrohey JLafont07:35
mithroopps07:35
mithrohey JLP07:35
mithrodo you run Suse?07:35
JLPmithro: nope, mandriva07:35
JLPand gentoo07:36
mithrowhats mandriva use to install stuff?07:36
mithrowith debian/ubuntu it's apt-get07:36
mithrowith suse it seems to be zypper07:36
JLPrpm and apt-get like extensions called urpmi07:36
mithroJLP: do you want to see if you could get the following working on mandriva - http://wiki.python-ogre.org/index.php/LinuxBuildV207:37
tpb<http://ln-s.net/2VC0> (at wiki.python-ogre.org)07:37
mithroif you can, then we can add it to the set of RPMs builds07:38
*** peres has joined #tp07:41
JLPmithro: will try, later when i book into mandriva07:43
JLPbtw how was the summit07:45
*** zzorn_ has joined #tp08:04
*** zzorn_ has quit IRC08:31
*** mithro has quit IRC09:30
*** mithro has joined #tp09:48
*** mib_4h10lxec has joined #tp10:51
*** gau_veldt has joined #tp10:52
*** mib_4h10lxec has quit IRC11:04
*** mithro has quit IRC11:11
*** mithro has joined #tp11:31
*** peres has left #tp11:42
*** nash has joined #tp17:18
*** nash has quit IRC17:21
*** nash has joined #tp17:22
gau_veldthello18:33
gau_veldtwhat does tpserver-py use for its database backend?  sqlite or mysql?  can it be changed easliy (say from sqlite to mysql)?18:34
gau_veldtI'd like to use mysql so other things could use the database than just the server18:35
*** Greywhind has quit IRC18:35
gau_veldtsay like something that figures out statistics within the universe to present web pages about the universe and stuff like that18:36
*** Greywhind has joined #tp18:36
gau_veldt(03:36:06 PM) gau_veldt: say like something that figures out statistics within the universe to present web pages about the universe and stuff like that18:36
*** mithro has quit IRC18:36
gau_veldtwell darn no one seems to be holding their connection right now :(18:37
tansellgau_veldt, the tpserver-py can use any DBA compliant database18:47
tansellit's been tested mainly with sqlite18:47
tansellbut should work with mysql (as long as you use InnoDB tables)18:48
gau_veldtDBA-compliant?18:48
gau_veldtand what does InnoDB have the others like MYISAM don't that tP requires?18:49
gau_veldtdoes DBA-compliant just mean it's ACID or is there deeper requirements?18:52
gau_veldtLike I said I'm thinking of having other processes use the DB so ACID would be good actually18:56
tansellMyIASM doesn't have transactions19:08
tansellwhich the tpserver-py depends on19:08
tansellDBA is a python access layer specification19:09
tanselltpserver-py makes very heavy use of transactions for things like turn processing19:09
tansellso if a processing fails halfway though you don't get a corrupt db19:10
gau_veldtyeah I understand transactions - it's an ACID thing19:10
tansellwell, it doesn't use a lot of ACID19:10
tanselljust transactions19:10
gau_veldtwell ACID is a compsci term meaning Atomicity, Consistency, Isolation, Durability19:11
gau_veldtI think it would need all of those actually19:12
gau_veldtsounds like everything the transaction concept is engineered to provide19:13
gau_veldtI just wonder how it works when you have to make decisions based on state within a transaction19:14
gau_veldtthe example is usually that you post a debit and credit atomically19:14
gau_veldtby using a transaction19:14
gau_veldtbut where do you fit in the "debit only possible if account>debit_amount" requirement?19:15
tanselllike I don't care about referential integrity much19:15
gau_veldtand that has all sorts of race situations so it really DOES have to be atomic19:16
gau_veldtlike you don't want something else debiting the remainder of the account between passing the >debit_amount check and the actual debit19:16
gau_veldtso I'm guessing the acount row would lock and any other transactions on that acocunt would have to wait in queue19:17
tanselltransactions are basically a "scratch disk"19:18
tansellIE you do all the changes, then you save it onto the main disk19:18
gau_veldtbut like above what happens when you use information based on state like I just showed?19:19
gau_veldtthe decision needs to be done in the same atomicity19:19
gau_veldtotherwise you could race the account and debit the last of the money immediately after the if >amount check passes?19:20
gau_veldtrace conditions of course being possible in any process that isn't completely atomic19:21
gau_veldtall the mysql stuff I've seen says to add the modifiers to the query to enforce the > rule but alas my example is too simple to break that but I can think of situations where the expression would be more easily parsed in the actual code doing the DB access than the query itself19:22
gau_veldtsimple example might be a DB representing a linked list type setup where there are no nice SQL modifiers to make decisions based on the child/parent fields19:23
gau_veldtmy worry (from the descirpitons at least in mysql transactions that I've read) is that when the app does its own checking mysql may not lock everything that needs to be locked between the decision making and the resultant updates19:25
gau_veldt"reads may not be consistent throughout the transaction" seems to be the default locking mode which scares the #$@%@# out of me19:25
tansellin theory with a transaction you don't need to lock19:42
tansellyou only need to lock on write19:42
tanselltransactions generally work in the form "collect a bunch of changes and apply at once - if any one fails, then they all fail"19:42
gau_veldtwell for a transaction to truly be atomic you need to have consistent reads throughout like if you pass the account>debit test then at the point of the deduction it should still be true even if many many miliseconds have passed since the if check19:43
gau_veldtif you don't lock the read you could have two dbits going on at once both believing they have enough money in the account left19:44
gau_veldtbut the sum of the debits is greater than the remaining account19:44
gau_veldt(each debit a separate transaction)19:45
tansellone of the transaction would fail as the underlying data changed19:45
gau_veldtokay here goes19:45
gau_veldtdebit 1: check account >b19:45
gau_veldtdebit 2: check account >c19:45
gau_veldt(both tests pass)19:45
gau_veldtdebit 1: subtract19:46
gau_veldtdebit 2: subtract19:46
gau_veldton commits account now negative19:46
tansellnope19:46
tansellone of the commits will fail19:46
tansellwith "data no longer consistent"19:46
tansellmeaning that one of the values you read/used changed before you did a commit19:46
gau_veldtso my bank would then give me some stupid "unkonw error $53137" please try again19:47
tansellit would probably just run the code again19:48
gau_veldtand I'd be switching banks becuase their site was such a pain to use19:48
tanselland then the check account >c would fail19:48
gau_veldtpreferably the read should lock19:49
gau_veldtso that the transactions have to queue19:49
gau_veldtthough I suppose anything more complicated than a single select might spell philosopher's dinner type trouble19:50
tansellthe read lock doesn't solve anything19:50
tansellexcept slows everything down in the uncommon case where the above happens19:50
gau_veldtso a commit will fail if a row you select on is dirtied by other concurrent transactions?19:51
gau_veldtso then both transactions might fail and try again and both fail then try again then fail then try again ...19:52
gau_veldtthen no philsopher will be able to eat first19:52
gau_veldtunless one of the philosphers is superman and can eat his entire meal before the pihlosophers net to him realize they need their fork19:53
gau_veldtand in the age of net lag even superman may not be able to achieve that19:54
tansellno19:54
tansellbecause a transaction can only dirty a read value if it is successfully committed19:54
gau_veldtso "first philsopher to the fork gets to eat" then?19:56
tansellyes19:57
gau_veldteveryone else having to leave then come back19:58
tansellwell no19:58
tansellhalf the philsophers will get to eat19:59
tansellthe other half will have to wait19:59
tansell(well roughly half)19:59
gau_veldtwell the there's no queue so they aren't waiitng19:59
gau_veldttom me failing on the commit due to dirtiness is being ejected fromt he meal and having to come back for the next meal session afte the dishes are washed19:59
gau_veldtaka unix EAGAIN20:00
gau_veldtor the "spin to you can" error20:00
gau_veldt*till you can20:00
tansellit's better then everyone waiting for the first philosopher to finish then the next one then the next one20:00
tansellas half get to go straight away20:01
tansellthe rest can go as soon as the first lot finish20:01
gau_veldtwell in the DB case they have to wait for the utnesils to be laundered first20:01
gau_veldtso a really unlucky philospher could well not get to eat if new philosphers make it to the dinner before him20:04
tanselland it turns out in 99% of the cases it's preferable to do this20:04
tansellas it scales20:04
tansellyou do get a percentage which never get to eat20:04
tansellbut that's better the no-one getting to eat20:04
gau_veldtso there'd be a palyer somehwere who never gets to play20:05
gau_veldtor a bank client who can never get any money from their account20:05
tansellgau_veldt, but the case is very rare (in computer systems it's like the same posibility of getting hit by falling space junk)20:06
tansellso the space junk will take care of them for you ;)20:06
gau_veldtI'm guesing most of the time there anre't very many trying to eat at the same meal20:07
tansellgau_veldt, you know how many transactions are going on in some bank accounts?20:08
tansellit's of the order of 10,000 per minute20:08
tanselleasily20:08
gau_veldtfor trading/investment accounts I'm guessing20:09
gau_veldtor really large businesses who settle their purhcases instantly rather than daily20:09
gau_veldtthat's still less than 1 per millisecond tho and a millisecond is a long time for a computer20:14
gau_veldtany one transaction typically probably being in the order of microseconds20:14
gau_veldtit'll be the communication medium that makes the chronology of the transactions unpredictable20:16
*** zzorn has quit IRC21:14
tansellbrb21:35
*** zzorn has joined #tp21:37
*** tansell has quit IRC21:38
*** bddebian has quit IRC23:08

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!