IRC log for #storm on 20090409

01:01.40*** join/#storm gord (n=gord@5ac32860.bb.sky.com)
02:39.26*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
03:37.48*** join/#storm shaunm (n=shaunm@c-98-212-133-244.hsd1.il.comcast.net)
03:50.49*** join/#storm infobot (i=ibot@rikers.org)
03:50.49*** topic/#storm is The Storm Python ORM - http://storm.canonical.com/ - 0.14 released! || Review branches: https://code.launchpad.net/storm/+activereviews || IRC logs: http://ibot.rikers.org/#storm/
05:34.51*** join/#storm sidnei_ (n=sidnei@201-35-176-220.cslce701.dsl.brasiltelecom.net.br)
06:01.32*** join/#storm jkakar (n=jkakar@S0106001ee57a879c.vc.shawcable.net)
06:08.48*** join/#storm jukart (i=lovely@81.189.156.94)
12:11.58*** join/#storm thumper (n=quassel@canonical/launchpad/thumper) [NETSPLIT VICTIM]
12:40.37*** join/#storm gord (n=gord@5ac32860.bb.sky.com)
13:53.50*** join/#storm sidnei__ (n=sidnei@201-35-176-220.cslce701.dsl.brasiltelecom.net.br)
14:03.39*** join/#storm oubiwann (n=oubiwann@97-119-11-160.omah.qwest.net)
14:34.14*** join/#storm andrea-bs (n=andrea-b@ubuntu/member/beeseek.developer.andrea-bs)
15:07.20*** join/#storm vvinet (n=vince@132.210.76.201)
15:18.00*** part/#storm sidnei (n=sidnei@201-35-176-220.cslce701.dsl.brasiltelecom.net.br)
16:10.13*** join/#storm shaunm (n=shaunm@proxyserver.wolfram.com)
16:28.12*** join/#storm jukart (n=jukart@d91-128-122-97.cust.tele2.at)
16:44.37*** join/#storm bigdog (n=scmikes@72-197-8-8-arpa.cust.cinci.current.net)
18:09.03*** join/#storm gord (n=gord@5ac32860.bb.sky.com)
18:43.39*** join/#storm bigdog (n=scmikes@72-197-8-8-arpa.cust.cinci.current.net)
19:12.45*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
19:14.13*** part/#storm sidnei (n=sidnei@plone/dreamcatcher)
19:37.39*** join/#storm intellectronica (n=tom@intellectronica.net)
19:37.59intellectronicahi
19:38.24intellectronicais there a way to do a multiple row insert with a storm expression?
20:52.20jkakarintellectronica: Nope.
20:53.04intellectronicajkakar: thanks for confirming that :)
20:53.10jkakarintellectronica: np. :)
20:53.33intellectronicanow let's go and concatenate some SQL commands
20:58.00*** part/#storm intellectronica (n=tom@intellectronica.net)
20:59.04*** join/#storm vvinet (n=vince@ip200-215.natdynamique.USherbrooke.ca)
21:00.53*** join/#storm bigdog (n=scmikes@72-197-8-8-arpa.cust.cinci.current.net)
21:17.53*** join/#storm jkakar (n=jkakar@S0106001ee57a879c.vc.shawcable.net)
21:56.49*** join/#storm jkakar (n=jkakar@S0106001ee57a879c.vc.shawcable.net)
22:24.31*** join/#storm MFen (n=cdodt@demo.goonmill.org)
22:24.47MFenis there a way to tell storm to separate transactions?
22:25.01jkakarMFen: Call store.commit()...?
22:25.09MFenwe're having major problems with autosequenced primary keys stepping on each other
22:25.29jkakarAre you using MySQL with a non-MyISAM table backend?
22:25.34MFenpostgres
22:25.39jkakarOh, okay, good.
22:25.52jkakarAre you running very long-lived transactions?
22:26.24MFenno
22:26.37MFenasynchronous web application
22:26.43MFenvery short transactions
22:27.17*** join/#storm boneskull (n=chiller@c-98-246-131-168.hsd1.or.comcast.net)
22:28.38radixMFen: hm
22:28.42MFenboneskull can tel you more :)
22:28.51radixMFen: see what happens if you put a rollback() at the *beginning* of request processing?
22:30.17radix(which is a good idea anyway, because that's where storm does reconnection if the connection was lost)
22:30.17MFenhow many transactions do you get in a single store? is it at all tied to function scope? is everything that happens through storm in the same transaction (until you commit()) ?
22:30.27radixMFen: no, one store can only have one transaction at a time
22:30.37MFenok
22:30.44radixyou should have as many stores as you have concurrent transactions
22:30.50MFenahh.
22:30.55MFenso one per request, basically
22:31.20radixwell, that would be semnaatically correct
22:31.24radixsemantically
22:31.49radixbut often you'll want to cache stores between requests so you don't have to reconnect to the database, for example
22:32.11MFenwell, what about the database object that you initialize the store with. can we keep that around?
22:32.32jkakarYes, and it can be shared with stores in different threads.
22:32.45MFenok, so that saves us connection costs right?
22:32.57jkakarThe Store's themselves aren't thread-safe, so only use a Store in one thread.
22:33.06MFenno threads, yay
22:33.15jkakarNot really, reusing Store's saves you reconnection cost.
22:33.20MFenhmm
22:33.23MFenStorepool? :-)
22:33.37jkakarThat's basically what IZStorm and the Django integration do, yeah.
22:33.55MFenboneskull: what does db_upsert do about transactions?
22:34.03boneskulllet me see
22:34.42jkakarAre you using Twisted for your asynchronous application (out of curiousity)?
22:35.07MFenno. homegrown socket server here
22:35.08radixoh, are you using the twisted-storm integration?
22:35.10jkakarI guess you're blocking in the main loop to talk to the database (since you say 'no threads, yay')?
22:35.17jkakarMFen: Ah, okay.
22:35.17radixoh
22:35.19MFenin our defense, it predates really viable twisted
22:35.54MFenyes, blocking in the main thread
22:35.59boneskullour db_* code does not use transactions; it autocommits
22:36.16boneskullcan we just make storm autocommit?
22:36.18MFeni really don't see how what we're seeing can be happening if we're really committing everywhere we should be
22:36.19jkakarAh, I see.
22:37.19jkakarMFen: Right, since you only have one connection to the database presumably and you're serializing all access through that one connection, right?
22:37.21boneskullI'm commit()-ting all over the place
22:38.12MFencommit() more!
22:38.15MFen:P
22:38.30MFenare you sure there's no yield somewhere there shouldn't be perhaps
22:38.40boneskullthere is a yield
22:38.42MFenor a try without a finally
22:38.45jkakarWell, isn't "commit" basically a no-op when your isolation level is autocommit?
22:39.23jkakarYou might want to try calling Store.flush() at the end of your logical transaction, to make sure Storm's caching isn't delaying database writes.
22:39.46MFenyeah. i was thinking about flush() yesterday boneskull
22:39.47boneskullstorm is not autocommitting...
22:39.54radixindeed, storm doesn't autocommit
22:40.04boneskullso store.commit() then store.flush() ?
22:40.12radixno, there's no reason to call flush() next to a commit() call
22:40.21MFenflush() makes the sql calls
22:40.22boneskullMFen, is the scope of the store OK? I don't understand that
22:40.34MFencommit makes the sql calls and closes the transaction
22:40.56MFen(right radix?)
22:41.29radixyes
22:41.49radixalso, many things invoke flush(): pretty much every time storm does an implicit read operation on the database, it first invokes flush
22:42.02mzzits implementation is not as scary as you might think: it's just self.flush(); self.invalidate(); self._connection.commit() (which does an actual sql commit)
22:44.51MFenhmm
22:44.55MFenwe're using multiple processes
22:46.00MFenif i create an object with an autoseq pk
22:46.06MFenand then another process does that at the same time
22:46.18MFenthe database doesn't enforce pk integrity until one of them calls flush
22:46.23MFenthe second one then loses
22:46.35MFeni think that's what we're doing wrong.. need to flush immediately when we create one
22:46.37boneskullthat's an autoseq pk?
22:46.49MFenautoincrementing primary key
22:46.53boneskullin what table?
22:47.25MFendon't all of them have a sequence?
22:47.53boneskullwe are explicitly inserting 'project' into action_stack
22:48.41MFenwhat's the constraint that's being violated again?
22:48.59MFeni guess only action has a serial id
22:49.11boneskullduplicate 'project'
22:49.12MFenbut the project numbers are also dynamically assigned, but from application code
22:49.16boneskullyes
22:49.18MFenwhich is probably worse
22:49.24boneskullyes that is wack
22:49.31jkakar(Maybe this is not a helpful question, but, have you thought about using transactions to avoid all this kind of nastiness?)
22:49.34boneskull...but it worked before
22:49.34radixyou're talking about SERIAL, right?
22:49.45MFenjkakar: aren't we *always* using transactions?
22:50.03MFenradix: actually i thought we were, but in fact we're generating a primary key string in application code
22:50.08radixoh, dude
22:50.10jkakarMFen: Not if you've set your isolation mode to autocommit, no.
22:50.16radixah, yes
22:50.22MFenjkakar: we haven't done anything like that
22:50.25MFenthat i know of
22:50.32boneskullonly our homebrew code autocommits
22:50.35radixI find boneskull's explanation of that situation apropos ;-)
22:50.38radix"wack" indeed ;-)
22:51.02boneskullthis is embarrassing
22:51.13MFenlearning experience!
22:51.19radixhehe, I know what it's like to work with nasty legacy code :)
22:51.19boneskullwe are actually looking at a directory structure to determine the key
22:51.21jkakarOkay, I guess I misunderstood this then: <boneskull> our db_* code does not use transactions; it autocommits
22:51.49jkakarAh, I see.  Yeah, legacy code can be hard. :)
22:51.56MFenjkakar: db_foo is our non-Storm db layer
22:52.02MFenwhich we're working on replacing
22:52.07jkakarMFen: Right, catching onto that now.
22:52.12boneskullif directory foo3 does not exist, and doesn't exist in the db, use foo3
22:52.45MFenyeah, extract bonus wackness there
22:52.52jkakarHeh
22:53.04MFenin order for this to work, we have to flush *and* create that directory before the other process makes its move
22:53.23MFenthe directory creating thing is one thing we should burn.
22:53.45boneskullwe check for the path; if it does not exist we store.flush(), then we store.find()
22:54.01MFenis there any way to create a lock through storm? just a teeny one?
22:54.06boneskullheh
22:56.09boneskullwe could touch a lockfile or something :P
22:56.45MFengah.
22:57.35jkakarMFen, boneskull: Maybe's PostgreSQL's table locking can help you: http://www.postgresql.org/docs/8.3/static/sql-lock.html
23:00.08MFenit would if we weren't creating that directory first
23:00.37MFenwe have to check for a free directory, then announce our intention to use it to the database
23:01.32MFenwhich is just friggin stupid. chris, we should be using a pseudorandom directory instead.
23:02.02boneskullheh
23:02.16boneskullI don't see why not
23:02.22boneskullthese directory names don't really matter, do they
23:02.48boneskullstill the fact remains, when autocommit was on we didn't have this problem...
23:03.01MFennot much. it would be nice if it still had the year in there, but just YYMM+4 alphanumerics should be plenty of random
23:03.29MFenyeah, but that's not how storm works
23:03.53MFenin theory we should be reaping performance benefits from this design
23:04.31boneskullif we include transactional logic, we need error handling to support it
23:05.03radixwell, transactions *are* slower than just writing random corrupted data to disk ;-)
23:05.26MFenwe just need to be more precise about when we use locks
23:05.33MFenthis is one of those places
23:05.46MFenpseudorandom directory plus table lock equals success
23:58.01*** join/#storm jkakar (n=jkakar@S0106001ee57a879c.vc.shawcable.net)

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.