From yarek.kowalik at gmail.com Fri Dec 5 20:22:41 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Fri, 5 Dec 2008 12:22:41 -0800 Subject: [elephant-devel] SBCL compilation warnings Message-ID: I get several warnings in SBCL 1.0.20 that are related to use of dynamic-extent. For example, here it complains about 'COLLECT' is an indefined variable: (defun get-query-instances (constraints) "Get a list of instances according to the query constraints" (declare (dynamic-extent constraints)) (let ((list nil)) (flet ((collect (inst) (push inst list))) (declare (dynamic-extent collect)) (map-class-query #'collect constraints)))) There are 5 warnings for patterns just like the one above. Should (dynamic-extent collect) be in fact (dynamic-extent #'collect) ? Yarek -------------- next part -------------- An HTML attachment was scrubbed... URL: From rsynnott at gmail.com Wed Dec 10 20:38:32 2008 From: rsynnott at gmail.com (Robert Synnott) Date: Wed, 10 Dec 2008 20:38:32 +0000 Subject: [elephant-devel] Postmodern backend; are values ever removed from the blob table Message-ID: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com> Hi, >From my experimenting, it seems that values are never removed from the blob table. So, for instance, if I have an object, and I delete it with drop-instances/drop-pobject, the blob rows representing the slot values never go away. Am I right about this? Is there anything I can do about it short of db migration? Thanks Rob From eslick at media.mit.edu Wed Dec 10 22:15:38 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Wed, 10 Dec 2008 17:15:38 -0500 Subject: [elephant-devel] Postmodern backend; are values ever removed from the blob table In-Reply-To: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com> References: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com> Message-ID: Have you updated from elephant-unstable recently? I found a bug where indices were not properly updated that I think was in the core elephant code. However there may be a bug specific to postmodern. Ian On Dec 10, 2008, at 3:38 PM, Robert Synnott wrote: > Hi, > From my experimenting, it seems that values are never removed from the > blob table. So, for instance, if I have an object, and I delete it > with drop-instances/drop-pobject, the blob rows representing the slot > values never go away. Am I right about this? Is there anything I can > do about it short of db migration? > Thanks > Rob > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From rsynnott at gmail.com Thu Dec 11 04:12:13 2008 From: rsynnott at gmail.com (Robert Synnott) Date: Thu, 11 Dec 2008 04:12:13 +0000 Subject: [elephant-devel] Postmodern backend; are values ever removed from the blob table In-Reply-To: References: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com> Message-ID: <24f203480812102012h5e233c06qc6cb427cca5be89f@mail.gmail.com> 2008/12/10 Ian Eslick : > Have you updated from elephant-unstable recently? I found a bug where > indices were not properly updated that I think was in the core > elephant code. However there may be a bug specific to postmodern. > > Ian > Nope, this isn't the problem, or at least I haven't seen this happening. My problem is that blobs never seem to get deleted. The postmodern backend appears to store all slot values (and btree values, etc) in a great big table called blob. So, if I do something like, say, (defpclass myclass () ((slot1 :accessor slot1 :initarg :slot1))) (defvar *lots-of-objects* (with-transaction () (loop for i from 1 to 10000 collect (make-instance 'myclass :slot1 i)))) (loop for i in *lots-of-objects* do (drop-pobject i)) then the slot definitions in the slot table are removed, but the actual slot _values_, which live in the blob table, are retained. Is this intended behaviour? It has become a problem for me, as I'm left with a huge blob table full mostly of things which have been deleted or replaced; (setf (slot1 myobject) 4) has the same effect where slot1 in myobject already has a value. I realise I could migrate to free up space, but I'd really like to avoid the downtime if at all possible. One thing that did occur to me was that I could record the current maximum bid in the blob table, then go through each tree table, including root, and also the slots table, recording blob id references in each one. Then take the entire set of bids from the blob table; anything present in the blob table but not referred to in any of the trees or slots table, and with bid less than or equal to the maximum bid when the procedure was started, should be obsolete, and deleting it should be safe. Does this sound reasonable, or am I missing something? I already tried it on a non-production database, and it seemed to work; I couldn't find any problems afterwards, but I'd like to be sure I'm not doing anything silly. Thanks Rob From reddaly at gmail.com Thu Dec 11 06:35:38 2008 From: reddaly at gmail.com (Red Daly) Date: Wed, 10 Dec 2008 22:35:38 -0800 Subject: [elephant-devel] BDB hanging with many stalled threads In-Reply-To: References: <63086.88.73.215.209.1224143021.squirrel@mail.stardawn.org> <61901.88.73.196.243.1224318455.squirrel@mail.stardawn.org> Message-ID: As it turns out, this solution has also turned out to be inadequate. For the past few months I have been experiencing the same sort of issues I originally described. Every few days I find SBCL taking up 100% of the CPU and a hundred Hunchentoot threads stalled in the web server. When a thread is killed in lisp, the database demands recovery. the BDB error file does not display anything unusual, and I have a db_deadlock and db_checkpoint command executing every minute to resolve deadlocks and checkpoint the database. Once again this is with the release version of elephant and BDB 4.5. I suppose the most helpful thing would be a program that replicates this behavior, which I will try to get to at some point. Best, Red Daly On Thu, Oct 23, 2008 at 1:10 AM, Red Daly wrote: > This appears to have resolved the problem. The server has been running for > the past several days with no database crashes. The only unusual behavior > is an occasional condition being raised that looks like this: > > > Thanks for the fix. This remaining issue does not seem to happen too much > so I can live with it. It simply belongs in the documentary record. > > Red > > > On Sat, Oct 18, 2008 at 1:27 AM, Leslie P. Polzer > wrote: > >> >> > Unfortunately the standalone deadlock utility provided by BDB does not >> seem >> > to resolve this. I just tried running it with all these hung threads >> and >> > somehow the result was a database that needs recovery. db_stat also >> > indicates the number of deadlocks is 0. >> > >> > This seems to indicate that the problem is not caused by deadlocks. >> What do >> > you think? >> >> Let's make sure. After opening the store controller run >> >> (db-bdb::db-env-set-lock-detect >> (elephant::controller-environment *store-controller*) >> db-bdb::DB_LOCK_DEFAULT) >> >> and check whether this still occurs. >> >> Leslie >> >> >> _______________________________________________ >> elephant-devel site list >> elephant-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/elephant-devel >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From killerstorm at newmail.ru Thu Dec 11 10:06:35 2008 From: killerstorm at newmail.ru (Alex Mizrahi) Date: Thu, 11 Dec 2008 12:06:35 +0200 Subject: [elephant-devel] Postmodern backend; are values ever removed from the blob table References: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com> <24f203480812102012h5e233c06qc6cb427cca5be89f@mail.gmail.com> Message-ID: RS> then the slot definitions in the slot table are removed, but the RS> actual slot _values_, which live in the blob table, are retained. Is RS> this intended behaviour? yep, it is. it sort of sucks, i know. whether or not it becomes a problem depends on what kind of data you store in slots. blobs get reused (at least they should..), so, for example, all slots with value 4 will refer to same blob id, and you can consider bloated blob table as a cache of some kind in this case :). if you have constant inflow of unique data that becomes a problem, indeed. RS> avoid the downtime if at all possible. One thing that did occur to me RS> was that I could record the current maximum bid in the blob table, RS> then go through each tree table, including root, and also the slots RS> table, recording blob id references in each one. Then take the entire RS> set of bids from the blob table; anything present in the blob table RS> but not referred to in any of the trees or slots table, and with bid RS> less than or equal to the maximum bid when the procedure was started, RS> should be obsolete, and deleting it should be safe. Does this sound RS> reasonable, or am I missing something? yep, right in general, some details seem to be wrong. first, you do not need to go through _all_ tables, but only columns that store blob ids. there is some metainformation attached to btrees, key-type and value-type. if key-type is :object, blob ids are in qi column, if value-type is :object, value column contains blob ids. then there are performance considerations -- if you have lots of data, allocating temporary storage for all blob ids might be painful. if you run cleanup procedure more-or-less frequently, there will be more alive bids than dead ones, so you can optimize it ruling out alive bids early. for example, if you work mostly with objects, you can first find the difference between blob and slots tables (because most alive bids would be in slots): SELECT blob.bid FROM blob LEFT JOIN slots ON blob.bid = slots.value WHERE slots.value IS NULL (warning: totally untested). this would return all dead bids and bids that are referenced from other tables.then you can go through rest of tables, pulling blob ids from them and eliminating ones you see in that data set, in the end you end up with only dead ones. then, you do not actually need recordning maximum bid if you're working within a single transaction -- postgresql's transactional engine will do this for you. (it works in similar way, btw -- ignores rows that have txn id larger than current txn id). From henrik at evahjelte.com Thu Dec 11 10:45:27 2008 From: henrik at evahjelte.com (Henrik Hjelte) Date: Thu, 11 Dec 2008 11:45:27 +0100 Subject: [elephant-devel] Postmodern backend; are values ever removed from the blob table In-Reply-To: References: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com> <24f203480812102012h5e233c06qc6cb427cca5be89f@mail.gmail.com> Message-ID: <50e8e4f60812110245l5386d27hf1a00e441f3024d5@mail.gmail.com> I agree with Alex, just one perhaps obvious comment: I would have one transaction around cleaning up one blob-id, not a big transaction around cleaning up the whole blob table. If you do several transactions it doesn't lock up much, so it should be able to execute at the same time as a database is in production. I hope your code can be added to the postmodern backend. Thanks, Henrik From killerstorm at newmail.ru Thu Dec 11 12:56:43 2008 From: killerstorm at newmail.ru (Alex Mizrahi) Date: Thu, 11 Dec 2008 14:56:43 +0200 Subject: [elephant-devel] Postmodern backend; are values ever removed from the blob table References: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com><24f203480812102012h5e233c06qc6cb427cca5be89f@mail.gmail.com> <50e8e4f60812110245l5386d27hf1a00e441f3024d5@mail.gmail.com> Message-ID: HH> I agree with Alex, just one perhaps obvious comment: I would have one HH> transaction around cleaning up one blob-id, not a big transaction HH> around cleaning up the whole blob table. If you do several HH> transactions it doesn't lock up much, so it HH> should be able to execute at the same time as a database is in HH> production. i think with PostgreSQL's concurrency model (MVCC) locks will be of no harm -- iirc only concurrent updates of same values block one another. here we are not doing concurrent updates, and so it should go fine in one transaction, probably will work way faster too. i won't bet on it, though, it's better to test to be sure From rsynnott at gmail.com Thu Dec 11 17:09:53 2008 From: rsynnott at gmail.com (Robert Synnott) Date: Thu, 11 Dec 2008 17:09:53 +0000 Subject: [elephant-devel] Postmodern backend; are values ever removed from the blob table In-Reply-To: <50e8e4f60812110245l5386d27hf1a00e441f3024d5@mail.gmail.com> References: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com> <24f203480812102012h5e233c06qc6cb427cca5be89f@mail.gmail.com> <50e8e4f60812110245l5386d27hf1a00e441f3024d5@mail.gmail.com> Message-ID: <24f203480812110909s1ba4f6cbs929fd30e015c941b@mail.gmail.com> 2008/12/11 Henrik Hjelte : > I agree with Alex, just one perhaps obvious comment: I would have one > transaction around cleaning up one blob-id, not a big transaction > around cleaning up the whole blob table. If you do several > transactions it doesn't lock up much, so it > should be able to execute at the same time as a database is in production. > > I hope your code can be added to the postmodern backend. > > Thanks, > Henrik > > ________ I can certainly provide it as a contrib, but as it stands, it is not useful in all circumstances; it keeps track of the live bids using a huge array of booleans, and for a sufficiently big database memory would become a problem. It suits my database, however. I have two other minor worries about this technique. First, it would seem possible that if, say, we have slot1 in object1 which was set to :some-opt at some time in the past, but is now totally unused by any object, the blob row containing that would be considered dead; if someone comes along while the cleanup is running and sets some slot to :some-opt, then it will be in use again, but potentially get deleted anyway, because it will have already been deemed dead. This isn't really a problem for me; due to the nature of my dataset the chances of this happening are remote, but I can imagine it'd be an issue for some people. Secondly, there's the possibility that somebody could put a bid in, say, a serialized list. This would NOT be detected by the procedure I've outlined, and the thing with that bid would be deleted if not referred to elsewhere. Again, this isn't a problem for me, but somebody else might potentially be doing it. Beyond those, though, in the normal case I am correct to assume that a blob entry can be considered totally unused if not referred to in either slots or any tree? Thanks Rob From yarek.kowalik at gmail.com Thu Dec 11 18:56:40 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Thu, 11 Dec 2008 10:56:40 -0800 Subject: [elephant-devel] Help with an error on app startup/initialization Message-ID: I've converted my weblocks app to use elephant. One of the first things I do is to initialize some variables. One of the variables is a "demo" item, that I use as a placeholder until the user choses something more specific. I'm having trouble initializing the dummy. Here is my code: (defun init-dummy-item () (let* ((ref-type 0) (ref-id "dummy-item")) (setf *dummy-item* (unless-use (awhen (elephant:get-instances-by-value 'product-item 'reference-id ref-id) (find-if (lambda (item) (eql (product-item-reference-type item) ref-type)) it)) (make-instance 'product-item :reference-type ref-type :reference-id ref-id :title "No Item selected" :url "/pub/static/dummy.html" :image-url "/pub/images/dummy.png"))))) (The UNLESS-USE macro simply does unless, and if results are nil uses the second sexp.) The problem is that I get an error (see trace below) when calling GET-INSTANCES-BY-VALUE. What am I doing wrong? The nearest that I can gather is that GET-VALUE is called with the secondd argument as NIL, but it's supposed to be something reasonable, i.e a controller-index-table held by the controler. For whatever raeson that's NIL. What's the deal here? Am I not alowed to call the get-instances-by-* methods until I create at least one item for each class I'm querying about? Yarek THE ERROR: There is no applicable method for the generic function # when called with arguments ((FASHION-ORIGAMI::PRODUCT-ITEM . FASHION-ORIGAMI::REFERENCE-ID) NIL). [Condition of type SIMPLE-ERROR] Restarts: 0: [TERMINATE-THREAD] Terminate this thread (#) Backtrace: 0: ((LAMBDA (SWANK-BACKEND::DEBUGGER-LOOP-FN)) #) 1: (SWANK::DEBUG-IN-EMACS #) 2: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) # #) 3: (SWANK::CALL-WITH-REDIRECTED-IO # #) 4: (SWANK::CALL-WITH-CONNECTION # #) 5: (SWANK:INVOKE-SLIME-DEBUGGER #) 6: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) # #) 7: (INVOKE-DEBUGGER #) 8: (INVOKE-DEBUGGER #)[:EXTERNAL] 9: ((SB-PCL::FAST-METHOD HUNCHENTOOT:MAYBE-INVOKE-DEBUGGER (T)) # # #) 10: (SIGNAL #)[:EXTERNAL] 11: (ERROR #)[:EXTERNAL] 12: ((FLET #:LAMBDA43) #) 13: ((FLET #:LAMBDA43) #)[:EXTERNAL] 14: (SIGNAL #)[:EXTERNAL] 15: (ERROR "~@")[:EXTERNAL] Locals: SB-DEBUG::ARG-0 = 3 SB-DEBUG::ARG-1 = "~@ # #)[:EXTERNAL] Locals: SB-DEBUG::ARG-0 = 5 SB-DEBUG::ARG-1 = : SB-DEBUG::ARG-2 = : SB-DEBUG::ARG-3 = # 17: (ELEPHANT::ENSURE-SLOT-DEF-INDEX # #) Locals: SB-DEBUG::ARG-0 = : SB-DEBUG::ARG-1 = : 18: ((SB-PCL::FAST-METHOD ELEPHANT:FIND-INVERTED-INDEX (ELEPHANT:PERSISTENT-METACLASS T)) # # # #)[:EXTERNAL] Locals: SB-DEBUG::ARG-0 = : SB-DEBUG::ARG-1 = : SB-DEBUG::ARG-2 = : SB-DEBUG::ARG-3 = : SB-DEBUG::ARG-4 = : 19: (ELEPHANT:MAP-INVERTED-INDEX # # #)[:EXTERNAL] Locals: SB-DEBUG::ARG-0 = : SB-DEBUG::ARG-1 = : SB-DEBUG::ARG-2 = : SB-DEBUG::ARG-3 = : 20: (FASHION-ORIGAMI::INIT-DUMMY-ITEM) Locals: #:G137 = : ANAPHORA:IT = : -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Thu Dec 11 21:19:10 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Thu, 11 Dec 2008 16:19:10 -0500 Subject: [elephant-devel] Help with an error on app startup/initialization In-Reply-To: References: Message-ID: Which version of elephant are you using? Which backend are you using? If BDB, which version? I presume *store-controller* open and reachable from the package you are in? Looks like the elephant store isn't in the proper state (e.g. was closed and *store-controller* was not zeroed out). On Dec 11, 2008, at 1:56 PM, Yarek Kowalik wrote: > I've converted my weblocks app to use elephant. One of the first > things I do is to initialize some variables. One of the variables > is a "demo" item, that I use as a placeholder until the user choses > something more specific. I'm having trouble initializing the > dummy. Here is my code: > > (defun init-dummy-item () > (let* ((ref-type 0) > (ref-id "dummy-item")) > (setf *dummy-item* > (unless-use (awhen (elephant:get-instances-by-value > 'product-item 'reference-id ref-id) > (find-if (lambda (item) > (eql (product-item-reference-type > item) ref-type)) > it)) > (make-instance > 'product-item > :reference-type ref-type > :reference-id ref-id > :title "No Item selected" > :url "/pub/static/dummy.html" > :image-url "/pub/images/dummy.png"))))) > > (The UNLESS-USE macro simply does unless, and if results are nil > uses the second sexp.) > > The problem is that I get an error (see trace below) when calling > GET-INSTANCES-BY-VALUE. What am I doing wrong? > > The nearest that I can gather is that GET-VALUE is called with the > secondd argument as NIL, but it's supposed to be something > reasonable, i.e a controller-index-table held by the controler. For > whatever raeson that's NIL. What's the deal here? Am I not alowed > to call the get-instances-by-* methods until I create at least one > item for each class I'm querying about? > > Yarek > > THE ERROR: > > There is no applicable method for the generic function > # > when called with arguments > ((FASHION-ORIGAMI::PRODUCT-ITEM > . FASHION-ORIGAMI::REFERENCE-ID) > NIL). > [Condition of type SIMPLE-ERROR] > > Restarts: > 0: [TERMINATE-THREAD] Terminate this thread (# worker-4" RUNNING {10029A0321}>) > > Backtrace: > 0: ((LAMBDA (SWANK-BACKEND::DEBUGGER-LOOP-FN)) # #) {1003F6A4C9}>) > 1: (SWANK::DEBUG-IN-EMACS #) > 2: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) # SWANK:SWANK-DEBUGGER-HOOK> #) > 3: (SWANK::CALL-WITH-REDIRECTED-IO # {10037B86D1}> #) > 4: (SWANK::CALL-WITH-CONNECTION # > #) > 5: (SWANK:INVOKE-SLIME-DEBUGGER #) > 6: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) # SWANK:SWANK-DEBUGGER-HOOK> #) > 7: (INVOKE-DEBUGGER #) > 8: (INVOKE-DEBUGGER #)[:EXTERNAL] > 9: ((SB-PCL::FAST-METHOD HUNCHENTOOT:MAYBE-INVOKE-DEBUGGER (T)) > # # # {1002E3A1A1}>) > 10: (SIGNAL #)[:EXTERNAL] > 11: (ERROR #)[:EXTERNAL] > 12: ((FLET #:LAMBDA43) #) > 13: ((FLET #:LAMBDA43) #)[:EXTERNAL] > 14: (SIGNAL #)[:EXTERNAL] > 15: (ERROR "~@ function ~2I~_~S~\n ~I~_when called with arguments > ~2I~_~S.~:>")[:EXTERNAL] > Locals: > SB-DEBUG::ARG-0 = 3 > SB-DEBUG::ARG-1 = "~@ generic function ~2I~_~S~\n .. > 16: ((SB-PCL::FAST-METHOD NO-APPLICABLE-METHOD (T)) # argument> # # ELEPHANT:GET-VALUE (3)>)[:EXTERNAL] > Locals: > SB-DEBUG::ARG-0 = 5 > SB-DEBUG::ARG-1 = : > SB-DEBUG::ARG-2 = : > SB-DEBUG::ARG-3 = # VALUE (3)> > 17: (ELEPHANT::ENSURE-SLOT-DEF-INDEX # > #) > Locals: > SB-DEBUG::ARG-0 = : > SB-DEBUG::ARG-1 = : > 18: ((SB-PCL::FAST-METHOD ELEPHANT:FIND-INVERTED-INDEX > (ELEPHANT:PERSISTENT-METACLASS T)) # > # # # argument>)[:EXTERNAL] > Locals: > SB-DEBUG::ARG-0 = : > SB-DEBUG::ARG-1 = : > SB-DEBUG::ARG-2 = : > SB-DEBUG::ARG-3 = : > SB-DEBUG::ARG-4 = : > 19: (ELEPHANT:MAP-INVERTED-INDEX # > # #)[:EXTERNAL] > Locals: > SB-DEBUG::ARG-0 = : > SB-DEBUG::ARG-1 = : > SB-DEBUG::ARG-2 = : > SB-DEBUG::ARG-3 = : > 20: (FASHION-ORIGAMI::INIT-DUMMY-ITEM) > Locals: > #:G137 = : > ANAPHORA:IT = : > > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From yarek.kowalik at gmail.com Thu Dec 11 21:50:53 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Thu, 11 Dec 2008 13:50:53 -0800 Subject: [elephant-devel] Help with an error on app startup/initialization In-Reply-To: References: Message-ID: BDB 4.5 for back-end. I'm using elephant-unstable, pulled last week. I'm elephant this via Weblocks, so I'm assuming the store is open by the time the init-session for Weblocks app is called. Maybe I should check on that - it's possible that the store is not in fully open state? Yarek On Thu, Dec 11, 2008 at 1:19 PM, Ian Eslick wrote: > Which version of elephant are you using? > Which backend are you using? If BDB, which version? > > I presume *store-controller* open and reachable from the package you > are in? > > Looks like the elephant store isn't in the proper state (e.g. was > closed and *store-controller* was not zeroed out). > > On Dec 11, 2008, at 1:56 PM, Yarek Kowalik wrote: > > > I've converted my weblocks app to use elephant. One of the first > > things I do is to initialize some variables. One of the variables > > is a "demo" item, that I use as a placeholder until the user choses > > something more specific. I'm having trouble initializing the > > dummy. Here is my code: > > > > (defun init-dummy-item () > > (let* ((ref-type 0) > > (ref-id "dummy-item")) > > (setf *dummy-item* > > (unless-use (awhen (elephant:get-instances-by-value > > 'product-item 'reference-id ref-id) > > (find-if (lambda (item) > > (eql (product-item-reference-type > > item) ref-type)) > > it)) > > (make-instance > > 'product-item > > :reference-type ref-type > > :reference-id ref-id > > :title "No Item selected" > > :url "/pub/static/dummy.html" > > :image-url "/pub/images/dummy.png"))))) > > > > (The UNLESS-USE macro simply does unless, and if results are nil > > uses the second sexp.) > > > > The problem is that I get an error (see trace below) when calling > > GET-INSTANCES-BY-VALUE. What am I doing wrong? > > > > The nearest that I can gather is that GET-VALUE is called with the > > secondd argument as NIL, but it's supposed to be something > > reasonable, i.e a controller-index-table held by the controler. For > > whatever raeson that's NIL. What's the deal here? Am I not alowed > > to call the get-instances-by-* methods until I create at least one > > item for each class I'm querying about? > > > > Yarek > > > > THE ERROR: > > > > There is no applicable method for the generic function > > # > > when called with arguments > > ((FASHION-ORIGAMI::PRODUCT-ITEM > > . FASHION-ORIGAMI::REFERENCE-ID) > > NIL). > > [Condition of type SIMPLE-ERROR] > > > > Restarts: > > 0: [TERMINATE-THREAD] Terminate this thread (# > worker-4" RUNNING {10029A0321}>) > > > > Backtrace: > > 0: ((LAMBDA (SWANK-BACKEND::DEBUGGER-LOOP-FN)) # > #) {1003F6A4C9}>) > > 1: (SWANK::DEBUG-IN-EMACS #) > > 2: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) # > SWANK:SWANK-DEBUGGER-HOOK> #) > > 3: (SWANK::CALL-WITH-REDIRECTED-IO # > {10037B86D1}> #) > > 4: (SWANK::CALL-WITH-CONNECTION # > > #) > > 5: (SWANK:INVOKE-SLIME-DEBUGGER #) > > 6: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) # > SWANK:SWANK-DEBUGGER-HOOK> #) > > 7: (INVOKE-DEBUGGER #) > > 8: (INVOKE-DEBUGGER #)[:EXTERNAL] > > 9: ((SB-PCL::FAST-METHOD HUNCHENTOOT:MAYBE-INVOKE-DEBUGGER (T)) > > # # # > {1002E3A1A1}>) > > 10: (SIGNAL #)[:EXTERNAL] > > 11: (ERROR #)[:EXTERNAL] > > 12: ((FLET #:LAMBDA43) #) > > 13: ((FLET #:LAMBDA43) #)[:EXTERNAL] > > 14: (SIGNAL #)[:EXTERNAL] > > 15: (ERROR "~@ > function ~2I~_~S~\n ~I~_when called with arguments > > ~2I~_~S.~:>")[:EXTERNAL] > > Locals: > > SB-DEBUG::ARG-0 = 3 > > SB-DEBUG::ARG-1 = "~@ > generic function ~2I~_~S~\n .. > > 16: ((SB-PCL::FAST-METHOD NO-APPLICABLE-METHOD (T)) # > argument> # # > ELEPHANT:GET-VALUE (3)>)[:EXTERNAL] > > Locals: > > SB-DEBUG::ARG-0 = 5 > > SB-DEBUG::ARG-1 = : > > SB-DEBUG::ARG-2 = : > > SB-DEBUG::ARG-3 = # > VALUE (3)> > > 17: (ELEPHANT::ENSURE-SLOT-DEF-INDEX # > > #) > > Locals: > > SB-DEBUG::ARG-0 = : > > SB-DEBUG::ARG-1 = : > > 18: ((SB-PCL::FAST-METHOD ELEPHANT:FIND-INVERTED-INDEX > > (ELEPHANT:PERSISTENT-METACLASS T)) # > > # # # > argument>)[:EXTERNAL] > > Locals: > > SB-DEBUG::ARG-0 = : > > SB-DEBUG::ARG-1 = : > > SB-DEBUG::ARG-2 = : > > SB-DEBUG::ARG-3 = : > > SB-DEBUG::ARG-4 = : > > 19: (ELEPHANT:MAP-INVERTED-INDEX # > > # #)[:EXTERNAL] > > Locals: > > SB-DEBUG::ARG-0 = : > > SB-DEBUG::ARG-1 = : > > SB-DEBUG::ARG-2 = : > > SB-DEBUG::ARG-3 = : > > 20: (FASHION-ORIGAMI::INIT-DUMMY-ITEM) > > Locals: > > #:G137 = : > > ANAPHORA:IT = : > > > > > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarek.kowalik at gmail.com Thu Dec 11 22:16:10 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Thu, 11 Dec 2008 14:16:10 -0800 Subject: [elephant-devel] Help with an error on app startup/initialization In-Reply-To: References: Message-ID: Yep, store gets opened on application start, before session-init is called. Also, moving init-dummy to open-store :after pushes the problem further, then I get a BDB-DB-ERROR when calling (elephant::get-db-schemas (weblocks-elephant::elephant-controller *my-elephant-store*) 'product-item) - this was optained running code from REPL trying reproduce the error I get when using (weblocks-elephant:count-persisten-objects *my-elephant-store* 'product-item). Yarek Bad type argument: BDB-DB-ERROR [Condition of type SIMPLE-TYPE-ERROR] Restarts: 0: [RETRY] Retry SLIME REPL evaluation request. 1: [ABORT] Return to SLIME's top level. 2: [TERMINATE-THREAD] Terminate this thread (#) Backtrace: 0: (MAKE-CONDITION BDB-DB-ERROR)[:EXTERNAL] Locals: SB-DEBUG::ARG-0 = 3 SB-DEBUG::ARG-1 = BDB-DB-ERROR 1: (ERROR BDB-DB-ERROR)[:EXTERNAL] Locals: SB-DEBUG::ARG-0 = 3 SB-DEBUG::ARG-1 = BDB-DB-ERROR 2: ((SB-PCL::FAST-METHOD ELEPHANT::EXECUTE-TRANSACTION (DB-BDB::BDB-STORE-CONTROLLER T)) ..)[:EXTERNAL] Locals: SB-DEBUG::ARG-0 = 10 SB-DEBUG::ARG-1 = : SB-DEBUG::ARG-2 = : SB-DEBUG::ARG-3 = # SB-DEBUG::ARG-4 = # 3: (ELEPHANT::MAP-BTREE-VALUES #) [No Locals] 4: (ELEPHANT::GET-DB-SCHEMAS # PRODUCT-ITEM) Locals: SB-DEBUG::ARG-0 = # SB-DEBUG::ARG-1 = PRODUCT-ITEM 5: (SB-INT:SIMPLE-EVAL-IN-LEXENV (ELEPHANT::GET-DB-SCHEMAS (WEBLOCKS-ELEPHANT::ELEPHANT-CONTROLLER *FASHION-ORIGAMI-ELEPHANT-STORE*) 'PRODUCT-ITEM) #) Locals: SB-DEBUG::ARG-0 = (ELEPHANT::GET-DB-SCHEMAS ..) SB-DEBUG::ARG-1 = # 6: (SWANK::EVAL-REGION "(elephant::get-db-schemas (weblocks-elephant::elephant-controller *fashion-origami-elephant-store*) 'product-item)\n") Locals: SB-DEBUG::ARG-0 = "(elephant::get-db-schemas (weblocks-elephant::elephant-controller *fashion.. Yarek On Thu, Dec 11, 2008 at 1:50 PM, Yarek Kowalik wrote: > BDB 4.5 for back-end. > > I'm using elephant-unstable, pulled last week. > > I'm elephant this via Weblocks, so I'm assuming the store is open by the > time the init-session for Weblocks app is called. Maybe I should check on > that - it's possible that the store is not in fully open state? > > Yarek > > > On Thu, Dec 11, 2008 at 1:19 PM, Ian Eslick wrote: > >> Which version of elephant are you using? >> Which backend are you using? If BDB, which version? >> >> I presume *store-controller* open and reachable from the package you >> are in? >> >> Looks like the elephant store isn't in the proper state (e.g. was >> closed and *store-controller* was not zeroed out). >> >> On Dec 11, 2008, at 1:56 PM, Yarek Kowalik wrote: >> >> > I've converted my weblocks app to use elephant. One of the first >> > things I do is to initialize some variables. One of the variables >> > is a "demo" item, that I use as a placeholder until the user choses >> > something more specific. I'm having trouble initializing the >> > dummy. Here is my code: >> > >> > (defun init-dummy-item () >> > (let* ((ref-type 0) >> > (ref-id "dummy-item")) >> > (setf *dummy-item* >> > (unless-use (awhen (elephant:get-instances-by-value >> > 'product-item 'reference-id ref-id) >> > (find-if (lambda (item) >> > (eql (product-item-reference-type >> > item) ref-type)) >> > it)) >> > (make-instance >> > 'product-item >> > :reference-type ref-type >> > :reference-id ref-id >> > :title "No Item selected" >> > :url "/pub/static/dummy.html" >> > :image-url "/pub/images/dummy.png"))))) >> > >> > (The UNLESS-USE macro simply does unless, and if results are nil >> > uses the second sexp.) >> > >> > The problem is that I get an error (see trace below) when calling >> > GET-INSTANCES-BY-VALUE. What am I doing wrong? >> > >> > The nearest that I can gather is that GET-VALUE is called with the >> > secondd argument as NIL, but it's supposed to be something >> > reasonable, i.e a controller-index-table held by the controler. For >> > whatever raeson that's NIL. What's the deal here? Am I not alowed >> > to call the get-instances-by-* methods until I create at least one >> > item for each class I'm querying about? >> > >> > Yarek >> > >> > THE ERROR: >> > >> > There is no applicable method for the generic function >> > # >> > when called with arguments >> > ((FASHION-ORIGAMI::PRODUCT-ITEM >> > . FASHION-ORIGAMI::REFERENCE-ID) >> > NIL). >> > [Condition of type SIMPLE-ERROR] >> > >> > Restarts: >> > 0: [TERMINATE-THREAD] Terminate this thread (#> > worker-4" RUNNING {10029A0321}>) >> > >> > Backtrace: >> > 0: ((LAMBDA (SWANK-BACKEND::DEBUGGER-LOOP-FN)) #> > #) {1003F6A4C9}>) >> > 1: (SWANK::DEBUG-IN-EMACS #) >> > 2: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #> > SWANK:SWANK-DEBUGGER-HOOK> #) >> > 3: (SWANK::CALL-WITH-REDIRECTED-IO #> > {10037B86D1}> #) >> > 4: (SWANK::CALL-WITH-CONNECTION # >> > #) >> > 5: (SWANK:INVOKE-SLIME-DEBUGGER #) >> > 6: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #> > SWANK:SWANK-DEBUGGER-HOOK> #) >> > 7: (INVOKE-DEBUGGER #) >> > 8: (INVOKE-DEBUGGER #)[:EXTERNAL] >> > 9: ((SB-PCL::FAST-METHOD HUNCHENTOOT:MAYBE-INVOKE-DEBUGGER (T)) >> > # # #> > {1002E3A1A1}>) >> > 10: (SIGNAL #)[:EXTERNAL] >> > 11: (ERROR #)[:EXTERNAL] >> > 12: ((FLET #:LAMBDA43) #) >> > 13: ((FLET #:LAMBDA43) #)[:EXTERNAL] >> > 14: (SIGNAL #)[:EXTERNAL] >> > 15: (ERROR "~@> > function ~2I~_~S~\n ~I~_when called with arguments >> > ~2I~_~S.~:>")[:EXTERNAL] >> > Locals: >> > SB-DEBUG::ARG-0 = 3 >> > SB-DEBUG::ARG-1 = "~@> > generic function ~2I~_~S~\n .. >> > 16: ((SB-PCL::FAST-METHOD NO-APPLICABLE-METHOD (T)) #> > argument> # #> > ELEPHANT:GET-VALUE (3)>)[:EXTERNAL] >> > Locals: >> > SB-DEBUG::ARG-0 = 5 >> > SB-DEBUG::ARG-1 = : >> > SB-DEBUG::ARG-2 = : >> > SB-DEBUG::ARG-3 = #> > VALUE (3)> >> > 17: (ELEPHANT::ENSURE-SLOT-DEF-INDEX # >> > #) >> > Locals: >> > SB-DEBUG::ARG-0 = : >> > SB-DEBUG::ARG-1 = : >> > 18: ((SB-PCL::FAST-METHOD ELEPHANT:FIND-INVERTED-INDEX >> > (ELEPHANT:PERSISTENT-METACLASS T)) # >> > # # #> > argument>)[:EXTERNAL] >> > Locals: >> > SB-DEBUG::ARG-0 = : >> > SB-DEBUG::ARG-1 = : >> > SB-DEBUG::ARG-2 = : >> > SB-DEBUG::ARG-3 = : >> > SB-DEBUG::ARG-4 = : >> > 19: (ELEPHANT:MAP-INVERTED-INDEX # >> > # #)[:EXTERNAL] >> > Locals: >> > SB-DEBUG::ARG-0 = : >> > SB-DEBUG::ARG-1 = : >> > SB-DEBUG::ARG-2 = : >> > SB-DEBUG::ARG-3 = : >> > 20: (FASHION-ORIGAMI::INIT-DUMMY-ITEM) >> > Locals: >> > #:G137 = : >> > ANAPHORA:IT = : >> > >> > >> > >> > _______________________________________________ >> > elephant-devel site list >> > elephant-devel at common-lisp.net >> > http://common-lisp.net/mailman/listinfo/elephant-devel >> >> >> _______________________________________________ >> elephant-devel site list >> elephant-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/elephant-devel >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarek.kowalik at gmail.com Thu Dec 11 22:23:48 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Thu, 11 Dec 2008 14:23:48 -0800 Subject: [elephant-devel] Is it safe to use the same elephant store in two different processes? Message-ID: I'm trying to access BDB 4.5 backed elephant store (elephant-unstable) from two different lisp processes using the elephant package. Is this a safe thing to do? Yarek -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarek.kowalik at gmail.com Thu Dec 11 22:36:21 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Thu, 11 Dec 2008 14:36:21 -0800 Subject: [elephant-devel] Is it safe to use the same elephant store in two different processes? In-Reply-To: References: Message-ID: I'm guessing it is not... as that's what's causing some of my data problems.... I thought BDBs can handle multi-process access. Yarek On Thu, Dec 11, 2008 at 2:23 PM, Yarek Kowalik wrote: > I'm trying to access BDB 4.5 backed elephant store (elephant-unstable) from > two different lisp processes using the elephant package. Is this a safe > thing to do? > > Yarek > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarek.kowalik at gmail.com Thu Dec 11 23:03:36 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Thu, 11 Dec 2008 15:03:36 -0800 Subject: [elephant-devel] Is it safe to use the same elephant store in two different processes? In-Reply-To: References: Message-ID: I've read section 4.13 in the doc, and it appears that it's possible to use two processes. However, when I launch two processes reading the same database, the first process trows errors (see trace below). Something is messing up the access/confing for the first process. I was hoping I would not be running into this problem, since I am running two processes on purpose: one is running standard HTTP server, the other SSL for secure longins, etc. I'm using BDB as a means of communicating the user login state: the user logs in on SSL side, sets up a pass tokens in the cookie, redirects to HTTP, and there the server fetches authorisation code from DB using the token. THis bug, then, stops me cold. Please help. Yarek Bad type argument: BDB-DB-ERROR [Condition of type SIMPLE-TYPE-ERROR] Restarts: 0: [RETRY] Retry SLIME REPL evaluation request. 1: [ABORT] Return to SLIME's top level. 2: [TERMINATE-THREAD] Terminate this thread (#) Backtrace: 0: (MAKE-CONDITION BDB-DB-ERROR)[:EXTERNAL] 1: (ERROR BDB-DB-ERROR)[:EXTERNAL] 2: ((SB-PCL::FAST-METHOD ELEPHANT::EXECUTE-TRANSACTION (DB-BDB::BDB-STORE-CONTROLLER T)) ..)[:EXTERNAL] 3: (ELEPHANT::MAP-BTREE-VALUES #) 4: (ELEPHANT::GET-DB-SCHEMAS # PRODUCT-SET) 5: (SB-INT:SIMPLE-EVAL-IN-LEXENV (ELEPHANT::GET-DB-SCHEMAS (WEBLOCKS-ELEPHANT::ELEPHANT-CONTROLLER *FASHION-ORIGAMI-ELEPHANT-STORE*) 'PRODUCT-SET) #) 6: (SWANK::EVAL-REGION "(elephant::get-db-schemas (weblocks-elephant::elephant-controller *fashion-origami-elephant-store*) 'product-set)\n") On Thu, Dec 11, 2008 at 2:36 PM, Yarek Kowalik wrote: > I'm guessing it is not... as that's what's causing some of my data > problems.... I thought BDBs can handle multi-process access. > > Yarek > > > On Thu, Dec 11, 2008 at 2:23 PM, Yarek Kowalik wrote: > >> I'm trying to access BDB 4.5 backed elephant store (elephant-unstable) >> from two different lisp processes using the elephant package. Is this a >> safe thing to do? >> >> Yarek >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Fri Dec 12 00:42:29 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Thu, 11 Dec 2008 19:42:29 -0500 Subject: [elephant-devel] Is it safe to use the same elephant store in two different processes? In-Reply-To: References: Message-ID: Multiple lisp processes (in a shared memory environment) should be safe, but I'm not sure if it's tested (anyone here done this?). I believe they have to use the same BDB environment, so you may need to do some checking on the proper open-store arguments to join vs. create an environment. Some defaults in weblocks or elephant may interfere with this. bdb-controller.lisp - open-controller definition shows you what arguments are passed to BDB when it is opened. Regardless, please upgrade to BDB 4.7. Most of us using unstable are on 4.6 or 4.7 now. I'd rather not track down issues associated with non-compatible upgrades (it should work, but testing coverage is getting tougher with all the system combinations of backends, BDB versions, DB versions, etc). Ian On Dec 11, 2008, at 5:23 PM, Yarek Kowalik wrote: > I'm trying to access BDB 4.5 backed elephant store (elephant- > unstable) from two different lisp processes using the elephant > package. Is this a safe thing to do? > > Yarek > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From eslick at media.mit.edu Fri Dec 12 00:44:51 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Thu, 11 Dec 2008 19:44:51 -0500 Subject: [elephant-devel] Is it safe to use the same elephant store in two different processes? In-Reply-To: References: Message-ID: Take a peek at the issues around sharing a DB environment in the BDB docs and look at the open-controller args and see where you get. I won't be able to look into this for a few days but can answer the occasional question (probably best to e-mail me offline of the mailing list until we resolve this. Be great if anyone else has hacked through this, though. We should document the assumptions. Ian On Dec 11, 2008, at 6:03 PM, Yarek Kowalik wrote: > I've read section 4.13 in the doc, and it appears that it's possible > to use two processes. However, when I launch two processes reading > the same database, the first process trows errors (see trace below). > > Something is messing up the access/confing for the first process. > > I was hoping I would not be running into this problem, since I am > running two processes on purpose: one is running standard HTTP > server, the other SSL for secure longins, etc. I'm using BDB as a > means of communicating the user login state: the user logs in on SSL > side, sets up a pass tokens in the cookie, redirects to HTTP, and > there the server fetches authorisation code from DB using the token. > > THis bug, then, stops me cold. Please help. > > Yarek > > > Bad type argument: > BDB-DB-ERROR > [Condition of type SIMPLE-TYPE-ERROR] > > Restarts: > 0: [RETRY] Retry SLIME REPL evaluation request. > 1: [ABORT] Return to SLIME's top level. > 2: [TERMINATE-THREAD] Terminate this thread (# RUNNING {1002CAA181}>) > > Backtrace: > 0: (MAKE-CONDITION BDB-DB-ERROR)[:EXTERNAL] > 1: (ERROR BDB-DB-ERROR)[:EXTERNAL] > 2: ((SB-PCL::FAST-METHOD ELEPHANT::EXECUTE-TRANSACTION (DB- > BDB::BDB-STORE-CONTROLLER T)) ..)[:EXTERNAL] > 3: (ELEPHANT::MAP-BTREE-VALUES #) > 4: (ELEPHANT::GET-DB-SCHEMAS # lisp/projects/fashion-origami/data/> PRODUCT-SET) > 5: (SB-INT:SIMPLE-EVAL-IN-LEXENV (ELEPHANT::GET-DB-SCHEMAS > (WEBLOCKS-ELEPHANT::ELEPHANT-CONTROLLER *FASHION-ORIGAMI-ELEPHANT- > STORE*) 'PRODUCT-SET) #) > 6: (SWANK::EVAL-REGION "(elephant::get-db-schemas (weblocks- > elephant::elephant-controller *fashion-origami-elephant-store*) > 'product-set)\n") > > On Thu, Dec 11, 2008 at 2:36 PM, Yarek Kowalik > wrote: > I'm guessing it is not... as that's what's causing some of my data > problems.... I thought BDBs can handle multi-process access. > > Yarek > > > On Thu, Dec 11, 2008 at 2:23 PM, Yarek Kowalik > wrote: > I'm trying to access BDB 4.5 backed elephant store (elephant- > unstable) from two different lisp processes using the elephant > package. Is this a safe thing to do? > > Yarek > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From rsynnott at gmail.com Fri Dec 12 01:52:08 2008 From: rsynnott at gmail.com (Robert Synnott) Date: Fri, 12 Dec 2008 01:52:08 +0000 Subject: [elephant-devel] Is it safe to use the same elephant store in two different processes? In-Reply-To: References: Message-ID: <24f203480812111752l66469a76jd5995ec4e3c2dbfc@mail.gmail.com> 2008/12/11 Yarek Kowalik : > I've read section 4.13 in the doc, and it appears that it's possible to use > two processes. However, when I launch two processes reading the same > database, the first process trows errors (see trace below). > > Something is messing up the access/confing for the first process. > > I was hoping I would not be running into this problem, since I am running > two processes on purpose: one is running standard HTTP server, the other SSL > for secure longins, etc. I'm using BDB as a means of communicating the user > login state: the user logs in on SSL side, sets up a pass tokens in the > cookie, redirects to HTTP, and there the server fetches authorisation code > from DB using the token. > If that's all you need it for, you can actually probably run both servers in the same process. Rob From yarek.kowalik at gmail.com Fri Dec 12 03:40:33 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Thu, 11 Dec 2008 19:40:33 -0800 Subject: [elephant-devel] Is it safe to use the same elephant store in two different processes? Message-ID: <4941dd33.14b48c0a.63db.ffffd1df@mx.google.com> I thought about using one process, but there doesn't seem a way to do this in Weblocks. I'll try Ian's sugestion. Yarek -----Original Message----- From: Robert Synnott Sent: Thursday, December 11, 2008 5:52 PM To: Elephant bugs and development Subject: Re: [elephant-devel] Is it safe to use the same elephant store in two different processes? 2008/12/11 Yarek Kowalik : > I've read section 4.13 in the doc, and it appears that it's possible to use > two processes. However, when I launch two processes reading the same > database, the first process trows errors (see trace below). > > Something is messing up the access/confing for the first process. > > I was hoping I would not be running into this problem, since I am running > two processes on purpose: one is running standard HTTP server, the other SSL > for secure longins, etc. I'm using BDB as a means of communicating the user > login state: the user logs in on SSL side, sets up a pass tokens in the > cookie, redirects to HTTP, and there the server fetches authorisation code > from DB using the token. > If that's all you need it for, you can actually probably run both servers in the same process. Rob _______________________________________________ elephant-devel site list elephant-devel at common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel From henrik at evahjelte.com Fri Dec 12 10:28:20 2008 From: henrik at evahjelte.com (Henrik Hjelte) Date: Fri, 12 Dec 2008 11:28:20 +0100 Subject: [elephant-devel] Postmodern backend; are values ever removed from the blob table In-Reply-To: <24f203480812110909s1ba4f6cbs929fd30e015c941b@mail.gmail.com> References: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com> <24f203480812102012h5e233c06qc6cb427cca5be89f@mail.gmail.com> <50e8e4f60812110245l5386d27hf1a00e441f3024d5@mail.gmail.com> <24f203480812110909s1ba4f6cbs929fd30e015c941b@mail.gmail.com> Message-ID: <50e8e4f60812120228o39e8935bx80e967b4194b98e3@mail.gmail.com> On Thu, Dec 11, 2008 at 6:09 PM, Robert Synnott wrote: > I have two other minor worries about this technique. First, it would > seem possible that if, say, we have slot1 in object1 which was set to > :some-opt at some time in the past, but is now totally unused by any > object, the blob row containing that would be considered dead; if > someone comes along while the cleanup is running and sets some slot to > :some-opt, then it will be in use again, but potentially get deleted > anyway, because it will have already been deemed dead. This isn't > really a problem for me; due to the nature of my dataset the chances > of this happening are remote, but I can imagine it'd be an issue for > some people This will not be a problem if the cleanup code is kept in a postgres transaction. The new slot update to :some-opt (after the delete) will result in a new entry in the blob table (from the stored procedure sp_ensure_bid). > > Secondly, there's the possibility that somebody could put a bid in, > say, a serialized list. This would NOT be detected by the procedure > I've outlined, and the thing with that bid would be deleted if not > referred to elsewhere. Again, this isn't a problem for me, but > somebody else might potentially be doing it. It would be a fair punishment. The blob table and bids should be considered internal to db_postmodern, you are not supposed to mess with it or use these values in your application code. > > Beyond those, though, in the normal case I am correct to assume that a > blob entry can be considered totally unused if not referred to in > either slots or any tree? Yes. /Henrik Hjelte From killerstorm at newmail.ru Fri Dec 12 16:15:19 2008 From: killerstorm at newmail.ru (Alex Mizrahi) Date: Fri, 12 Dec 2008 18:15:19 +0200 Subject: [elephant-devel] Postmodern backend; are values ever removed from the blob table References: <24f203480812101238n3a647d2ahe5b284727e96abf2@mail.gmail.com><24f203480812102012h5e233c06qc6cb427cca5be89f@mail.gmail.com><50e8e4f60812110245l5386d27hf1a00e441f3024d5@mail.gmail.com> <24f203480812110909s1ba4f6cbs929fd30e015c941b@mail.gmail.com> Message-ID: RS> I have two other minor worries about this technique. First, it would RS> seem possible that if, say, we have slot1 in object1 which was set to RS> :some-opt at some time in the past, but is now totally unused by any RS> object, the blob row containing that would be considered dead; if RS> someone comes along while the cleanup is running and sets some slot to RS> :some-opt, then it will be in use again, but potentially get deleted RS> anyway, because it will have already been deemed dead. RS> This isn't really a problem for me; due to the nature of my dataset the RS> chances of this happening are remote, but I can imagine it'd be an RS> issue for some people. yep, this might be a problem. unfortunately i do not see general solution to this problem without modifying blob table and likely introducing considerable overhead. first possible solution would be to mark blobs with a serial numbers on each sp_ensure_bid call, even if it finds it in table. then garbage blob collector could just filter out ones that were touched after it have started working. unfortunately this adds overhead of writinng data into database. another solution is to do a garbage collection in mark & sweep style -- first mark all objects white, then go through the table and mark reachable black. at same time, if sp_ensure_bid sees white blob, it marks it black too. then in final stage delete all white objects. a race condition during sweeping stage will be handled by postgresql's transactions -- if conflict happens, one of transactions will fail and would be restarted. disadvatage of this solution is that it will require large amounts of writing during collection. however it also does not require any temporary storage and works entirely on database side, and sp_ensure_bid performance is not impacted when no collection is going on. and totally different approach would be to delete blobs as soon as they get unused, via triggers or something. RS> Secondly, there's the possibility that somebody could put a bid in, RS> say, a serialized list. i think postmodern backend itself never does this, and as blobs are internal to backend, neither should users mess with blobs. RS> Beyond those, though, in the normal case I am correct to assume that a RS> blob entry can be considered totally unused if not referred to in RS> either slots or any tree? i guess so. blob ids might be also temporarily kept in memory, but only within a single transaction, so that shouldn't be an issue. neither blob ids are cached. From yarek.kowalik at gmail.com Fri Dec 12 20:52:26 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Fri, 12 Dec 2008 12:52:26 -0800 Subject: [elephant-devel] Is it safe to use the same elephant store in two different processes? In-Reply-To: References: Message-ID: I just finished some tests and I was able to connect to the same BDB from two different SBCL processes. I was able to create objects on one side and retrieve on the other. So Elephant seems fine. I can only conclude that's something is amiss with Weblocks. I'll look into that now. Thanks for all your input and suggestions. Yarek On Thu, Dec 11, 2008 at 4:42 PM, Ian Eslick wrote: > Multiple lisp processes (in a shared memory environment) should be > safe, but I'm not sure if it's tested (anyone here done this?). > > I believe they have to use the same BDB environment, so you may need > to do some checking on the proper open-store arguments to join vs. > create an environment. Some defaults in weblocks or elephant may > interfere with this. bdb-controller.lisp - open-controller definition > shows you what arguments are passed to BDB when it is opened. > > Regardless, please upgrade to BDB 4.7. Most of us using unstable are > on 4.6 or 4.7 now. I'd rather not track down issues associated with > non-compatible upgrades (it should work, but testing coverage is > getting tougher with all the system combinations of backends, BDB > versions, DB versions, etc). > > Ian > > On Dec 11, 2008, at 5:23 PM, Yarek Kowalik wrote: > > > I'm trying to access BDB 4.5 backed elephant store (elephant- > > unstable) from two different lisp processes using the elephant > > package. Is this a safe thing to do? > > > > Yarek > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From clinton at unknownlamer.org Sat Dec 13 23:11:11 2008 From: clinton at unknownlamer.org (Clinton Ebadi) Date: Sat, 13 Dec 2008 18:11:11 -0500 Subject: [elephant-devel] Problems with Elephant on Clozure CL Message-ID: <874p176580.fsf@unknownlamer.org> Greetings, I am attempting to use Elephant (-stable or -unstable; it fails on both in the same way) with BDB (4.5, 4.6, and 4.7 also all fail the same way) on Clozure CL (1.2 or 1.3-trunk) linux_x86-64. The main portion of Elephant builds fine, but OPEN-STORE fails when opening a :BDB store when loading berekely-db-constant.lisp with `Package DB-BDB-C4[567] does not exist` (the [567] being the same as the version of BDB I'm attempting to use). If I nuke the fasl cache and then manually (clc:clc-require :ele-bdb) after loading Elephant things work fine, but then OPEN-STORE fails again with: ? (elephant:open-store '(:bdb "/home/clinton/local/var/beesknees/bdb/")) > Error: Undefined function #:G13940 called with arguments (# # # 2 20 # 0 10 0 # #) . > While executing: #, in process listener(1). Backtrace: *(7FE3D6466618) : 0 (FUNCALL #'#<#> #) 621 (7FE3D6466790) : 1 (%CALL-NEXT-METHOD #) 1061 (7FE3D6466810) : 2 (FUNCALL #'#<#> #) 37 (7FE3D6466830) : 3 (%%STANDARD-COMBINED-METHOD-DCODE (# #) 17577066155281) 781 (7FE3D6466898) : 5 (FUNCALL #'#<#> #) 53 (7FE3D64668B8) : 6 (FUNCALL #'#<#> # :RECOVER T :RECOVER-FATAL NIL :THREAD T :REGISTER T :DEADLOCK-DETECT T :MULTIVERSION NIL :CACHE-SIZE 20971520 :MAX-LOCKS 2000 :MAX-OBJECTS 2000) 1461 (7FE3D64669C0) : 7 (%%BEFORE-AND-AFTER-COMBINED-METHOD-DCODE (NIL # . 17577066155344)) 861 (7FE3D6466A30) : 8 (%%STANDARD-COMBINED-METHOD-DCODE (NIL (#<#>) #) 17577066155344) 269 (7FE3D6466A90) : 10 (OPEN-STORE (:BDB "/home/clinton/local/var/beesknees/bdb/")) 253 (7FE3D6466AC8) : 11 (CALL-CHECK-REGS ELEPHANT:OPEN-STORE (:BDB "/home/clinton/local/var/beesknees/bdb/")) 229 (7FE3D6466B00) : 12 (TOPLEVEL-EVAL (ELEPHANT:OPEN-STORE '#) NIL) 733 (7FE3D6466BA0) : 13 (READ-LOOP :INPUT-STREAM # :OUTPUT-STREAM # :BREAK-LEVEL 0 :PROMPT-FUNCTION #) 1821 (7FE3D6466DD8) : 14 (TOPLEVEL-LOOP) 109 (7FE3D6466E08) : 15 (FUNCALL #'#<(:INTERNAL (TOPLEVEL-FUNCTION (CCL::LISP-DEVELOPMENT-SYSTEM T)))>) 101 (7FE3D6466E20) : 16 (FUNCALL #'#<(:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS)>) 645 (7FE3D6466EB8) : 17 (RUN-PROCESS-INITIAL-FORM # (#)) 717 (7FE3D6466F48) : 18 (FUNCALL #'#<(:INTERNAL CCL::%PROCESS-PRESET-INTERNAL)> # (#)) 389 (7FE3D6466F98) : 19 (FUNCALL #'#<(:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION)>) 293 The same test works fine on SBCL. Any ideas? Given the problem with autoloading :ELE-BDB when OPEN-STORE is called leads me to believe something is wrong with the asdf system, but I can't see why it would fail to work properly. -- ntk is currently using "telnet fyodor 25" to send email From wkerr at cs.arizona.edu Mon Dec 15 15:17:13 2008 From: wkerr at cs.arizona.edu (Wesley Kerr) Date: Mon, 15 Dec 2008 08:17:13 -0700 Subject: [elephant-devel] Problems with Elephant on Clozure CL In-Reply-To: <874p176580.fsf@unknownlamer.org> References: <874p176580.fsf@unknownlamer.org> Message-ID: <333e2fc20812150717r6d03bfealaa12daf7a4b1f1b0@mail.gmail.com> I found this not helpful when I asked a similar question (It came from R. Matthew Emerson) : At the top of src/db-bdb/berkeley-db.lisp is a declaim form that declaims a bunch of functions inline. (declaim #-elephant-without-optimize (optimize (speed 3) (safety 1) (debug 1) (space 1)) #-lispworks (inline %db-get-key-buffered db-get-key-buffered %db-get-buffered db-get-buffered db-get %db-put-buffered db-put-buffered ...)) Make that #-lispworks be #-(or lispworks ccl) and that should get you going. Long explanation: Consider the following DEF-FUNCTION form: (def-function ("db_get_raw" %db-get-key-buffered) ((db :pointer-void) (txn :pointer-void) ... (result-size :unsigned-int :out)) :returning :int) This macroexpands into something like (progn (defun #:G0 (arg0 arg1 ...) ...) (defun %db-get-key-buffered () (values (#:G0 arg0 arg1 ...) ...))) If %DB-GET-KEY-BUFFERED is declaimed INLINE, we save its lambda expression, which includes the gensym. When the lambda expression in substituted into a caller defined in some other file, it won't be referencing the same #:G0, and you get undefined function error. (Inlining across files used to be disabled, at least until several months ago, so if this cropped up recently, that might be why.) [from Gary Byers:] SBCL seems to handle a toplevel (DECLAIM (INLINE FOO)) (or the combination of the declamation and a subsequent DEFUN) as something like: (eval-when (:compile-toplevel) (save-lambda-definition (lambda-definition-for 'foo) *env*)) (eval-when (:load-toplevel) (save-global-lambda-definition (preprocessed-definition-for foo))) where the "preprocessed definition" appears to be fully macroexpanded (doesn't contain references to macros that may have been defined at compile time but might not be defined at load time.) That could be nice functionality to have, but there's no way that the load-time inline-expansion and the compile-time inline-expansion can be equivalent when uninterned symbols are involved. Once we've crossed a point where we can't guarantee that, I think that we're pretty much into an area where code is depending on non-portable implementation artifacts. Hope this helps. On Sat, Dec 13, 2008 at 4:11 PM, Clinton Ebadi wrote: > > Greetings, > > I am attempting to use Elephant (-stable or -unstable; it fails on both > in the same way) with BDB (4.5, 4.6, and 4.7 also all fail the same way) > on Clozure CL (1.2 or 1.3-trunk) linux_x86-64. > > The main portion of Elephant builds fine, but OPEN-STORE fails when > opening a :BDB store when loading berekely-db-constant.lisp with > `Package DB-BDB-C4[567] does not exist` (the [567] being the same as the > version of BDB I'm attempting to use). If I nuke the fasl cache and then > manually (clc:clc-require :ele-bdb) after loading Elephant things work > fine, but then OPEN-STORE fails again with: > > ? (elephant:open-store '(:bdb "/home/clinton/local/var/beesknees/bdb/")) >> Error: Undefined function #:G13940 called with arguments (# # # 2 20 # 0 10 0 # #) . >> While executing: #, in process listener(1). > > Backtrace: > > *(7FE3D6466618) : 0 (FUNCALL #'#<#> #) 621 > (7FE3D6466790) : 1 (%CALL-NEXT-METHOD #) 1061 > (7FE3D6466810) : 2 (FUNCALL #'#<#> #) 37 > (7FE3D6466830) : 3 (%%STANDARD-COMBINED-METHOD-DCODE (# #) 17577066155281) 781 > (7FE3D6466898) : 5 (FUNCALL #'#<#> #) 53 > (7FE3D64668B8) : 6 (FUNCALL #'#<#> # :RECOVER T :RECOVER-FATAL NIL :THREAD T :REGISTER T :DEADLOCK-DETECT T :MULTIVERSION NIL :CACHE-SIZE 20971520 :MAX-LOCKS 2000 :MAX-OBJECTS 2000) 1461 > (7FE3D64669C0) : 7 (%%BEFORE-AND-AFTER-COMBINED-METHOD-DCODE (NIL # . 17577066155344)) 861 > (7FE3D6466A30) : 8 (%%STANDARD-COMBINED-METHOD-DCODE (NIL (#<#>) #) 17577066155344) 269 > (7FE3D6466A90) : 10 (OPEN-STORE (:BDB "/home/clinton/local/var/beesknees/bdb/")) 253 > (7FE3D6466AC8) : 11 (CALL-CHECK-REGS ELEPHANT:OPEN-STORE (:BDB "/home/clinton/local/var/beesknees/bdb/")) 229 > (7FE3D6466B00) : 12 (TOPLEVEL-EVAL (ELEPHANT:OPEN-STORE '#) NIL) 733 > (7FE3D6466BA0) : 13 (READ-LOOP :INPUT-STREAM # :OUTPUT-STREAM # :BREAK-LEVEL 0 :PROMPT-FUNCTION #) 1821 > (7FE3D6466DD8) : 14 (TOPLEVEL-LOOP) 109 > (7FE3D6466E08) : 15 (FUNCALL #'#<(:INTERNAL (TOPLEVEL-FUNCTION (CCL::LISP-DEVELOPMENT-SYSTEM T)))>) 101 > (7FE3D6466E20) : 16 (FUNCALL #'#<(:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS)>) 645 > (7FE3D6466EB8) : 17 (RUN-PROCESS-INITIAL-FORM # (#)) 717 > (7FE3D6466F48) : 18 (FUNCALL #'#<(:INTERNAL CCL::%PROCESS-PRESET-INTERNAL)> # (#)) 389 > (7FE3D6466F98) : 19 (FUNCALL #'#<(:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION)>) 293 > > The same test works fine on SBCL. Any ideas? Given the problem with > autoloading :ELE-BDB when OPEN-STORE is called leads me to believe > something is wrong with the asdf system, but I can't see why it would > fail to work properly. > > -- > ntk is currently using "telnet fyodor 25" to send email > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > From rme at clozure.com Mon Dec 15 19:38:33 2008 From: rme at clozure.com (R. Matthew Emerson) Date: Mon, 15 Dec 2008 14:38:33 -0500 Subject: [elephant-devel] Problems with Elephant on Clozure CL In-Reply-To: <333e2fc20812150717r6d03bfealaa12daf7a4b1f1b0@mail.gmail.com> References: <874p176580.fsf@unknownlamer.org> <333e2fc20812150717r6d03bfealaa12daf7a4b1f1b0@mail.gmail.com> Message-ID: <5186DE6C-21E5-47B8-A830-07D27209E1D8@clozure.com> On Dec 15, 2008, at 10:17 AM, Wesley Kerr wrote: > I found this not helpful when I asked a similar question (It came from > R. Matthew Emerson) : I hope that was supposed to be "this note helpful" instead of "this not helpful". Another way to address the problem would be to fix UFFI so that a definition like (def-function ("db_get_raw" %db-get-key-buffered) ((db :pointer-void) (txn :pointer-void) (key array-or-pointer-char) (key-size :unsigned-int) (buffer array-or-pointer-char) (buffer-length :unsigned-int) (flags :unsigned-int) (result-size :unsigned-int :out)) :returning :int) would macroexpand into CCL-specific code like this (defun %db-get-key-buffered (db txn key key-size buffer buffer-length flags) (rlet ((result-size :unsigned)) (values (external-call "db_get_raw" :address db :address txn :address key ...) (pref result-size :unsigned)))) rather than the gensym-named stub and slightly higher-level wrapper around it. This way, you could inline %DB-GET-KEY-BUFFERED with no problem (although it's not clear at first glance how much sense it makes to inline something that does a possibly expensive database operation). > > At the top of src/db-bdb/berkeley-db.lisp is a declaim form that > declaims a bunch of functions inline. > > (declaim > #-elephant-without-optimize (optimize (speed 3) (safety 1) (debug 1) > (space 1)) > #-lispworks > (inline %db-get-key-buffered db-get-key-buffered > %db-get-buffered db-get-buffered db-get > %db-put-buffered db-put-buffered > ...)) > > Make that #-lispworks be #-(or lispworks ccl) and that should get you > going. > > Long explanation: > > Consider the following DEF-FUNCTION form: > > (def-function ("db_get_raw" %db-get-key-buffered) > ((db :pointer-void) > (txn :pointer-void) > ... > (result-size :unsigned-int :out)) > :returning :int) > > This macroexpands into something like > > (progn > (defun #:G0 (arg0 arg1 ...) > ...) > (defun %db-get-key-buffered () > (values (#:G0 arg0 arg1 ...) > ...))) > > If %DB-GET-KEY-BUFFERED is declaimed INLINE, we save its lambda > expression, which includes the gensym. When the lambda expression in > substituted into a caller defined in some other file, it won't be > referencing the same #:G0, and you get undefined function error. > > (Inlining across files used to be disabled, at least until several > months > ago, so if this cropped up recently, that might be why.) > > [from Gary Byers:] > > SBCL seems to handle a toplevel (DECLAIM (INLINE FOO)) (or the > combination > of the declamation and a subsequent DEFUN) as something like: > > (eval-when (:compile-toplevel) > (save-lambda-definition (lambda-definition-for 'foo) *env*)) > (eval-when (:load-toplevel) > (save-global-lambda-definition (preprocessed-definition-for foo))) > > where the "preprocessed definition" appears to be fully macroexpanded > (doesn't contain references to macros that may have been defined at > compile time but might not be defined at load time.) That could be > nice > functionality to have, but there's no way that the load-time > inline-expansion and the compile-time inline-expansion can be > equivalent > when uninterned symbols are involved. Once we've crossed a point > where > we can't guarantee that, I think that we're pretty much into an area > where code is depending on non-portable implementation artifacts. > > Hope this helps. > > On Sat, Dec 13, 2008 at 4:11 PM, Clinton Ebadi > wrote: >> >> Greetings, >> >> I am attempting to use Elephant (-stable or -unstable; it fails on >> both >> in the same way) with BDB (4.5, 4.6, and 4.7 also all fail the same >> way) >> on Clozure CL (1.2 or 1.3-trunk) linux_x86-64. >> >> The main portion of Elephant builds fine, but OPEN-STORE fails when >> opening a :BDB store when loading berekely-db-constant.lisp with >> `Package DB-BDB-C4[567] does not exist` (the [567] being the same >> as the >> version of BDB I'm attempting to use). If I nuke the fasl cache and >> then >> manually (clc:clc-require :ele-bdb) after loading Elephant things >> work >> fine, but then OPEN-STORE fails again with: >> >> ? (elephant:open-store '(:bdb "/home/clinton/local/var/beesknees/ >> bdb/")) >>> Error: Undefined function #:G13940 called with arguments (#>> Foreign Pointer #x227F540> # #>> Pointer #x2282200> 2 20 # 0 10 0 #>> Foreign Pointer #1=[stack-allocated] #x4046ADD0> #>> Pointer #1# #x4046AD90>) . >>> While executing: #>> BDB::BDB-STORE-CONTROLLER)>, in process listener(1). >> >> Backtrace: >> >> *(7FE3D6466618) : 0 (FUNCALL #'#<#> ELEPHANT::DATABASE-VERSION (DB-BDB::BDB-STORE-CONTROLLER)>> #> STORE-CONTROLLER /home/clinton/local/var/beesknees/bdb/>) 621 >> (7FE3D6466790) : 1 (%CALL-NEXT-METHOD #> allocated] #x4046AD90>) 1061 >> (7FE3D6466810) : 2 (FUNCALL #'#<#> ELEPHANT::DATABASE-VERSION :AROUND (T)>> #> home/clinton/local/var/beesknees/bdb/>) 37 >> (7FE3D6466830) : 3 (%%STANDARD-COMBINED-METHOD-DCODE (#> METHOD ELEPHANT::DATABASE-VERSION :AROUND #> #> ELEPHANT::DATABASE-VERSION #>) 17577066155281) 781 >> (7FE3D6466898) : 5 (FUNCALL #'#<#> ELEPHANT::INITIALIZE-SERIALIZER (ELEPHANT:STORE-CONTROLLER)>> #> STORE-CONTROLLER /home/clinton/local/var/beesknees/bdb/>) 53 >> (7FE3D64668B8) : 6 (FUNCALL #'#<#> CONTROLLER (DB-BDB::BDB-STORE-CONTROLLER)>> #> home/clinton/local/var/beesknees/bdb/> :RECOVER T :RECOVER-FATAL >> NIL :THREAD T :REGISTER T :DEADLOCK-DETECT T :MULTIVERSION >> NIL :CACHE-SIZE 20971520 :MAX-LOCKS 2000 :MAX-OBJECTS 2000) 1461 >> (7FE3D64669C0) : 7 (%%BEFORE-AND-AFTER-COMBINED-METHOD-DCODE (NIL >> # . 17577066155344)) 861 >> (7FE3D6466A30) : 8 (%%STANDARD-COMBINED-METHOD-DCODE (NIL (#<#>) >> #) 17577066155344) 269 >> (7FE3D6466A90) : 10 (OPEN-STORE (:BDB "/home/clinton/local/var/ >> beesknees/bdb/")) 253 >> (7FE3D6466AC8) : 11 (CALL-CHECK-REGS ELEPHANT:OPEN-STORE (:BDB "/ >> home/clinton/local/var/beesknees/bdb/")) 229 >> (7FE3D6466B00) : 12 (TOPLEVEL-EVAL (ELEPHANT:OPEN-STORE '#) NIL) 733 >> (7FE3D6466BA0) : 13 (READ-LOOP :INPUT-STREAM #> *TERMINAL-IO* #x300040EEA30D> :OUTPUT-STREAM #> *TERMINAL-IO* #x300040EEA1AD> :BREAK-LEVEL 0 :PROMPT-FUNCTION >> #> #x30004054DB7F>) 1821 >> (7FE3D6466DD8) : 14 (TOPLEVEL-LOOP) 109 >> (7FE3D6466E08) : 15 (FUNCALL #'#<(:INTERNAL (TOPLEVEL-FUNCTION >> (CCL::LISP-DEVELOPMENT-SYSTEM T)))>) 101 >> (7FE3D6466E20) : 16 (FUNCALL #'#<(:INTERNAL CCL::MAKE-MCL-LISTENER- >> PROCESS)>) 645 >> (7FE3D6466EB8) : 17 (RUN-PROCESS-INITIAL-FORM #> listener(1) [Active] #x300040E9B74D> (#> #x300040EE93CF>)) 717 >> (7FE3D6466F48) : 18 (FUNCALL #'#<(:INTERNAL CCL::%PROCESS-PRESET- >> INTERNAL)> # >> (#)) 389 >> (7FE3D6466F98) : 19 (FUNCALL #'#<(:INTERNAL CCL::THREAD-MAKE- >> STARTUP-FUNCTION)>) 293 >> >> The same test works fine on SBCL. Any ideas? Given the problem with >> autoloading :ELE-BDB when OPEN-STORE is called leads me to believe >> something is wrong with the asdf system, but I can't see why it would >> fail to work properly. >> >> -- >> ntk is currently using "telnet fyodor 25" to send >> email >> >> _______________________________________________ >> elephant-devel site list >> elephant-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/elephant-devel >> > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From elliottslaughter at gmail.com Tue Dec 16 07:03:45 2008 From: elliottslaughter at gmail.com (Elliott Slaughter) Date: Mon, 15 Dec 2008 23:03:45 -0800 Subject: [elephant-devel] Windows/SBCL bug (and partial fix) when compiling DLLs Message-ID: <42c0ab790812152303u4b0139b9h39471235164928b9@mail.gmail.com> Hi, I just encountered a peculiarity with the perform method for elephant-c-source files, which causes a clean build of elephant-unstable on Windows/SBCL fails with the following ; $ gcc -mno-cygwin -mwindows -Wall -c -std=c99 "C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.c" ; $ dlltool -z "C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.def" --export-all-symbols -e exports.o -l "C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.lib" "C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.o" dlltool: Unable to open object file: C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.o The first command assume the working directory is "C:\Program Files\asdf\elephant-unstable\src\memutil\", which is done in ACL and Lispworks by explicitly specifying a directory option with the run command. But SBCL, and run-shell-command specifically, seem to have no option for doing this. So the files end up in some unknown place (which most definitely isn't the memutil directory). I tried specifying the output files explicitly, which almost works, except dlltool blows up when receiving a path with a space in it, even when it is in quotes. ; $ gcc -mno-cygwin -mwindows -Wall -c -std=c99 "C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.c" -o "C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.o" ; $ dlltool -z "C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.def" --export-all-symbols -e "C:\Program Files\asdf\elephant-unstable\src\memutil\exports.o" -l "C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.lib" "C:\Program Files\asdf\elephant-unstable\src\memutil\libmemutil.o" Assembler messages: Error: can't open Files\asdf\elephant-unstable\src\memutil\exports.o for reading: No such file or directory dlltool: as exited with status 1 So the attached patch fixes Windows/SBCL building the dlls from c source, when the directory name contains no spaces. I would NOT suggest applying it to the main repository, but I would like to get comments on how to fix this problem, if any. Thanks. Any suggestions would be appreciated. P.S. I'm also curious why Windows requires 3 commands to build a dll in the first place, whereas Linux uses only one. -- Elliott Slaughter "Any road followed precisely to its end leads precisely nowhere." - Frank Herbert -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: elephant_asd_-partial-fix-for-windows_sbcl_-apply-with-care_.dpatch Type: application/octet-stream Size: 20604 bytes Desc: not available URL: From clinton at unknownlamer.org Tue Dec 16 19:16:00 2008 From: clinton at unknownlamer.org (Clinton Ebadi) Date: Tue, 16 Dec 2008 14:16:00 -0500 Subject: [elephant-devel] Problems with Elephant on Clozure CL In-Reply-To: <333e2fc20812150717r6d03bfealaa12daf7a4b1f1b0@mail.gmail.com> (Wesley Kerr's message of "Mon, 15 Dec 2008 08:17:13 -0700") References: <874p176580.fsf@unknownlamer.org> <333e2fc20812150717r6d03bfealaa12daf7a4b1f1b0@mail.gmail.com> Message-ID: <87vdtkc4nj.fsf@unknownlamer.org> "Wesley Kerr" writes: > I found this not helpful when I asked a similar question (It came from > R. Matthew Emerson) : > > At the top of src/db-bdb/berkeley-db.lisp is a declaim form that > declaims a bunch of functions inline. > > (declaim > #-elephant-without-optimize (optimize (speed 3) (safety 1) (debug 1) (space 1)) > #-lispworks > (inline %db-get-key-buffered db-get-key-buffered > %db-get-buffered db-get-buffered db-get > %db-put-buffered db-put-buffered > ...)) > > Make that #-lispworks be #-(or lispworks ccl) and that should get you > going. Thanks much, that fixed it for me. Now to make arnesi call/cc work properly... -- Mike: I WAS NOT MICROWAVED. From hugo_duncan at yahoo.com Thu Dec 18 14:26:10 2008 From: hugo_duncan at yahoo.com (Hugo Duncan) Date: Thu, 18 Dec 2008 09:26:10 -0500 Subject: [elephant-devel] Problems with elephant on sbcl using postmodern Message-ID: Hi, I am attempting to use Elephant (from clbuild) on SBCL (1.0.23.49 and 1.0.17) on OSX with postmodern and postgresql 8.3. OPEN-STORE is failing in INIT-ROOT, as below. Any help appreciated. Hugo The value #.(SB-SYS:INT-SAP #X00102300) is not of type (SB-ALIEN:ALIEN (* (SB-ALIEN:UNSIGNED 8))). [Condition of type TYPE-ERROR] Backtrace: 0: (ELEPHANT-MEMUTIL::WRITE-INT32 #.(SB-SYS:INT-SAP #X00102300) 0 1)[:EXTERNAL] 1: ((LABELS ELEPHANT-SERIALIZER2::%SERIALIZE) #) 2: (ELEPHANT-SERIALIZER2::SERIALIZE ..) 3: (DB-POSTMODERN::SERIALIZE-TO-POSTMODERN # #) 4: (DB-POSTMODERN::POSTGRES-FORMAT # :OBJECT) 5: ((LAMBDA ())) 6: ((SB-PCL::FAST-METHOD ELEPHANT::EXECUTE-TRANSACTION (DB-POSTMODERN::POSTMODERN-STORE-CONTROLLER T)) ..)[:EXTERNAL] 7: ((SB-PCL::FAST-METHOD (SETF DB-POSTMODERN::INTERNAL-GET-VALUE) (T T DB-POSTMODERN::PM-BTREE)) ..) 8: ((SB-PCL::FAST-METHOD ELEPHANT::PERSISTENT-SLOT-WRITER (DB-POSTMODERN::POSTMODERN-STORE-CONTROLLER T T T)) ..) 9: (SB-PCL::SET-SLOT-VALUE # DB-POSTMODERN::INDICES #) 10: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-PCL::.ARG1. SB-INT:&MORE SB-PCL::.DFUN-MORE-CONTEXT. SB-PCL::.DFUN-MORE-COUNT.)) ..) 11: ((SB-PCL::FAST-METHOD SHARED-INITIALIZE :AROUND (PERSISTENT-OBJECT T)) # # # #)[:EXTERNAL] 12: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-INT:&MORE SB-PCL::.DFUN-MORE-CONTEXT. SB-PCL::.DFUN-MORE-COUNT.)) ..) 13: ((SB-PCL::FAST-METHOD MAKE-INSTANCE (CLASS)) # # #)[:EXTERNAL] 14: ((FLET DB-POSTMODERN::INIT-ROOT)) 15: ((LAMBDA ())) 16: (DB-POSTMODERN::EXECUTE-TRANSACTION-ONE-TRY # # NIL) 17: ((SB-PCL::FAST-METHOD ELEPHANT::EXECUTE-TRANSACTION (DB-POSTMODERN::POSTMODERN-STORE-CONTROLLER T)) ..)[:EXTERNAL] 18: ((SB-PCL::FAST-METHOD ELEPHANT::OPEN-CONTROLLER (DB-POSTMODERN::POSTMODERN-STORE-CONTROLLER)) ..)[:EXTERNAL] 19: ((SB-PCL::FAST-METHOD ELEPHANT::OPEN-CONTROLLER :AROUND (DB-POSTMODERN::POSTMODERN-STORE-CONTROLLER)) ..)[:EXTERNAL] 20: (OPEN-STORE (:POSTMODERN (:POSTGRESQL "127.0.0.1" "elepm" "postgres" "")))[:EXTERNAL] 21: (DO-BACKEND-TESTS (:POSTMODERN (:POSTGRESQL "127.0.0.1" "elepm" "postgres" ""))) __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From killerstorm at newmail.ru Thu Dec 18 17:24:55 2008 From: killerstorm at newmail.ru (Alex Mizrahi) Date: Thu, 18 Dec 2008 19:24:55 +0200 Subject: [elephant-devel] backend usage poll Message-ID: hello i've got curious what elephant backends do people use, so i've made an online poll: http://www.misterpoll.com/polls/373489 it has some other interesting questions too. please vote if you're using elephant, or even if you're only evaluating it. thanks. From hugo_duncan at yahoo.com Fri Dec 19 04:19:49 2008 From: hugo_duncan at yahoo.com (Hugo Duncan) Date: Thu, 18 Dec 2008 20:19:49 -0800 (PST) Subject: [elephant-devel] Problems with elephant on sbcl using postmodern References: Message-ID: <346628.70035.qm@web56204.mail.re3.yahoo.com> That was painful. clbuild includes a dependency for cffi for elephant, but cffi-uffi-compat doesn't suffice. Ensuring uffi was loaded got everything running for me. Hugo Duncan wrote: > I am attempting to use Elephant (from clbuild) on SBCL (1.0.23.49 and > 1.0.17) on OSX with postmodern and postgresql 8.3. > > OPEN-STORE is failing in INIT-ROOT, as below. From franks-muc at web.de Fri Dec 19 15:58:34 2008 From: franks-muc at web.de (Frank Schorr) Date: Fri, 19 Dec 2008 16:58:34 +0100 Subject: [elephant-devel] =?iso-8859-15?q?Windows/SBCL_bug_=28and_partial_?= =?iso-8859-15?q?fix=29_when_compiling_DLLs?= Message-ID: <1477612132@web.de> > but I would like to get comments on how to fix this problem, if any. > I gave up trying windows + sbcl. It seems to be certain that multi threading will never be working with this combination. So I'm using win + Lispworks + ele 0.9. However backends using a dll, like bdb, hang if used from multiple threads. I'm using Postgres through a port for that reason. I was not able to install more recent versions of ele, but it appears that you were successful in this respect. Could you share some of this magic ? Frank. _______________________________________________________________________ T?glich 1.000.000 Euro gewinnen! Jetzt kostenlos WEB.DE MillionenKlick spielen! https://millionenklick.web.de/?mc=mail at footer.mklick@home From elliottslaughter at gmail.com Fri Dec 19 21:43:05 2008 From: elliottslaughter at gmail.com (Elliott Slaughter) Date: Fri, 19 Dec 2008 13:43:05 -0800 Subject: [elephant-devel] Windows/SBCL bug (and partial fix) when compiling DLLs In-Reply-To: <1477612132@web.de> References: <1477612132@web.de> Message-ID: <42c0ab790812191343u183fced0n3c4d89ce2f3df9f1@mail.gmail.com> On Fri, Dec 19, 2008 at 7:58 AM, Frank Schorr wrote: > > > but I would like to get comments on how to fix this problem, if any. > > > > I gave up trying windows + sbcl. It seems to be certain that multi > threading will never be working with this combination. > Elephant itself works without multi-threading, and my application doesn't particularly need multi-threading, so this is acceptable for me. So I'm using win + Lispworks + ele 0.9. However backends using a dll, like > bdb, hang if used from multiple threads. I'm using Postgres through a port > for that reason. > I was not able to install more recent versions of ele, but it appears that > you were successful in this respect. Could you share some of this magic ? What exactly do you mean by "not able to install"? I've been able to get Windows + SBCL + the newest elephant-unstable to work with the bdb backend (single-threaded), although I haven't tried any of the other backends, or with multiple threads. What I am mainly trying to fix right now is automatic compilation of the dll files under SBCL. (See my previous email for details.) -- Elliott Slaughter "Any road followed precisely to its end leads precisely nowhere." - Frank Herbert -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Fri Dec 19 22:08:26 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Fri, 19 Dec 2008 17:08:26 -0500 Subject: [elephant-devel] Problems with elephant on sbcl using postmodern In-Reply-To: <346628.70035.qm@web56204.mail.re3.yahoo.com> References: <346628.70035.qm@web56204.mail.re3.yahoo.com> Message-ID: Sorry for the confusion with clbuild - I don't think any of us were using it when we last updated the elephant build procedure. Is there something we can do to avoid this in the future? On Dec 18, 2008, at 11:19 PM, Hugo Duncan wrote: > That was painful. clbuild includes a dependency for cffi for > elephant, but cffi-uffi-compat doesn't suffice. Ensuring uffi was > loaded got everything running for me. > > Hugo Duncan wrote: > >> I am attempting to use Elephant (from clbuild) on SBCL (1.0.23.49 and >> 1.0.17) on OSX with postmodern and postgresql 8.3. >> >> OPEN-STORE is failing in INIT-ROOT, as below. > > > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From hugo_duncan at yahoo.com Sat Dec 20 03:12:04 2008 From: hugo_duncan at yahoo.com (Hugo Duncan) Date: Fri, 19 Dec 2008 19:12:04 -0800 (PST) Subject: [elephant-devel] Problems with elephant on sbcl using postmodern References: <346628.70035.qm@web56204.mail.re3.yahoo.com> Message-ID: <199530.62830.qm@web56201.mail.re3.yahoo.com> Ian Eslick wrote: > Sorry for the confusion with clbuild - I don't think any of us were > using it when we last updated the elephant build procedure. Is there > something we can do to avoid this in the future? Not sure. I would have had problems even if I had installed outside of clbuild, as cffi would have provided the uffi.asd file (I had to manually unlink this and relink to uffi's own uffi.asd). > On Dec 18, 2008, at 11:19 PM, Hugo Duncan wrote: > > > That was painful. clbuild includes a dependency for cffi for > > elephant, but cffi-uffi-compat doesn't suffice. Ensuring uffi was > > loaded got everything running for me. > > > > Hugo Duncan wrote: > > > >> I am attempting to use Elephant (from clbuild) on SBCL (1.0.23.49 and > >> 1.0.17) on OSX with postmodern and postgresql 8.3. > >> > >> OPEN-STORE is failing in INIT-ROOT, as below. From eslick at media.mit.edu Sat Dec 20 15:49:21 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Sat, 20 Dec 2008 10:49:21 -0500 Subject: [elephant-devel] Problems with elephant on sbcl using postmodern In-Reply-To: <199530.62830.qm@web56201.mail.re3.yahoo.com> References: <346628.70035.qm@web56204.mail.re3.yahoo.com> <199530.62830.qm@web56201.mail.re3.yahoo.com> Message-ID: <0E72D34B-34E9-488E-9736-76AB573E3AF5@media.mit.edu> Has someone upgraded the uffi dependency to cffi? I may have missed that going by, but as much as I applaud moving to cffi - I don't think we want to do that until it's completely debugged... Ian On Dec 19, 2008, at 10:12 PM, Hugo Duncan wrote: > Ian Eslick wrote: > >> Sorry for the confusion with clbuild - I don't think any of us were >> using it when we last updated the elephant build procedure. Is there >> something we can do to avoid this in the future? > > Not sure. I would have had problems even if I had installed outside > of clbuild, as cffi would have provided the uffi.asd file (I had to > manually unlink this and relink to uffi's own uffi.asd). > >> On Dec 18, 2008, at 11:19 PM, Hugo Duncan wrote: >> >>> That was painful. clbuild includes a dependency for cffi for >>> elephant, but cffi-uffi-compat doesn't suffice. Ensuring uffi was >>> loaded got everything running for me. >>> >>> Hugo Duncan wrote: >>> >>>> I am attempting to use Elephant (from clbuild) on SBCL (1.0.23.49 >>>> and >>>> 1.0.17) on OSX with postmodern and postgresql 8.3. >>>> >>>> OPEN-STORE is failing in INIT-ROOT, as below. > > > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From sky at viridian-project.de Sat Dec 20 16:58:24 2008 From: sky at viridian-project.de (Leslie P. Polzer) Date: Sat, 20 Dec 2008 17:58:24 +0100 (CET) Subject: [elephant-devel] Problems with elephant on sbcl using postmodern In-Reply-To: <0E72D34B-34E9-488E-9736-76AB573E3AF5@media.mit.edu> References: <346628.70035.qm@web56204.mail.re3.yahoo.com> <199530.62830.qm@web56201.mail.re3.yahoo.com> <0E72D34B-34E9-488E-9736-76AB573E3AF5@media.mit.edu> Message-ID: <62234.88.73.195.191.1229792304.squirrel@mail.stardawn.org> > Has someone upgraded the uffi dependency to cffi? Issue 1: cffi provides an uffi.asd that will have priority over the real uffi.asd if you're unlucky. Issue 2: http://common-lisp.net/pipermail/clbuild-devel/2008-December/000351.html Not sure how we should approach his best... -- LinkedIn Profile: http://www.linkedin.com/in/polzer Xing Profile: https://www.xing.com/profile/LeslieP_Polzer Blog: http://blog.viridian-project.de/ From elliottslaughter at gmail.com Mon Dec 22 05:35:06 2008 From: elliottslaughter at gmail.com (Elliott Slaughter) Date: Sun, 21 Dec 2008 21:35:06 -0800 Subject: [elephant-devel] Optimization Message-ID: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> Hi, I am exploring Elephant/BDB as a backend for a video game I am writing. I have ignored performance considerations so far, but on some larger maps (around 100 objects), performance is abominably slow (around 5 fps). The same maps run about 10 times faster (about 50 fps) when using completely in-memory hash-tables. Based on profiling, it appears that the main bottleneck is persistent slot lookup. I remember reading that Elephant reads from file on every slot read, which could explain this result. Are cached slots usable yet (at least in a single-threaded situation)? When I use ":cached t" in my slot definitions, I get errors. Any other advice about optimization would be appreciated. Thanks. -- Elliott Slaughter "Any road followed precisely to its end leads precisely nowhere." - Frank Herbert -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Mon Dec 22 14:13:52 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Mon, 22 Dec 2008 09:13:52 -0500 Subject: [elephant-devel] Optimization In-Reply-To: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> Message-ID: <401F3186-55E3-4356-8583-D67EC1551467@media.mit.edu> Which backend are you using? Sent from my iPhone On Dec 22, 2008, at 12:35 AM, "Elliott Slaughter" wrote: > Hi, > > I am exploring Elephant/BDB as a backend for a video game I am > writing. I have ignored performance considerations so far, but on > some larger maps (around 100 objects), performance is abominably > slow (around 5 fps). The same maps run about 10 times faster (about > 50 fps) when using completely in-memory hash-tables. > > Based on profiling, it appears that the main bottleneck is > persistent slot lookup. I remember reading that Elephant reads from > file on every slot read, which could explain this result. > > Are cached slots usable yet (at least in a single-threaded > situation)? When I use ":cached t" in my slot definitions, I get > errors. > > Any other advice about optimization would be appreciated. > > Thanks. > > -- > Elliott Slaughter > > "Any road followed precisely to its end leads precisely nowhere." - > Frank Herbert > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From elliottslaughter at gmail.com Mon Dec 22 18:19:52 2008 From: elliottslaughter at gmail.com (Elliott Slaughter) Date: Mon, 22 Dec 2008 10:19:52 -0800 Subject: [elephant-devel] Optimization In-Reply-To: <401F3186-55E3-4356-8583-D67EC1551467@media.mit.edu> References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> <401F3186-55E3-4356-8583-D67EC1551467@media.mit.edu> Message-ID: <42c0ab790812221019w177fa39i4caa43f088378bf3@mail.gmail.com> This is using the BDB backend. On Mon, Dec 22, 2008 at 6:13 AM, Ian Eslick wrote: > Which backend are you using? > > Sent from my iPhone > > On Dec 22, 2008, at 12:35 AM, "Elliott Slaughter" < > elliottslaughter at gmail.com > > wrote: > > > Hi, > > > > I am exploring Elephant/BDB as a backend for a video game I am > > writing. I have ignored performance considerations so far, but on > > some larger maps (around 100 objects), performance is abominably > > slow (around 5 fps). The same maps run about 10 times faster (about > > 50 fps) when using completely in-memory hash-tables. > > > > Based on profiling, it appears that the main bottleneck is > > persistent slot lookup. I remember reading that Elephant reads from > > file on every slot read, which could explain this result. > > > > Are cached slots usable yet (at least in a single-threaded > > situation)? When I use ":cached t" in my slot definitions, I get > > errors. > > > > Any other advice about optimization would be appreciated. > > > > Thanks. > > > > -- > > Elliott Slaughter > > > > "Any road followed precisely to its end leads precisely nowhere." - > > Frank Herbert > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > -- Elliott Slaughter "Any road followed precisely to its end leads precisely nowhere." - Frank Herbert -------------- next part -------------- An HTML attachment was scrubbed... URL: From sky at viridian-project.de Tue Dec 23 09:22:55 2008 From: sky at viridian-project.de (Leslie P. Polzer) Date: Tue, 23 Dec 2008 10:22:55 +0100 Subject: [elephant-devel] Optimization In-Reply-To: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> Message-ID: <20081223092255.GA17361@viridian-project.de> Dear Elliott, On Sun, Dec 21, 2008 at 09:35:06PM -0800, Elliott Slaughter wrote: > I am exploring Elephant/BDB as a backend for a video game I am writing. I > have ignored performance considerations so far, but on some larger maps > (around 100 objects), performance is abominably slow (around 5 fps). The > same maps run about 10 times faster (about 50 fps) when using completely > in-memory hash-tables. > > Based on profiling, it appears that the main bottleneck is persistent slot > lookup. I remember reading that Elephant reads from file on every slot read, > which could explain this result. I can confirm this (symptoms and cause). Luckily I have only one code path right now that is heavy enough to be a performance problem, and I can work around it using my own caching mechanism. When your program is single-threaded then you might be able to pull off something similar. Search for "dynamic scope memoization" on comp.lang.lisp. Leslie From yarek.kowalik at gmail.com Wed Dec 24 20:15:07 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Wed, 24 Dec 2008 12:15:07 -0800 Subject: [elephant-devel] Inherited slots don't get persisted Message-ID: I have two classes, one an "ephemeral" and one persistent. The persistent class inherits from the ephemeral class. When I copy slot values from an ephemeral instance to persistent instance, only the slots that are redefined in the persistent class get persisted properly, the other inherited slots are not, as if they were marked transient by default. Is this the correct behaviour? Is there a way to make all inherited slots persistent? In the example below only slots 'last-name' and 'username' get persisted when copying from 'site-user-ephemeral instance to 'site-user instance. Yarek (defclass site-user-ephemeral () ((first-name :accessor site-user-first-name :initarg :first-name :type string) (last-name :accessor site-user-last-name :initarg :last-name :type string) (username :accessor site-user-username :initarg :username :type string) (email :accessor site-user-email :initarg :email :type string) (password :accessor site-user-password :initarg :password :type string)) (:documentation "object for storing user data")) (defpclass site-user (site-user-ephemeral) ((last-name) (username :index t)) (:index t) (:documentation "persistent object for storing user data")) -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Wed Dec 24 22:28:23 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Wed, 24 Dec 2008 17:28:23 -0500 Subject: [elephant-devel] Inherited slots don't get persisted In-Reply-To: References: Message-ID: <8CF53338-C9B6-4DA7-B508-39DE0C570B8A@media.mit.edu> Yes, the standard object slots are 'transient' by default. Any subclass which is persistent inherits the transient semantics so what you are seeing is the right default behavior. The only way to make them persistent is to shadow the old definition with a new persistent definition in the subclass, so I'm not inclined to change the default behavior. You could look at adding an :persistent-inherit as a class option to do this. But I think that it is a bit dirty since now you can have one subclass with different slot behavior than another. You could also write a method which overrides one of the initialization phases for the new subclass specifically which upgrades the effective slot definitions so they are now persistent slot metaobjects. Ian On Dec 24, 2008, at 3:15 PM, Yarek Kowalik wrote: > I have two classes, one an "ephemeral" and one persistent. The > persistent class inherits from the ephemeral class. When I copy > slot values from an ephemeral instance to persistent instance, only > the slots that are redefined in the persistent class get persisted > properly, the other inherited slots are not, as if they were marked > transient by default. Is this the correct behaviour? Is there a > way to make all inherited slots persistent? > > In the example below only slots 'last-name' and 'username' get > persisted when copying from 'site-user-ephemeral instance to 'site- > user instance. > > Yarek > > (defclass site-user-ephemeral () > ((first-name > :accessor site-user-first-name > :initarg :first-name > :type string) > (last-name > :accessor site-user-last-name > :initarg :last-name > :type string) > (username > :accessor site-user-username > :initarg :username > :type string) > (email > :accessor site-user-email > :initarg :email > :type string) > (password > :accessor site-user-password > :initarg :password > :type string)) > (:documentation "object for storing user data")) > > (defpclass site-user (site-user-ephemeral) > ((last-name) > (username > :index t)) > (:index t) > (:documentation "persistent object for storing user data")) > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From eslick at media.mit.edu Wed Dec 24 22:31:53 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Wed, 24 Dec 2008 17:31:53 -0500 Subject: [elephant-devel] Optimization In-Reply-To: <20081223092255.GA17361@viridian-project.de> References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> <20081223092255.GA17361@viridian-project.de> Message-ID: <786E3BB7-708F-461E-A6FB-3B392614C4FD@media.mit.edu> A couple of quick thoughts on your problem: 1) Are you wrapping the critical sections of your code in with- transaction? This causes all database pages you touch to be cached within the body of the transaction. This avoids all 'sync' operations and transaction setup/teardown caused by a read/write slot operation that takes place outside a with-transaction body. 2) If you are doing this, have you increased your BDB cache size to ensure you can cache your key working set? 3) If yes, do you have significant contention between reads and writes for certain data structures that are causing transactions to be aborted. Perhaps you can refactor around this. Ian On Dec 23, 2008, at 4:22 AM, Leslie P. Polzer wrote: > > Dear Elliott, > > On Sun, Dec 21, 2008 at 09:35:06PM -0800, Elliott Slaughter wrote: > >> I am exploring Elephant/BDB as a backend for a video game I am >> writing. I >> have ignored performance considerations so far, but on some larger >> maps >> (around 100 objects), performance is abominably slow (around 5 >> fps). The >> same maps run about 10 times faster (about 50 fps) when using >> completely >> in-memory hash-tables. >> >> Based on profiling, it appears that the main bottleneck is >> persistent slot >> lookup. I remember reading that Elephant reads from file on every >> slot read, >> which could explain this result. > > I can confirm this (symptoms and cause). > > Luckily I have only one code path right now that is heavy > enough to be a performance problem, and I can work around it using > my own caching mechanism. > > When your program is single-threaded then you might be able > to pull off something similar. > > Search for "dynamic scope memoization" on comp.lang.lisp. > > Leslie > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From killerstorm at newmail.ru Sat Dec 27 10:48:46 2008 From: killerstorm at newmail.ru (Alex Mizrahi) Date: Sat, 27 Dec 2008 12:48:46 +0200 Subject: [elephant-devel] Optimization References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> Message-ID: ES> Are cached slots usable yet (at least in a single-threaded situation)? When I use ":cached t" in my slot definitions, I get errors. i postmodern backend rather than doing caching on a slot level we're doing it on btree level. that is, get-value and (setf get-value) functions do lookups/writes in a cache hash table ((btree-id, key) -> value), and this works pretty well, as everything gets cached. if underlying hash table is weak, it could automatically control its size. the tricky thing, however, is to do it in transaction-safe way. simpliest way to do it transaction-safe is to use cache only within a single transaction, and throw it out afterwards -- then you'll never have stale entries. that doesn't work well of you have lots of small transactions, though. db-postmodern has a caching mode where it does additional changes tracking to invalidate cache entries properly. but if you know that your application is single-threaded, for example, you can do it in easier way -- just keep using single cache as long as no transactions do rollback, if they do rollback you'll have to delete it. with multiple threads in single process you can handle this via relatively easy invalidation protocol, i guess. (i'm not sure how exactly, though, at moment, as i'm more familiar with MVCC concurrency model rather than bdb's lock based. maybe with lock based model you don't have to do much.) so, what i was going to say, adding caching for your specific application can be fairly easy -- you just need to instrument db-bdb code a little, adding just a few dozen of lines of code. so you can just try to do this, instead of relying on weird slot-caching protocol. From elliottslaughter at gmail.com Sun Dec 28 07:05:39 2008 From: elliottslaughter at gmail.com (Elliott Slaughter) Date: Sat, 27 Dec 2008 23:05:39 -0800 Subject: [elephant-devel] Optimization In-Reply-To: <786E3BB7-708F-461E-A6FB-3B392614C4FD@media.mit.edu> References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> <20081223092255.GA17361@viridian-project.de> <786E3BB7-708F-461E-A6FB-3B392614C4FD@media.mit.edu> Message-ID: <42c0ab790812272305k78d8ef1atb4c78df5b9624ee3@mail.gmail.com> There are several replies to my original query, so I will attempt to address all of them here. On Wed, Dec 24, 2008 at 2:31 PM, Ian Eslick wrote: > A couple of quick thoughts on your problem: > > 1) Are you wrapping the critical sections of your code in with- > transaction? This causes all database pages you touch to be cached > within the body of the transaction. This avoids all 'sync' operations > and transaction setup/teardown caused by a read/write slot operation > that takes place outside a with-transaction body. I currently wrap the contents of each frame update in with-transaction. Each frame consists of updating 100 objects on the screen (which by my estimation ought to be about 20 slot reads and 2 writes), so I ought to be doing about 2000 slot reads each frame and 200 writes. Wrapping the entire game loop in with-transaction increases performance by about 10%. I also tried (db-env-set-flags (controller-environment *store-controller*) 1 :txn-nosync t) as suggested in the manual, with a similar (about 10%) performance increase. 2) If you are doing this, have you increased your BDB cache size to > ensure you can cache your key working set? It should already be large enough, but just for kicks I increased it from 2 to 10 MB, resulting in a performance increase of about 3%. 3) If yes, do you have significant contention between reads and writes > for certain data structures that are causing transactions to be > aborted. Perhaps you can refactor around this. This is a single-threaded (and single-process) app. I don't see how I could possibly have contention for the db. Ian > And thanks to both Leslie and Alex for suggesting caching methods. I will probably try to implement something along the lines of Alex's suggestion, as that makes sense and should be simple enough (for the single threaded model, which is sufficient for me). Thanks again for all the help. I'll report back either when I have something working or I've run into another wall. -- Elliott Slaughter "Any road followed precisely to its end leads precisely nowhere." - Frank Herbert -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Sun Dec 28 18:32:05 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Sun, 28 Dec 2008 13:32:05 -0500 Subject: [elephant-devel] Optimization In-Reply-To: <42c0ab790812272305k78d8ef1atb4c78df5b9624ee3@mail.gmail.com> References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> <20081223092255.GA17361@viridian-project.de> <786E3BB7-708F-461E-A6FB-3B392614C4FD@media.mit.edu> <42c0ab790812272305k78d8ef1atb4c78df5b9624ee3@mail.gmail.com> Message-ID: Sounds like you'd like to perform 100k database ops per second which is fairly significant. What kind of data are you writing? With sufficient BDB cache, the nosync option, and a transaction wrapper I'm surprised it's 10x slower - I'd expect more like 4-5x - which is still too slow for you. You should try setting the txn- nosync option in the actual with-transaction wrapper - it may override the default flags on the environment. However, if you don't care about durability of the data, then the following comment definitely applies to you. For highly dynamic state that is unlikely to persist for more than a frame update, updating the store slots is serious overkill. The easiest solution is to use transient slots for dynamic state and do a periodic copy to persistent slots if you need to persist that state. This presumes that you don't care about transactional isolation for that transient state which in a single-threaded app sounds like it's fine. This discussion got me thinking about the caching protocol I was working on. After some exploration and education from folks here and elsewhere I see two models that make sense in the context of database operations: 1) Check-in, Check-out (Robert's DCM model). If your code enforces a policy of checking in and checking out prior to using the objects than you can do all the in-memory ops you want and do a checkin when you are done. (Maybe this could be done so that you can create an object that is fully cached and persistent storage and IDs are only allocated when you first check-in the object...this would address the issues being discussed on the weblocks list) So do we define this at the class level or the slot level? Is this policy inherited by subclasses? 2) Per-transaction caching. You read the value at the beginning of a transaction and then read the cached copy thereafter. Thoughts? Ian On Dec 28, 2008, at 2:05 AM, Elliott Slaughter wrote: > There are several replies to my original query, so I will attempt to > address all of them here. > > On Wed, Dec 24, 2008 at 2:31 PM, Ian Eslick > wrote: > A couple of quick thoughts on your problem: > > 1) Are you wrapping the critical sections of your code in with- > transaction? This causes all database pages you touch to be cached > within the body of the transaction. This avoids all 'sync' operations > and transaction setup/teardown caused by a read/write slot operation > that takes place outside a with-transaction body. > > I currently wrap the contents of each frame update in with- > transaction. Each frame consists of updating 100 objects on the > screen (which by my estimation ought to be about 20 slot reads and 2 > writes), so I ought to be doing about 2000 slot reads each frame and > 200 writes. > > Wrapping the entire game loop in with-transaction increases > performance by about 10%. I also tried > > (db-env-set-flags (controller-environment *store-controller*) 1 :txn- > nosync t) > > as suggested in the manual, with a similar (about 10%) performance > increase. > > 2) If you are doing this, have you increased your BDB cache size to > ensure you can cache your key working set? > > It should already be large enough, but just for kicks I increased it > from 2 to 10 MB, resulting in a performance increase of about 3%. > > 3) If yes, do you have significant contention between reads and writes > for certain data structures that are causing transactions to be > aborted. Perhaps you can refactor around this. > > This is a single-threaded (and single-process) app. I don't see how > I could possibly have contention for the db. > > Ian > > And thanks to both Leslie and Alex for suggesting caching methods. I > will probably try to implement something along the lines of Alex's > suggestion, as that makes sense and should be simple enough (for the > single threaded model, which is sufficient for me). > > > Thanks again for all the help. I'll report back either when I have > something working or I've run into another wall. > > -- > Elliott Slaughter > > "Any road followed precisely to its end leads precisely nowhere." - > Frank Herbert > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From eslick at media.mit.edu Sun Dec 28 22:09:57 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Sun, 28 Dec 2008 17:09:57 -0500 Subject: [elephant-devel] Optimization In-Reply-To: <42c0ab790812272305k78d8ef1atb4c78df5b9624ee3@mail.gmail.com> References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> <20081223092255.GA17361@viridian-project.de> <786E3BB7-708F-461E-A6FB-3B392614C4FD@media.mit.edu> <42c0ab790812272305k78d8ef1atb4c78df5b9624ee3@mail.gmail.com> Message-ID: I implemented a quick check-in/check-out protocol for persistent objects. I have to think a little more about concurrency as I'm sure there are some holes. I implemented a simple test loop which increments a local variable by the value in an instance slot. A standard-object slot allows about 50M updates-sec A persistent-object slot (inside a txn) is about 60k updates-sec A cached persistent-object slot is about 3M updates-sec The slot access protocol adds about 10x overhead per slot read but the cached access is about 50x faster than the pure persistent query. I'll see if there are some easy opportunities to speed things up. Ian On Dec 28, 2008, at 2:05 AM, Elliott Slaughter wrote: > There are several replies to my original query, so I will attempt to > address all of them here. > > On Wed, Dec 24, 2008 at 2:31 PM, Ian Eslick > wrote: > A couple of quick thoughts on your problem: > > 1) Are you wrapping the critical sections of your code in with- > transaction? This causes all database pages you touch to be cached > within the body of the transaction. This avoids all 'sync' operations > and transaction setup/teardown caused by a read/write slot operation > that takes place outside a with-transaction body. > > I currently wrap the contents of each frame update in with- > transaction. Each frame consists of updating 100 objects on the > screen (which by my estimation ought to be about 20 slot reads and 2 > writes), so I ought to be doing about 2000 slot reads each frame and > 200 writes. > > Wrapping the entire game loop in with-transaction increases > performance by about 10%. I also tried > > (db-env-set-flags (controller-environment *store-controller*) 1 :txn- > nosync t) > > as suggested in the manual, with a similar (about 10%) performance > increase. > > 2) If you are doing this, have you increased your BDB cache size to > ensure you can cache your key working set? > > It should already be large enough, but just for kicks I increased it > from 2 to 10 MB, resulting in a performance increase of about 3%. > > 3) If yes, do you have significant contention between reads and writes > for certain data structures that are causing transactions to be > aborted. Perhaps you can refactor around this. > > This is a single-threaded (and single-process) app. I don't see how > I could possibly have contention for the db. > > Ian > > And thanks to both Leslie and Alex for suggesting caching methods. I > will probably try to implement something along the lines of Alex's > suggestion, as that makes sense and should be simple enough (for the > single threaded model, which is sufficient for me). > > > Thanks again for all the help. I'll report back either when I have > something working or I've run into another wall. > > -- > Elliott Slaughter > > "Any road followed precisely to its end leads precisely nowhere." - > Frank Herbert > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From ihuquan at gmail.com Mon Dec 29 08:40:00 2008 From: ihuquan at gmail.com (quan hu) Date: Mon, 29 Dec 2008 16:40:00 +0800 Subject: [elephant-devel] DB migration issue Message-ID: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> Hello, I run into a problem when doing the garbage collection via data migration. The environment is elephant 0.9.1 and BDB 4.5. I also tried the latest elephant in darc and get the same result. 1. Test case to reproduce the problem. (defpclass user-profile() ((id :initform nil :index t) (sms-inbox :initform (make-pset)))) ;; Create a new db for test purpose (setf *migrate-src* (open-store '(:bdb "/tmp/db/src/"))) (setf *test-obj* (make-instance 'user-profile :sc *migrate-src*)) (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) (setf *migrate-dst* (open-store '(:bdb "/tmp/db/dst/"))) TEST> (migrate *migrate-dst* *migrate-src*) Migrating class indexes for: USER-PROFILE ; => Input get blocked, not response anymore 2. Using "db_stat -C A" get following output: *1* Lock requests not available due to conflicts, for which we waited 3. I do some debug work and found the problem may be caused by nested transaction of different store controller. I can reproduce the issue with following code segment TEST> (ensure-transaction (:store-controller *migrate-dst*) (add-to-root 'foo 'foo :sc *migrate-dst*) (ensure-transaction (:store-controller *migrate-src*) (add-to-root 'bar 'bar :sc *migrate-dst*))) This kind of nested transaction scenario can appear in the migrate process, because it uses source/destination store controller at the same time. I do not understand why different store controller's transaction can result in the lock conflict and want to know how to fix it. Is there anyone meet the similar problem before? Thanks Quan -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Mon Dec 29 12:36:07 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Mon, 29 Dec 2008 07:36:07 -0500 Subject: [elephant-devel] DB migration issue In-Reply-To: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> References: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> Message-ID: Hi Quan, Can you try the latest darcs with BDB 4.6 or 4.7? I made some changes to migration, but I can't recall if they were in the latest darcs or not - I think the latest darcs doesn't play well with BDB 4.5 so please make sure you can reproduce under the above configuration if you can. Thank you, Ian On Dec 29, 2008, at 3:40 AM, quan hu wrote: > Hello, > > I run into a problem when doing the garbage collection via data > migration. > The environment is elephant 0.9.1 and BDB 4.5. I also tried > the latest elephant in darc and get the same result. > > 1. Test case to reproduce the problem. > > (defpclass user-profile() > ((id :initform nil :index t) > (sms-inbox :initform (make-pset)))) > > ;; Create a new db for test purpose > (setf *migrate-src* (open-store '(:bdb "/tmp/db/src/"))) > (setf *test-obj* (make-instance 'user-profile :sc > *migrate-src*)) > (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) > (setf *migrate-dst* (open-store '(:bdb "/tmp/db/dst/"))) > > TEST> (migrate *migrate-dst* *migrate-src*) > Migrating class indexes for: USER-PROFILE > ; => Input get blocked, not response anymore > > 2. Using "db_stat -C A" get following output: > 1 Lock requests not available due to conflicts, for > which we waited > > 3. I do some debug work and found the problem may be caused > by nested transaction of different store controller. > I can reproduce the issue with following code segment > > TEST> (ensure-transaction (:store-controller *migrate-dst*) > (add-to-root 'foo 'foo :sc *migrate-dst*) > (ensure-transaction (:store-controller > *migrate-src*) > (add-to-root 'bar 'bar :sc *migrate- > dst*))) > > This kind of nested transaction scenario can appear in > the migrate process, because it uses source/destination store > controller at the same time. > > I do not understand why different store controller's > transaction can result in the lock conflict and want to know how to > fix it. > > Is there anyone meet the similar problem before? > > Thanks > Quan > > > > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From eslick at media.mit.edu Mon Dec 29 13:37:25 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Mon, 29 Dec 2008 08:37:25 -0500 Subject: [elephant-devel] DB migration issue In-Reply-To: References: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> Message-ID: <49255C15-AE3C-4B83-A73C-940670519C51@media.mit.edu> That would be elephant-unstable Sent from my iPhone On Dec 29, 2008, at 7:36 AM, Ian Eslick wrote: > Hi Quan, > > Can you try the latest darcs with BDB 4.6 or 4.7? I made some changes > to migration, but I can't recall if they were in the latest darcs or > not - I think the latest darcs doesn't play well with BDB 4.5 so > please make sure you can reproduce under the above configuration if > you can. > > Thank you, > Ian > > On Dec 29, 2008, at 3:40 AM, quan hu wrote: > >> Hello, >> >> I run into a problem when doing the garbage collection via data >> migration. >> The environment is elephant 0.9.1 and BDB 4.5. I also tried >> the latest elephant in darc and get the same result. >> >> 1. Test case to reproduce the problem. >> >> (defpclass user-profile() >> ((id :initform nil :index t) >> (sms-inbox :initform (make-pset)))) >> >> ;; Create a new db for test purpose >> (setf *migrate-src* (open-store '(:bdb "/tmp/db/src/"))) >> (setf *test-obj* (make-instance 'user-profile :sc >> *migrate-src*)) >> (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) >> (setf *migrate-dst* (open-store '(:bdb "/tmp/db/dst/"))) >> >> TEST> (migrate *migrate-dst* *migrate-src*) >> Migrating class indexes for: USER-PROFILE >> ; => Input get blocked, not response anymore >> >> 2. Using "db_stat -C A" get following output: >> 1 Lock requests not available due to conflicts, for >> which we waited >> >> 3. I do some debug work and found the problem may be caused >> by nested transaction of different store controller. >> I can reproduce the issue with following code segment >> >> TEST> (ensure-transaction (:store-controller *migrate-dst*) >> (add-to-root 'foo 'foo :sc *migrate-dst*) >> (ensure-transaction (:store-controller >> *migrate-src*) >> (add-to-root 'bar 'bar :sc *migrate- >> dst*))) >> >> This kind of nested transaction scenario can appear in >> the migrate process, because it uses source/destination store >> controller at the same time. >> >> I do not understand why different store controller's >> transaction can result in the lock conflict and want to know how to >> fix it. >> >> Is there anyone meet the similar problem before? >> >> Thanks >> Quan >> >> >> >> >> >> _______________________________________________ >> elephant-devel site list >> elephant-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From yarek.kowalik at gmail.com Mon Dec 29 18:13:27 2008 From: yarek.kowalik at gmail.com (Yarek Kowalik) Date: Mon, 29 Dec 2008 10:13:27 -0800 Subject: [elephant-devel] DB migration issue In-Reply-To: <49255C15-AE3C-4B83-A73C-940670519C51@media.mit.edu> References: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> <49255C15-AE3C-4B83-A73C-940670519C51@media.mit.edu> Message-ID: Quan, Unstable is here: http://www.common-lisp.net/project/elephant/darcs/elephant-unstable Yarek On Mon, Dec 29, 2008 at 5:37 AM, Ian Eslick wrote: > That would be elephant-unstable > > Sent from my iPhone > > On Dec 29, 2008, at 7:36 AM, Ian Eslick wrote: > > > Hi Quan, > > > > Can you try the latest darcs with BDB 4.6 or 4.7? I made some changes > > to migration, but I can't recall if they were in the latest darcs or > > not - I think the latest darcs doesn't play well with BDB 4.5 so > > please make sure you can reproduce under the above configuration if > > you can. > > > > Thank you, > > Ian > > > > On Dec 29, 2008, at 3:40 AM, quan hu wrote: > > > >> Hello, > >> > >> I run into a problem when doing the garbage collection via data > >> migration. > >> The environment is elephant 0.9.1 and BDB 4.5. I also tried > >> the latest elephant in darc and get the same result. > >> > >> 1. Test case to reproduce the problem. > >> > >> (defpclass user-profile() > >> ((id :initform nil :index t) > >> (sms-inbox :initform (make-pset)))) > >> > >> ;; Create a new db for test purpose > >> (setf *migrate-src* (open-store '(:bdb "/tmp/db/src/"))) > >> (setf *test-obj* (make-instance 'user-profile :sc > >> *migrate-src*)) > >> (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) > >> (setf *migrate-dst* (open-store '(:bdb "/tmp/db/dst/"))) > >> > >> TEST> (migrate *migrate-dst* *migrate-src*) > >> Migrating class indexes for: USER-PROFILE > >> ; => Input get blocked, not response anymore > >> > >> 2. Using "db_stat -C A" get following output: > >> 1 Lock requests not available due to conflicts, for > >> which we waited > >> > >> 3. I do some debug work and found the problem may be caused > >> by nested transaction of different store controller. > >> I can reproduce the issue with following code segment > >> > >> TEST> (ensure-transaction (:store-controller *migrate-dst*) > >> (add-to-root 'foo 'foo :sc *migrate-dst*) > >> (ensure-transaction (:store-controller > >> *migrate-src*) > >> (add-to-root 'bar 'bar :sc *migrate- > >> dst*))) > >> > >> This kind of nested transaction scenario can appear in > >> the migrate process, because it uses source/destination store > >> controller at the same time. > >> > >> I do not understand why different store controller's > >> transaction can result in the lock conflict and want to know how to > >> fix it. > >> > >> Is there anyone meet the similar problem before? > >> > >> Thanks > >> Quan > >> > >> > >> > >> > >> > >> _______________________________________________ > >> elephant-devel site list > >> elephant-devel at common-lisp.net > >> http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elliottslaughter at gmail.com Mon Dec 29 20:15:30 2008 From: elliottslaughter at gmail.com (Elliott Slaughter) Date: Mon, 29 Dec 2008 12:15:30 -0800 Subject: [elephant-devel] Optimization In-Reply-To: References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> <20081223092255.GA17361@viridian-project.de> <786E3BB7-708F-461E-A6FB-3B392614C4FD@media.mit.edu> <42c0ab790812272305k78d8ef1atb4c78df5b9624ee3@mail.gmail.com> Message-ID: <42c0ab790812291215x3b8e8b41gbe17931b06d2c31d@mail.gmail.com> On Sun, Dec 28, 2008 at 2:09 PM, Ian Eslick wrote: > I implemented a quick check-in/check-out protocol for persistent objects. Nice. Mind sharing? A standard-object slot allows about 50M updates-sec > A persistent-object slot (inside a txn) is about 60k updates-sec > A cached persistent-object slot is about 3M updates-sec I implemented my own version of caching using Alex's suggestion (with slot defs caching their values in hash tables). With a simple loop (code attached), I get about 30M updates per second (Hz) for standard slots, about 30 kHz for persistent slots, and about 2.4 MHz using my caching scheme. The slot access protocol adds about 10x overhead per slot read but the > cached access is about 50x faster than the pure persistent query. > I'll see if there are some easy opportunities to speed things up. I observed about the same performance differences (although I saw closer to an 100x difference between persistence and caching). My method uses hash table lookups for slot reads, which makes me wonder if I'd get better performance by using a slot caching protocol more similar to the default implementation. Anyways, using cached slots in my game results in a 2x speed increase, although it still runs 2x to 3x slower than the completely in-memory version. I guess I have other performance concerns to think about than just slot reads. Ian > > On Dec 28, 2008, at 2:05 AM, Elliott Slaughter wrote: > > > There are several replies to my original query, so I will attempt to > > address all of them here. > > > > On Wed, Dec 24, 2008 at 2:31 PM, Ian Eslick > > wrote: > > A couple of quick thoughts on your problem: > > > > 1) Are you wrapping the critical sections of your code in with- > > transaction? This causes all database pages you touch to be cached > > within the body of the transaction. This avoids all 'sync' operations > > and transaction setup/teardown caused by a read/write slot operation > > that takes place outside a with-transaction body. > > > > I currently wrap the contents of each frame update in with- > > transaction. Each frame consists of updating 100 objects on the > > screen (which by my estimation ought to be about 20 slot reads and 2 > > writes), so I ought to be doing about 2000 slot reads each frame and > > 200 writes. > > > > Wrapping the entire game loop in with-transaction increases > > performance by about 10%. I also tried > > > > (db-env-set-flags (controller-environment *store-controller*) 1 :txn- > > nosync t) > > > > as suggested in the manual, with a similar (about 10%) performance > > increase. > > > > 2) If you are doing this, have you increased your BDB cache size to > > ensure you can cache your key working set? > > > > It should already be large enough, but just for kicks I increased it > > from 2 to 10 MB, resulting in a performance increase of about 3%. > > > > 3) If yes, do you have significant contention between reads and writes > > for certain data structures that are causing transactions to be > > aborted. Perhaps you can refactor around this. > > > > This is a single-threaded (and single-process) app. I don't see how > > I could possibly have contention for the db. > > > > Ian > > > > And thanks to both Leslie and Alex for suggesting caching methods. I > > will probably try to implement something along the lines of Alex's > > suggestion, as that makes sense and should be simple enough (for the > > single threaded model, which is sufficient for me). > > > > > > Thanks again for all the help. I'll report back either when I have > > something working or I've run into another wall. > > > > -- > > Elliott Slaughter > > > > "Any road followed precisely to its end leads precisely nowhere." - > > Frank Herbert > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > -- Elliott Slaughter "Any road followed precisely to its end leads precisely nowhere." - Frank Herbert -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: slot-read-cache-performance.lisp Type: application/octet-stream Size: 1122 bytes Desc: not available URL: From eslick at media.mit.edu Mon Dec 29 22:40:15 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Mon, 29 Dec 2008 17:40:15 -0500 Subject: [elephant-devel] Optimization In-Reply-To: <42c0ab790812291215x3b8e8b41gbe17931b06d2c31d@mail.gmail.com> References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> <20081223092255.GA17361@viridian-project.de> <786E3BB7-708F-461E-A6FB-3B392614C4FD@media.mit.edu> <42c0ab790812272305k78d8ef1atb4c78df5b9624ee3@mail.gmail.com> <42c0ab790812291215x3b8e8b41gbe17931b06d2c31d@mail.gmail.com> Message-ID: <649C8BDC-270B-49BF-9B19-0BD550D42837@media.mit.edu> I ran your tests on my new elephant tree that includes the checkout protocol (which is now available via elephant-unstable) and the local improvements to persistent slot access time. Writes are about 2x slower than reads so a read/write test cycle is also informative. Attached is my annotations to your file. Cheers, Ian -------------- next part -------------- A non-text attachment was scrubbed... Name: slot-read-cache-performance.lisp Type: application/octet-stream Size: 2142 bytes Desc: not available URL: -------------- next part -------------- On Dec 29, 2008, at 3:15 PM, Elliott Slaughter wrote: > On Sun, Dec 28, 2008 at 2:09 PM, Ian Eslick > wrote: > I implemented a quick check-in/check-out protocol for persistent > objects. > > Nice. Mind sharing? > > A standard-object slot allows about 50M updates-sec > A persistent-object slot (inside a txn) is about 60k updates-sec > A cached persistent-object slot is about 3M updates-sec > > I implemented my own version of caching using Alex's suggestion > (with slot defs caching their values in hash tables). > > With a simple loop (code attached), I get about 30M updates per > second (Hz) for standard slots, about 30 kHz for persistent slots, > and about 2.4 MHz using my caching scheme. > > The slot access protocol adds about 10x overhead per slot read but the > cached access is about 50x faster than the pure persistent query. > I'll see if there are some easy opportunities to speed things up. > > I observed about the same performance differences (although I saw > closer to an 100x difference between persistence and caching). > > My method uses hash table lookups for slot reads, which makes me > wonder if I'd get better performance by using a slot caching > protocol more similar to the default implementation. > > Anyways, using cached slots in my game results in a 2x speed > increase, although it still runs 2x to 3x slower than the completely > in-memory version. I guess I have other performance concerns to > think about than just slot reads. > > Ian > > On Dec 28, 2008, at 2:05 AM, Elliott Slaughter wrote: > > > There are several replies to my original query, so I will attempt to > > address all of them here. > > > > On Wed, Dec 24, 2008 at 2:31 PM, Ian Eslick > > wrote: > > A couple of quick thoughts on your problem: > > > > 1) Are you wrapping the critical sections of your code in with- > > transaction? This causes all database pages you touch to be cached > > within the body of the transaction. This avoids all 'sync' > operations > > and transaction setup/teardown caused by a read/write slot operation > > that takes place outside a with-transaction body. > > > > I currently wrap the contents of each frame update in with- > > transaction. Each frame consists of updating 100 objects on the > > screen (which by my estimation ought to be about 20 slot reads and 2 > > writes), so I ought to be doing about 2000 slot reads each frame and > > 200 writes. > > > > Wrapping the entire game loop in with-transaction increases > > performance by about 10%. I also tried > > > > (db-env-set-flags (controller-environment *store-controller*) > 1 :txn- > > nosync t) > > > > as suggested in the manual, with a similar (about 10%) performance > > increase. > > > > 2) If you are doing this, have you increased your BDB cache size to > > ensure you can cache your key working set? > > > > It should already be large enough, but just for kicks I increased it > > from 2 to 10 MB, resulting in a performance increase of about 3%. > > > > 3) If yes, do you have significant contention between reads and > writes > > for certain data structures that are causing transactions to be > > aborted. Perhaps you can refactor around this. > > > > This is a single-threaded (and single-process) app. I don't see how > > I could possibly have contention for the db. > > > > Ian > > > > And thanks to both Leslie and Alex for suggesting caching methods. I > > will probably try to implement something along the lines of Alex's > > suggestion, as that makes sense and should be simple enough (for the > > single threaded model, which is sufficient for me). > > > > > > Thanks again for all the help. I'll report back either when I have > > something working or I've run into another wall. > > > > -- > > Elliott Slaughter > > > > "Any road followed precisely to its end leads precisely nowhere." - > > Frank Herbert > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > -- > Elliott Slaughter > > "Any road followed precisely to its end leads precisely nowhere." - > Frank Herbert > performance.lisp>_______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From eslick at media.mit.edu Mon Dec 29 22:40:20 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Mon, 29 Dec 2008 17:40:20 -0500 Subject: [elephant-devel] Optimization In-Reply-To: <42c0ab790812291215x3b8e8b41gbe17931b06d2c31d@mail.gmail.com> References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> <20081223092255.GA17361@viridian-project.de> <786E3BB7-708F-461E-A6FB-3B392614C4FD@media.mit.edu> <42c0ab790812272305k78d8ef1atb4c78df5b9624ee3@mail.gmail.com> <42c0ab790812291215x3b8e8b41gbe17931b06d2c31d@mail.gmail.com> Message-ID: Try out my recent checkin of the checkin/checkout protocol to elephant- unstable. I hope to check in an improvement to persistent-slot access which improves persistent slot access performance by approximately 2x shortly. Regards, Ian On Dec 29, 2008, at 3:15 PM, Elliott Slaughter wrote: > On Sun, Dec 28, 2008 at 2:09 PM, Ian Eslick > wrote: > I implemented a quick check-in/check-out protocol for persistent > objects. > > Nice. Mind sharing? > > A standard-object slot allows about 50M updates-sec > A persistent-object slot (inside a txn) is about 60k updates-sec > A cached persistent-object slot is about 3M updates-sec > > I implemented my own version of caching using Alex's suggestion > (with slot defs caching their values in hash tables). > > With a simple loop (code attached), I get about 30M updates per > second (Hz) for standard slots, about 30 kHz for persistent slots, > and about 2.4 MHz using my caching scheme. > > The slot access protocol adds about 10x overhead per slot read but the > cached access is about 50x faster than the pure persistent query. > I'll see if there are some easy opportunities to speed things up. > > I observed about the same performance differences (although I saw > closer to an 100x difference between persistence and caching). > > My method uses hash table lookups for slot reads, which makes me > wonder if I'd get better performance by using a slot caching > protocol more similar to the default implementation. > > Anyways, using cached slots in my game results in a 2x speed > increase, although it still runs 2x to 3x slower than the completely > in-memory version. I guess I have other performance concerns to > think about than just slot reads. > > Ian > > On Dec 28, 2008, at 2:05 AM, Elliott Slaughter wrote: > > > There are several replies to my original query, so I will attempt to > > address all of them here. > > > > On Wed, Dec 24, 2008 at 2:31 PM, Ian Eslick > > wrote: > > A couple of quick thoughts on your problem: > > > > 1) Are you wrapping the critical sections of your code in with- > > transaction? This causes all database pages you touch to be cached > > within the body of the transaction. This avoids all 'sync' > operations > > and transaction setup/teardown caused by a read/write slot operation > > that takes place outside a with-transaction body. > > > > I currently wrap the contents of each frame update in with- > > transaction. Each frame consists of updating 100 objects on the > > screen (which by my estimation ought to be about 20 slot reads and 2 > > writes), so I ought to be doing about 2000 slot reads each frame and > > 200 writes. > > > > Wrapping the entire game loop in with-transaction increases > > performance by about 10%. I also tried > > > > (db-env-set-flags (controller-environment *store-controller*) > 1 :txn- > > nosync t) > > > > as suggested in the manual, with a similar (about 10%) performance > > increase. > > > > 2) If you are doing this, have you increased your BDB cache size to > > ensure you can cache your key working set? > > > > It should already be large enough, but just for kicks I increased it > > from 2 to 10 MB, resulting in a performance increase of about 3%. > > > > 3) If yes, do you have significant contention between reads and > writes > > for certain data structures that are causing transactions to be > > aborted. Perhaps you can refactor around this. > > > > This is a single-threaded (and single-process) app. I don't see how > > I could possibly have contention for the db. > > > > Ian > > > > And thanks to both Leslie and Alex for suggesting caching methods. I > > will probably try to implement something along the lines of Alex's > > suggestion, as that makes sense and should be simple enough (for the > > single threaded model, which is sufficient for me). > > > > > > Thanks again for all the help. I'll report back either when I have > > something working or I've run into another wall. > > > > -- > > Elliott Slaughter > > > > "Any road followed precisely to its end leads precisely nowhere." - > > Frank Herbert > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > -- > Elliott Slaughter > > "Any road followed precisely to its end leads precisely nowhere." - > Frank Herbert > performance.lisp>_______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From eslick at media.mit.edu Mon Dec 29 22:46:57 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Mon, 29 Dec 2008 17:46:57 -0500 Subject: [elephant-devel] Optimization In-Reply-To: References: <42c0ab790812212135w18d4cdcerb7af5b45a04486f0@mail.gmail.com> <20081223092255.GA17361@viridian-project.de> <786E3BB7-708F-461E-A6FB-3B392614C4FD@media.mit.edu> <42c0ab790812272305k78d8ef1atb4c78df5b9624ee3@mail.gmail.com> Message-ID: <79E0CB99-2CA4-4583-A750-AE0CBA4D5C3C@media.mit.edu> I checked the cache-checkout model to elephant-unstable. Also checked in some new tests. The cache-checkout model is pretty simple, although there are a number of ways to shoot yourself in the foot if you don't use it wisely. I haven't given this a serious review for concurrency issues. A second pair of eyes is always appreciated. (src/elephant/cached-slots.lisp contains the key changes) - On checkout, the cached slots of the checked-out object behaves like a standard built-in object, although with MOP overhead on accesses (see below) - Write operations are also cached - The persistent-checkin operation write the current cached slot state to the DB - You can sync a currently checked out object to make its state persistent - Checkout can be cancelled - All checkout operations are transactional (e.g. only one can succeed) and the persistent-checked-out-p predicate is also transactional, but the transaction must terminate prior to any cached ops occuring. - The user is responsible for any multi-process locking to ensure isolation of checkout, subsequent cached ops and checkin or sync steps. Some quick tweaks and a slightly different test and we've got somewhat better performance results than reported earlier (similar to the results I sent in response to Elliott) Standard: 25M/sec Cached: 7M/sec Persistent (within a transaction): 140k/sec ** (** - Improvements to persistent read performance are not yet in repository) Cached slot access is now only 4x slower than standard slot access Persistent slot access is about 50x slower than cached slot access Enjoy! Ian On Dec 28, 2008, at 5:09 PM, Ian Eslick wrote: > I implemented a quick check-in/check-out protocol for persistent > objects. I have to think a little more about concurrency as I'm sure > there are some holes. I implemented a simple test loop which > increments a local variable by the value in an instance slot. > > A standard-object slot allows about 50M updates-sec > A persistent-object slot (inside a txn) is about 60k updates-sec > A cached persistent-object slot is about 3M updates-sec > > The slot access protocol adds about 10x overhead per slot read but the > cached access is about 50x faster than the pure persistent query. > I'll see if there are some easy opportunities to speed things up. > > Ian > > On Dec 28, 2008, at 2:05 AM, Elliott Slaughter wrote: > >> There are several replies to my original query, so I will attempt to >> address all of them here. >> >> On Wed, Dec 24, 2008 at 2:31 PM, Ian Eslick >> wrote: >> A couple of quick thoughts on your problem: >> >> 1) Are you wrapping the critical sections of your code in with- >> transaction? This causes all database pages you touch to be cached >> within the body of the transaction. This avoids all 'sync' >> operations >> and transaction setup/teardown caused by a read/write slot operation >> that takes place outside a with-transaction body. >> >> I currently wrap the contents of each frame update in with- >> transaction. Each frame consists of updating 100 objects on the >> screen (which by my estimation ought to be about 20 slot reads and 2 >> writes), so I ought to be doing about 2000 slot reads each frame and >> 200 writes. >> >> Wrapping the entire game loop in with-transaction increases >> performance by about 10%. I also tried >> >> (db-env-set-flags (controller-environment *store-controller*) 1 :txn- >> nosync t) >> >> as suggested in the manual, with a similar (about 10%) performance >> increase. >> >> 2) If you are doing this, have you increased your BDB cache size to >> ensure you can cache your key working set? >> >> It should already be large enough, but just for kicks I increased it >> from 2 to 10 MB, resulting in a performance increase of about 3%. >> >> 3) If yes, do you have significant contention between reads and >> writes >> for certain data structures that are causing transactions to be >> aborted. Perhaps you can refactor around this. >> >> This is a single-threaded (and single-process) app. I don't see how >> I could possibly have contention for the db. >> >> Ian >> >> And thanks to both Leslie and Alex for suggesting caching methods. I >> will probably try to implement something along the lines of Alex's >> suggestion, as that makes sense and should be simple enough (for the >> single threaded model, which is sufficient for me). >> >> >> Thanks again for all the help. I'll report back either when I have >> something working or I've run into another wall. >> >> -- >> Elliott Slaughter >> >> "Any road followed precisely to its end leads precisely nowhere." - >> Frank Herbert >> _______________________________________________ >> elephant-devel site list >> elephant-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From ihuquan at gmail.com Tue Dec 30 05:47:26 2008 From: ihuquan at gmail.com (quan hu) Date: Tue, 30 Dec 2008 13:47:26 +0800 Subject: [elephant-devel] DB migration issue In-Reply-To: References: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> <49255C15-AE3C-4B83-A73C-940670519C51@media.mit.edu> Message-ID: <1cc8deb80812292147i5d39c76dq612c2d0b2e5dc70b@mail.gmail.com> Hi Ian, Yarek, Thanks for providing the information. I downloaded the elephant-unstable and test it with BDB4.7. The failure symptom is the same: target store controller get locked. After I make following changes in migrate.lisp; The test passed. (defmethod copy-btree-contents ((sc store-controller) dst src) (let (to-be-migrated) (map-btree (lambda (key value) (let ((newval (migrate sc value)) (newkey (migrate sc key))) (push (list newkey newval) to-be-migrated))) ;;;; (setf (get-value newkey dst) newval))) ;; src) (loop for (k v) in to-be-migrated do (setf (get-value k dst) v)))) Above debug change just avoids the nested transaction of different store controller for the specific test case. However, it is not the solution, as the nested transaction still could appear in other data pattern. What confuses me is that the nested transaction of the same store controller seem not bring any block. Following test passed: (with-transaction (:store-controller *migrate-dst*) (add-to-root 'foo 'foo :sc *migrate-dst*) (with-transaction (:store-controller *migrate-dst*) (add-to-root 'bar 'bar :sc *migrate-dst*))) But, the nested transaction of different store controller always results in lock. (with-transaction (:store-controller *migrate-dst*) (add-to-root 'foo 'foo :sc *migrate-dst*) (with-transaction (:store-controller **migrate-src**) ;; trigger database lock (add-to-root 'bar 'bar :sc *migrate-dst*))) Thanks Quan 2008/12/30 Yarek Kowalik > Quan, > > Unstable is here: > > http://www.common-lisp.net/project/elephant/darcs/elephant-unstable > > Yarek > > > On Mon, Dec 29, 2008 at 5:37 AM, Ian Eslick wrote: > >> That would be elephant-unstable >> >> Sent from my iPhone >> >> On Dec 29, 2008, at 7:36 AM, Ian Eslick wrote: >> >> > Hi Quan, >> > >> > Can you try the latest darcs with BDB 4.6 or 4.7? I made some changes >> > to migration, but I can't recall if they were in the latest darcs or >> > not - I think the latest darcs doesn't play well with BDB 4.5 so >> > please make sure you can reproduce under the above configuration if >> > you can. >> > >> > Thank you, >> > Ian >> > >> > On Dec 29, 2008, at 3:40 AM, quan hu wrote: >> > >> >> Hello, >> >> >> >> I run into a problem when doing the garbage collection via data >> >> migration. >> >> The environment is elephant 0.9.1 and BDB 4.5. I also tried >> >> the latest elephant in darc and get the same result. >> >> >> >> 1. Test case to reproduce the problem. >> >> >> >> (defpclass user-profile() >> >> ((id :initform nil :index t) >> >> (sms-inbox :initform (make-pset)))) >> >> >> >> ;; Create a new db for test purpose >> >> (setf *migrate-src* (open-store '(:bdb "/tmp/db/src/"))) >> >> (setf *test-obj* (make-instance 'user-profile :sc >> >> *migrate-src*)) >> >> (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) >> >> (setf *migrate-dst* (open-store '(:bdb "/tmp/db/dst/"))) >> >> >> >> TEST> (migrate *migrate-dst* *migrate-src*) >> >> Migrating class indexes for: USER-PROFILE >> >> ; => Input get blocked, not response anymore >> >> >> >> 2. Using "db_stat -C A" get following output: >> >> 1 Lock requests not available due to conflicts, for >> >> which we waited >> >> >> >> 3. I do some debug work and found the problem may be caused >> >> by nested transaction of different store controller. >> >> I can reproduce the issue with following code segment >> >> >> >> TEST> (ensure-transaction (:store-controller *migrate-dst*) >> >> (add-to-root 'foo 'foo :sc *migrate-dst*) >> >> (ensure-transaction (:store-controller >> >> *migrate-src*) >> >> (add-to-root 'bar 'bar :sc *migrate- >> >> dst*))) >> >> >> >> This kind of nested transaction scenario can appear in >> >> the migrate process, because it uses source/destination store >> >> controller at the same time. >> >> >> >> I do not understand why different store controller's >> >> transaction can result in the lock conflict and want to know how to >> >> fix it. >> >> >> >> Is there anyone meet the similar problem before? >> >> >> >> Thanks >> >> Quan >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> >> elephant-devel site list >> >> elephant-devel at common-lisp.net >> >> http://common-lisp.net/mailman/listinfo/elephant-devel >> > >> > >> > _______________________________________________ >> > elephant-devel site list >> > elephant-devel at common-lisp.net >> > http://common-lisp.net/mailman/listinfo/elephant-devel >> >> _______________________________________________ >> elephant-devel site list >> elephant-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/elephant-devel >> > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ihuquan at gmail.com Tue Dec 30 14:34:14 2008 From: ihuquan at gmail.com (quan hu) Date: Tue, 30 Dec 2008 22:34:14 +0800 Subject: [elephant-devel] DB migration issue In-Reply-To: <1cc8deb80812292147i5d39c76dq612c2d0b2e5dc70b@mail.gmail.com> References: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> <49255C15-AE3C-4B83-A73C-940670519C51@media.mit.edu> <1cc8deb80812292147i5d39c76dq612c2d0b2e5dc70b@mail.gmail.com> Message-ID: <1cc8deb80812300634n57d81ca4iaf770dbc3c7b0dfd@mail.gmail.com> Hello, After more investigation, here are some suspects: In the current elephant codes, the macro my-current-transaction will check if the current transaction belongs to the sc parameter. If not, just return +NULL-CHAR+. That's exactly the case in the following nested transaction where the store-controller is different. The situation becomes: Transaction 1 begins One data is put into DB with Transaction 1 ... Another data is put into the same DB with NULL transaction parameter(i.e. no transaction??) It looks like this scenario is not supported by BDB. I simulate above case with a C program to access BDB and get the similar failure symptom. ... txn1 = NULL; ret = dbenvp1->txn_begin(dbenvp1, NULL, &txn1, 0); if (ret != 0) { printf ("Transaction begin failed.\n"); return 1; } put_record(FOO,FOO,txn1, dbp1); printf("foo\n"); put_record(FOO,FOO,NULL, dbp1); printf("bar\n"); txn1->commit(txn1,0); printf("baz\n"); ... After "foo" is printed, the C program is blocked. If I change the NULL to txn1, everything is fine. Regarding to the solution, my gut feeling is that it would be difficult to avoid this kind of nested transaction in migrate process, because of the recursive function call. Maybe, *transaction-stack* can be added to track the active transaction stack. Get it pushed and poped in right place of execute-transaction. Then, in my-current-transaction, check *transaction-stack* to see if there is an active transaction belongs to the same store-controller. If it is found, use it. My simple test shows it works. If this is the right direction, I can do more test. Thanks for your help. Quan 2008/12/30 quan hu > Hi Ian, Yarek, > > Thanks for providing the information. > I downloaded the elephant-unstable and test it with BDB4.7. > The failure symptom is the same: target store controller get locked. > > After I make following changes in migrate.lisp; The test passed. > > (defmethod copy-btree-contents ((sc store-controller) dst src) > (let (to-be-migrated) > (map-btree (lambda (key value) > (let ((newval (migrate sc value)) > (newkey (migrate sc key))) > (push (list newkey newval) > to-be-migrated))) > ;;;; (setf (get-value newkey > dst) newval))) ;; > src) > (loop for (k v) in to-be-migrated > do > (setf (get-value k dst) v)))) > > Above debug change just avoids the nested transaction of different > store controller for the specific test case. > However, it is not the solution, as the nested transaction still could > appear in other data pattern. > > What confuses me is that the nested transaction of the same store > controller seem not bring any block. > Following test passed: > (with-transaction (:store-controller *migrate-dst*) > (add-to-root 'foo 'foo :sc *migrate-dst*) > (with-transaction (:store-controller *migrate-dst*) > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > But, the nested transaction of different store controller always > results in lock. > > (with-transaction (:store-controller *migrate-dst*) > (add-to-root 'foo 'foo :sc *migrate-dst*) > (with-transaction (:store-controller **migrate-src**) > ;; trigger database lock > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > Thanks > Quan > > > > 2008/12/30 Yarek Kowalik > > Quan, >> >> Unstable is here: >> >> http://www.common-lisp.net/project/elephant/darcs/elephant-unstable >> >> Yarek >> >> >> On Mon, Dec 29, 2008 at 5:37 AM, Ian Eslick wrote: >> >>> That would be elephant-unstable >>> >>> Sent from my iPhone >>> >>> On Dec 29, 2008, at 7:36 AM, Ian Eslick wrote: >>> >>> > Hi Quan, >>> > >>> > Can you try the latest darcs with BDB 4.6 or 4.7? I made some changes >>> > to migration, but I can't recall if they were in the latest darcs or >>> > not - I think the latest darcs doesn't play well with BDB 4.5 so >>> > please make sure you can reproduce under the above configuration if >>> > you can. >>> > >>> > Thank you, >>> > Ian >>> > >>> > On Dec 29, 2008, at 3:40 AM, quan hu wrote: >>> > >>> >> Hello, >>> >> >>> >> I run into a problem when doing the garbage collection via data >>> >> migration. >>> >> The environment is elephant 0.9.1 and BDB 4.5. I also tried >>> >> the latest elephant in darc and get the same result. >>> >> >>> >> 1. Test case to reproduce the problem. >>> >> >>> >> (defpclass user-profile() >>> >> ((id :initform nil :index t) >>> >> (sms-inbox :initform (make-pset)))) >>> >> >>> >> ;; Create a new db for test purpose >>> >> (setf *migrate-src* (open-store '(:bdb "/tmp/db/src/"))) >>> >> (setf *test-obj* (make-instance 'user-profile :sc >>> >> *migrate-src*)) >>> >> (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) >>> >> (setf *migrate-dst* (open-store '(:bdb "/tmp/db/dst/"))) >>> >> >>> >> TEST> (migrate *migrate-dst* *migrate-src*) >>> >> Migrating class indexes for: USER-PROFILE >>> >> ; => Input get blocked, not response anymore >>> >> >>> >> 2. Using "db_stat -C A" get following output: >>> >> 1 Lock requests not available due to conflicts, for >>> >> which we waited >>> >> >>> >> 3. I do some debug work and found the problem may be caused >>> >> by nested transaction of different store controller. >>> >> I can reproduce the issue with following code segment >>> >> >>> >> TEST> (ensure-transaction (:store-controller *migrate-dst*) >>> >> (add-to-root 'foo 'foo :sc *migrate-dst*) >>> >> (ensure-transaction (:store-controller >>> >> *migrate-src*) >>> >> (add-to-root 'bar 'bar :sc *migrate- >>> >> dst*))) >>> >> >>> >> This kind of nested transaction scenario can appear in >>> >> the migrate process, because it uses source/destination store >>> >> controller at the same time. >>> >> >>> >> I do not understand why different store controller's >>> >> transaction can result in the lock conflict and want to know how to >>> >> fix it. >>> >> >>> >> Is there anyone meet the similar problem before? >>> >> >>> >> Thanks >>> >> Quan >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> _______________________________________________ >>> >> elephant-devel site list >>> >> elephant-devel at common-lisp.net >>> >> http://common-lisp.net/mailman/listinfo/elephant-devel >>> > >>> > >>> > _______________________________________________ >>> > elephant-devel site list >>> > elephant-devel at common-lisp.net >>> > http://common-lisp.net/mailman/listinfo/elephant-devel >>> >>> _______________________________________________ >>> elephant-devel site list >>> elephant-devel at common-lisp.net >>> http://common-lisp.net/mailman/listinfo/elephant-devel >>> >> >> >> _______________________________________________ >> elephant-devel site list >> elephant-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/elephant-devel >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Tue Dec 30 15:57:14 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Tue, 30 Dec 2008 10:57:14 -0500 Subject: [elephant-devel] DB migration issue In-Reply-To: <1cc8deb80812300634n57d81ca4iaf770dbc3c7b0dfd@mail.gmail.com> References: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> <49255C15-AE3C-4B83-A73C-940670519C51@media.mit.edu> <1cc8deb80812292147i5d39c76dq612c2d0b2e5dc70b@mail.gmail.com> <1cc8deb80812300634n57d81ca4iaf770dbc3c7b0dfd@mail.gmail.com> Message-ID: This scenario worked for migration as of the last release so a bug must have crept in with the new features. Thank you for the investigation, it only works if you are very careful. There should be some info on this in the txn src code or in the manual - I'll look into this when I can if you don't identify it first. Is it related to the specific migrate code for set-valued slots? Sent from my iPhone On Dec 30, 2008, at 9:34 AM, "quan hu" wrote: > Hello, > > After more investigation, here are some suspects: > > In the current elephant codes, the macro my-current- > transaction will check if the current transaction belongs to the sc > parameter. If not, just return +NULL-CHAR+. That's exactly the > case in the following nested transaction where the store-controller > is different. > The situation becomes: > Transaction 1 begins > One data is put into DB with Transaction 1 > ... > Another data is put into the same DB with NULL > transaction parameter(i.e. no transaction??) > > It looks like this scenario is not supported by BDB. > I simulate above case with a C program to access BDB and get > the similar failure symptom. > ... > txn1 = NULL; > ret = dbenvp1->txn_begin(dbenvp1, NULL, &txn1, 0); > if (ret != 0) { > printf ("Transaction begin failed.\n"); > return 1; > } > put_record(FOO,FOO,txn1, dbp1); > printf("foo\n"); > put_record(FOO,FOO,NULL, dbp1); > printf("bar\n"); > txn1->commit(txn1,0); > printf("baz\n"); > ... > After "foo" is printed, the C program is blocked. If I change the > NULL to txn1, everything is fine. > > > Regarding to the solution, my gut feeling is that it would be > difficult to avoid this kind of nested transaction in migrate > process, because of the recursive function call. Maybe, > *transaction-stack* can be added to track the active transaction > stack. Get it pushed and poped in right place of execute- > transaction. Then, in my-current-transaction, check *transaction- > stack* to see if there is an active transaction belongs to the same > store-controller. If it is found, use it. My simple test shows it > works. If this is the right direction, I can do more test. > > Thanks for your help. > Quan > > > > > > 2008/12/30 quan hu > Hi Ian, Yarek, > > Thanks for providing the information. > I downloaded the elephant-unstable and test it with BDB4.7. > The failure symptom is the same: target store controller get > locked. > > After I make following changes in migrate.lisp; The test passed. > > (defmethod copy-btree-contents ((sc store-controller) dst src) > (let (to-be-migrated) > (map-btree (lambda (key value) > (let ((newval (migrate sc value)) > (newkey (migrate sc key))) > (push (list newkey > newval) to-be-migrated))) > ;;;; (setf (get-value > newkey dst) newval))) ;; > src) > (loop for (k v) in to-be-migrated > do > (setf (get-value k dst) v)))) > > Above debug change just avoids the nested transaction of > different store controller for the specific test case. > However, it is not the solution, as the nested transaction > still could appear in other data pattern. > > What confuses me is that the nested transaction of the same > store controller seem not bring any block. > Following test passed: > (with-transaction (:store-controller *migrate-dst*) > > (add-to-root 'foo 'foo :sc *migrate-dst*) > (with-transaction (:store-controller *migrate-dst*) > > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > But, the nested transaction of different store controller always > results in lock. > > (with-transaction (:store-controller *migrate-dst*) > > (add-to-root 'foo 'foo :sc *migrate-dst*) > (with-transaction (:store-controller *migrate- > src*) ;; trigger database lock > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > Thanks > Quan > > > > 2008/12/30 Yarek Kowalik > > Quan, > > Unstable is here: > > http://www.common-lisp.net/project/elephant/darcs/elephant-unstable > > Yarek > > > On Mon, Dec 29, 2008 at 5:37 AM, Ian Eslick > wrote: > That would be elephant-unstable > > Sent from my iPhone > > On Dec 29, 2008, at 7:36 AM, Ian Eslick wrote: > > > Hi Quan, > > > > Can you try the latest darcs with BDB 4.6 or 4.7? I made some > changes > > to migration, but I can't recall if they were in the latest darcs or > > not - I think the latest darcs doesn't play well with BDB 4.5 so > > please make sure you can reproduce under the above configuration if > > you can. > > > > Thank you, > > Ian > > > > On Dec 29, 2008, at 3:40 AM, quan hu wrote: > > > >> Hello, > >> > >> I run into a problem when doing the garbage collection via data > >> migration. > >> The environment is elephant 0.9.1 and BDB 4.5. I also tried > >> the latest elephant in darc and get the same result. > >> > >> 1. Test case to reproduce the problem. > >> > >> (defpclass user-profile() > >> ((id :initform nil :index t) > >> (sms-inbox :initform (make-pset)))) > >> > >> ;; Create a new db for test purpose > >> (setf *migrate-src* (open-store '(:bdb "/tmp/db/src/"))) > >> (setf *test-obj* (make-instance 'user-profile :sc > >> *migrate-src*)) > >> (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) > >> (setf *migrate-dst* (open-store '(:bdb "/tmp/db/dst/"))) > >> > >> TEST> (migrate *migrate-dst* *migrate-src*) > >> Migrating class indexes for: USER-PROFILE > >> ; => Input get blocked, not response anymore > >> > >> 2. Using "db_stat -C A" get following output: > >> 1 Lock requests not available due to conflicts, for > >> which we waited > >> > >> 3. I do some debug work and found the problem may be caused > >> by nested transaction of different store controller. > >> I can reproduce the issue with following code segment > >> > >> TEST> (ensure-transaction (:store-controller *migrate- > dst*) > >> (add-to-root 'foo 'foo :sc *migrate- > dst*) > >> (ensure-transaction (:store-controller > >> *migrate-src*) > >> (add-to-root 'bar 'bar :sc > *migrate- > >> dst*))) > >> > >> This kind of nested transaction scenario can appear in > >> the migrate process, because it uses source/destination store > >> controller at the same time. > >> > >> I do not understand why different store controller's > >> transaction can result in the lock conflict and want to know how to > >> fix it. > >> > >> Is there anyone meet the similar problem before? > >> > >> Thanks > >> Quan > >> > >> > >> > >> > >> > >> _______________________________________________ > >> elephant-devel site list > >> elephant-devel at common-lisp.net > >> http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Tue Dec 30 21:49:56 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Tue, 30 Dec 2008 16:49:56 -0500 Subject: [elephant-devel] DB migration issue In-Reply-To: <1cc8deb80812300634n57d81ca4iaf770dbc3c7b0dfd@mail.gmail.com> References: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> <49255C15-AE3C-4B83-A73C-940670519C51@media.mit.edu> <1cc8deb80812292147i5d39c76dq612c2d0b2e5dc70b@mail.gmail.com> <1cc8deb80812300634n57d81ca4iaf770dbc3c7b0dfd@mail.gmail.com> Message-ID: Hi Quan, Thank you again for the information on this bug. The short story is that the way we are keeping track of transactions assumed that there were only two stores in the nested transaction stack (outer and inner). Migrating a nested object inside a with-transaction would not pass the parent transaction to the backend so it wouldn't know a transaction in progress and attempted to start a new one, which would block until the old one was completed. I just checked in a patch that made transaction tracking a bit more intelligent (it depends on the backends taking care of handling nested transactions - which I believe they all do fine). I also checked in a test which implements Quan's test case. This patch and the prior patches of the past few days pass all tests on SBCL/Mac/BDB. Ian PS - I'd love to know the current status of the elephant-unstable tree with the postmodern backend. On Dec 30, 2008, at 9:34 AM, quan hu wrote: > Hello, > > After more investigation, here are some suspects: > > In the current elephant codes, the macro my-current- > transaction will check if the current transaction belongs to the sc > parameter. If not, just return +NULL-CHAR+. That's exactly the > case in the following nested transaction where the store-controller > is different. > The situation becomes: > Transaction 1 begins > One data is put into DB with Transaction 1 > ... > Another data is put into the same DB with NULL > transaction parameter(i.e. no transaction??) > > It looks like this scenario is not supported by BDB. > I simulate above case with a C program to access BDB and get > the similar failure symptom. > ... > txn1 = NULL; > ret = dbenvp1->txn_begin(dbenvp1, NULL, &txn1, 0); > if (ret != 0) { > printf ("Transaction begin failed.\n"); > return 1; > } > put_record(FOO,FOO,txn1, dbp1); > printf("foo\n"); > put_record(FOO,FOO,NULL, dbp1); > printf("bar\n"); > txn1->commit(txn1,0); > printf("baz\n"); > ... > After "foo" is printed, the C program is blocked. If I change the > NULL to txn1, everything is fine. > > > Regarding to the solution, my gut feeling is that it would be > difficult to avoid this kind of nested transaction in migrate > process, because of the recursive function call. Maybe, > *transaction-stack* can be added to track the active transaction > stack. Get it pushed and poped in right place of execute- > transaction. Then, in my-current-transaction, check *transaction- > stack* to see if there is an active transaction belongs to the same > store-controller. If it is found, use it. My simple test shows it > works. If this is the right direction, I can do more test. > > Thanks for your help. > Quan > > > > > > 2008/12/30 quan hu > Hi Ian, Yarek, > > Thanks for providing the information. > I downloaded the elephant-unstable and test it with BDB4.7. > The failure symptom is the same: target store controller get > locked. > > After I make following changes in migrate.lisp; The test passed. > > (defmethod copy-btree-contents ((sc store-controller) dst src) > (let (to-be-migrated) > (map-btree (lambda (key value) > (let ((newval (migrate sc value)) > (newkey (migrate sc key))) > (push (list newkey > newval) to-be-migrated))) > ;;;; (setf (get-value > newkey dst) newval))) ;; > src) > (loop for (k v) in to-be-migrated > do > (setf (get-value k dst) v)))) > > Above debug change just avoids the nested transaction of > different store controller for the specific test case. > However, it is not the solution, as the nested transaction > still could appear in other data pattern. > > What confuses me is that the nested transaction of the same > store controller seem not bring any block. > Following test passed: > (with-transaction (:store-controller *migrate-dst*) > > (add-to-root 'foo 'foo :sc *migrate-dst*) > (with-transaction (:store-controller *migrate-dst*) > > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > But, the nested transaction of different store controller always > results in lock. > > (with-transaction (:store-controller *migrate-dst*) > > (add-to-root 'foo 'foo :sc *migrate-dst*) > (with-transaction (:store-controller *migrate- > src*) ;; trigger database lock > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > Thanks > Quan > > > > 2008/12/30 Yarek Kowalik > > Quan, > > Unstable is here: > > http://www.common-lisp.net/project/elephant/darcs/elephant-unstable > > Yarek > > > On Mon, Dec 29, 2008 at 5:37 AM, Ian Eslick > wrote: > That would be elephant-unstable > > Sent from my iPhone > > On Dec 29, 2008, at 7:36 AM, Ian Eslick wrote: > > > Hi Quan, > > > > Can you try the latest darcs with BDB 4.6 or 4.7? I made some > changes > > to migration, but I can't recall if they were in the latest darcs or > > not - I think the latest darcs doesn't play well with BDB 4.5 so > > please make sure you can reproduce under the above configuration if > > you can. > > > > Thank you, > > Ian > > > > On Dec 29, 2008, at 3:40 AM, quan hu wrote: > > > >> Hello, > >> > >> I run into a problem when doing the garbage collection via data > >> migration. > >> The environment is elephant 0.9.1 and BDB 4.5. I also tried > >> the latest elephant in darc and get the same result. > >> > >> 1. Test case to reproduce the problem. > >> > >> (defpclass user-profile() > >> ((id :initform nil :index t) > >> (sms-inbox :initform (make-pset)))) > >> > >> ;; Create a new db for test purpose > >> (setf *migrate-src* (open-store '(:bdb "/tmp/db/src/"))) > >> (setf *test-obj* (make-instance 'user-profile :sc > >> *migrate-src*)) > >> (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) > >> (setf *migrate-dst* (open-store '(:bdb "/tmp/db/dst/"))) > >> > >> TEST> (migrate *migrate-dst* *migrate-src*) > >> Migrating class indexes for: USER-PROFILE > >> ; => Input get blocked, not response anymore > >> > >> 2. Using "db_stat -C A" get following output: > >> 1 Lock requests not available due to conflicts, for > >> which we waited > >> > >> 3. I do some debug work and found the problem may be caused > >> by nested transaction of different store controller. > >> I can reproduce the issue with following code segment > >> > >> TEST> (ensure-transaction (:store-controller *migrate- > dst*) > >> (add-to-root 'foo 'foo :sc *migrate- > dst*) > >> (ensure-transaction (:store-controller > >> *migrate-src*) > >> (add-to-root 'bar 'bar :sc > *migrate- > >> dst*))) > >> > >> This kind of nested transaction scenario can appear in > >> the migrate process, because it uses source/destination store > >> controller at the same time. > >> > >> I do not understand why different store controller's > >> transaction can result in the lock conflict and want to know how to > >> fix it. > >> > >> Is there anyone meet the similar problem before? > >> > >> Thanks > >> Quan > >> > >> > >> > >> > >> > >> _______________________________________________ > >> elephant-devel site list > >> elephant-devel at common-lisp.net > >> http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel From ihuquan at gmail.com Wed Dec 31 13:37:54 2008 From: ihuquan at gmail.com (quan hu) Date: Wed, 31 Dec 2008 21:37:54 +0800 Subject: [elephant-devel] DB migration issue In-Reply-To: References: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> <49255C15-AE3C-4B83-A73C-940670519C51@media.mit.edu> <1cc8deb80812292147i5d39c76dq612c2d0b2e5dc70b@mail.gmail.com> <1cc8deb80812300634n57d81ca4iaf770dbc3c7b0dfd@mail.gmail.com> Message-ID: <1cc8deb80812310537n7048dbd5w14f200d990dd2439@mail.gmail.com> Hi Ian, I downloaded the patches and have more testing today. The lock issue is gone! Thanks a lot. 1. But, another issue is found. migrate pathname fails. I test it under SBCL 1.0.21 e.g. > (migrate *store-controller* #p"/tmp) => Error: Cannot migrate function objects (i.e. #) It is caused by that (defmethod migrate ((dst store-controller) (src structure-object) is called for this case, as pathname is taken as subtype of structure-object. > (subtypep 'pathname 'structure-object) => t t Maybe, one more migrate method is needed for pathname case. 2. I also want to know if upgrading database file from 0.9.1 to unstable release is supported. When opening the DB file generated in 0.9.1 in unstable release, I get error message " The slot DB-BDB::INDICES is unbound in the object #. [Condition of type UNBOUND-SLOT]" Thanks Quan 2008/12/31 Ian Eslick > Hi Quan, > > Thank you again for the information on this bug. The short story is > that the way we are keeping track of transactions assumed that there > were only two stores in the nested transaction stack (outer and > inner). Migrating a nested object inside a with-transaction would not > pass the parent transaction to the backend so it wouldn't know a > transaction in progress and attempted to start a new one, which would > block until the old one was completed. > > I just checked in a patch that made transaction tracking a bit more > intelligent (it depends on the backends taking care of handling nested > transactions - which I believe they all do fine). I also checked in a > test which implements Quan's test case. > > This patch and the prior patches of the past few days pass all tests > on SBCL/Mac/BDB. > > Ian > > PS - I'd love to know the current status of the elephant-unstable tree > with the postmodern backend. > > > On Dec 30, 2008, at 9:34 AM, quan hu wrote: > > > Hello, > > > > After more investigation, here are some suspects: > > > > In the current elephant codes, the macro my-current- > > transaction will check if the current transaction belongs to the sc > > parameter. If not, just return +NULL-CHAR+. That's exactly the > > case in the following nested transaction where the store-controller > > is different. > > The situation becomes: > > Transaction 1 begins > > One data is put into DB with Transaction 1 > > ... > > Another data is put into the same DB with NULL > > transaction parameter(i.e. no transaction??) > > > > It looks like this scenario is not supported by BDB. > > I simulate above case with a C program to access BDB and get > > the similar failure symptom. > > ... > > txn1 = NULL; > > ret = dbenvp1->txn_begin(dbenvp1, NULL, &txn1, 0); > > if (ret != 0) { > > printf ("Transaction begin failed.\n"); > > return 1; > > } > > put_record(FOO,FOO,txn1, dbp1); > > printf("foo\n"); > > put_record(FOO,FOO,NULL, dbp1); > > printf("bar\n"); > > txn1->commit(txn1,0); > > printf("baz\n"); > > ... > > After "foo" is printed, the C program is blocked. If I change the > > NULL to txn1, everything is fine. > > > > > > Regarding to the solution, my gut feeling is that it would be > > difficult to avoid this kind of nested transaction in migrate > > process, because of the recursive function call. Maybe, > > *transaction-stack* can be added to track the active transaction > > stack. Get it pushed and poped in right place of execute- > > transaction. Then, in my-current-transaction, check *transaction- > > stack* to see if there is an active transaction belongs to the same > > store-controller. If it is found, use it. My simple test shows it > > works. If this is the right direction, I can do more test. > > > > Thanks for your help. > > Quan > > > > > > > > > > > > 2008/12/30 quan hu > > Hi Ian, Yarek, > > > > Thanks for providing the information. > > I downloaded the elephant-unstable and test it with BDB4.7. > > The failure symptom is the same: target store controller get > > locked. > > > > After I make following changes in migrate.lisp; The test passed. > > > > (defmethod copy-btree-contents ((sc store-controller) dst src) > > (let (to-be-migrated) > > (map-btree (lambda (key value) > > (let ((newval (migrate sc value)) > > (newkey (migrate sc key))) > > (push (list newkey > > newval) to-be-migrated))) > > ;;;; (setf (get-value > > newkey dst) newval))) ;; > > src) > > (loop for (k v) in to-be-migrated > > do > > (setf (get-value k dst) v)))) > > > > Above debug change just avoids the nested transaction of > > different store controller for the specific test case. > > However, it is not the solution, as the nested transaction > > still could appear in other data pattern. > > > > What confuses me is that the nested transaction of the same > > store controller seem not bring any block. > > Following test passed: > > (with-transaction (:store-controller *migrate-dst*) > > > > (add-to-root 'foo 'foo :sc *migrate-dst*) > > (with-transaction (:store-controller *migrate-dst*) > > > > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > > > But, the nested transaction of different store controller always > > results in lock. > > > > (with-transaction (:store-controller *migrate-dst*) > > > > (add-to-root 'foo 'foo :sc *migrate-dst*) > > (with-transaction (:store-controller *migrate- > > src*) ;; trigger database lock > > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > > > Thanks > > Quan > > > > > > > > 2008/12/30 Yarek Kowalik > > > > Quan, > > > > Unstable is here: > > > > http://www.common-lisp.net/project/elephant/darcs/elephant-unstable > > > > Yarek > > > > > > On Mon, Dec 29, 2008 at 5:37 AM, Ian Eslick > > wrote: > > That would be elephant-unstable > > > > Sent from my iPhone > > > > On Dec 29, 2008, at 7:36 AM, Ian Eslick wrote: > > > > > Hi Quan, > > > > > > Can you try the latest darcs with BDB 4.6 or 4.7? I made some > > changes > > > to migration, but I can't recall if they were in the latest darcs or > > > not - I think the latest darcs doesn't play well with BDB 4.5 so > > > please make sure you can reproduce under the above configuration if > > > you can. > > > > > > Thank you, > > > Ian > > > > > > On Dec 29, 2008, at 3:40 AM, quan hu wrote: > > > > > >> Hello, > > >> > > >> I run into a problem when doing the garbage collection via data > > >> migration. > > >> The environment is elephant 0.9.1 and BDB 4.5. I also tried > > >> the latest elephant in darc and get the same result. > > >> > > >> 1. Test case to reproduce the problem. > > >> > > >> (defpclass user-profile() > > >> ((id :initform nil :index t) > > >> (sms-inbox :initform (make-pset)))) > > >> > > >> ;; Create a new db for test purpose > > >> (setf *migrate-src* (open-store '(:bdb "/tmp/db/src/"))) > > >> (setf *test-obj* (make-instance 'user-profile :sc > > >> *migrate-src*)) > > >> (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) > > >> (setf *migrate-dst* (open-store '(:bdb "/tmp/db/dst/"))) > > >> > > >> TEST> (migrate *migrate-dst* *migrate-src*) > > >> Migrating class indexes for: USER-PROFILE > > >> ; => Input get blocked, not response anymore > > >> > > >> 2. Using "db_stat -C A" get following output: > > >> 1 Lock requests not available due to conflicts, for > > >> which we waited > > >> > > >> 3. I do some debug work and found the problem may be caused > > >> by nested transaction of different store controller. > > >> I can reproduce the issue with following code segment > > >> > > >> TEST> (ensure-transaction (:store-controller *migrate- > > dst*) > > >> (add-to-root 'foo 'foo :sc *migrate- > > dst*) > > >> (ensure-transaction (:store-controller > > >> *migrate-src*) > > >> (add-to-root 'bar 'bar :sc > > *migrate- > > >> dst*))) > > >> > > >> This kind of nested transaction scenario can appear in > > >> the migrate process, because it uses source/destination store > > >> controller at the same time. > > >> > > >> I do not understand why different store controller's > > >> transaction can result in the lock conflict and want to know how to > > >> fix it. > > >> > > >> Is there anyone meet the similar problem before? > > >> > > >> Thanks > > >> Quan > > >> > > >> > > >> > > >> > > >> > > >> _______________________________________________ > > >> elephant-devel site list > > >> elephant-devel at common-lisp.net > > >> http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > > > > _______________________________________________ > > > elephant-devel site list > > > elephant-devel at common-lisp.net > > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eslick at media.mit.edu Wed Dec 31 15:27:02 2008 From: eslick at media.mit.edu (Ian Eslick) Date: Wed, 31 Dec 2008 10:27:02 -0500 Subject: [elephant-devel] DB migration issue In-Reply-To: <1cc8deb80812310537n7048dbd5w14f200d990dd2439@mail.gmail.com> References: <1cc8deb80812290040k7720ca03hdbca03dbd8375135@mail.gmail.com> <49255C15-AE3C-4B83-A73C-940670519C51@media.mit.edu> <1cc8deb80812292147i5d39c76dq612c2d0b2e5dc70b@mail.gmail.com> <1cc8deb80812300634n57d81ca4iaf770dbc3c7b0dfd@mail.gmail.com> <1cc8deb80812310537n7048dbd5w14f200d990dd2439@mail.gmail.com> Message-ID: <286EADCF-6B83-4A2F-981E-C085311892FB@media.mit.edu> I don't think we've tried the upgrade procedure in awhile, so it's possible an incompatibility slipped in. It may be that all you need to do is make sure that defaults are properly created for slot values that are unbound during the store controller opening phase. Adding a case for pathname is easy enough. I take it one of the slots of the pathname structure object is a function; migrating this is causing the error. With a little work you should be able to do both of these fixes, certainly the pathname fix. I'd be happy to review and commit them to the repository, but unfortunately I won't have any more time to work on elephant for a little while. Ian On Dec 31, 2008, at 8:37 AM, quan hu wrote: > Hi Ian, > > I downloaded the patches and have more testing today. The lock > issue is gone! > Thanks a lot. > > 1. But, another issue is found. migrate pathname fails. I test > it under SBCL 1.0.21 > e.g. > > (migrate *store-controller* #p"/tmp) => Error: Cannot > migrate function objects (i.e. # ENOUGH>) > > It is caused by that (defmethod migrate ((dst store- > controller) (src structure-object) is called for this case, as > pathname is taken as subtype of structure-object. > > (subtypep 'pathname 'structure-object) => t t > Maybe, one more migrate method is needed for pathname case. > > 2. I also want to know if upgrading database file from 0.9.1 > to unstable release is supported. > When opening the DB file generated in 0.9.1 in unstable > release, I get error message > " The slot DB-BDB::INDICES is unbound in the object # INDEXED-BTREE oid:-3>. > [Condition of type UNBOUND-SLOT]" > > Thanks > Quan > > > > > 2008/12/31 Ian Eslick > Hi Quan, > > Thank you again for the information on this bug. The short story is > that the way we are keeping track of transactions assumed that there > were only two stores in the nested transaction stack (outer and > inner). Migrating a nested object inside a with-transaction would not > pass the parent transaction to the backend so it wouldn't know a > transaction in progress and attempted to start a new one, which would > block until the old one was completed. > > I just checked in a patch that made transaction tracking a bit more > intelligent (it depends on the backends taking care of handling nested > transactions - which I believe they all do fine). I also checked in a > test which implements Quan's test case. > > This patch and the prior patches of the past few days pass all tests > on SBCL/Mac/BDB. > > Ian > > PS - I'd love to know the current status of the elephant-unstable tree > with the postmodern backend. > > > On Dec 30, 2008, at 9:34 AM, quan hu wrote: > > > Hello, > > > > After more investigation, here are some suspects: > > > > In the current elephant codes, the macro my-current- > > transaction will check if the current transaction belongs to the sc > > parameter. If not, just return +NULL-CHAR+. That's exactly the > > case in the following nested transaction where the store-controller > > is different. > > The situation becomes: > > Transaction 1 begins > > One data is put into DB with Transaction 1 > > ... > > Another data is put into the same DB with NULL > > transaction parameter(i.e. no transaction??) > > > > It looks like this scenario is not supported by BDB. > > I simulate above case with a C program to access BDB and get > > the similar failure symptom. > > ... > > txn1 = NULL; > > ret = dbenvp1->txn_begin(dbenvp1, NULL, &txn1, 0); > > if (ret != 0) { > > printf ("Transaction begin failed.\n"); > > return 1; > > } > > put_record(FOO,FOO,txn1, dbp1); > > printf("foo\n"); > > put_record(FOO,FOO,NULL, dbp1); > > printf("bar\n"); > > txn1->commit(txn1,0); > > printf("baz\n"); > > ... > > After "foo" is printed, the C program is blocked. If I change the > > NULL to txn1, everything is fine. > > > > > > Regarding to the solution, my gut feeling is that it would be > > difficult to avoid this kind of nested transaction in migrate > > process, because of the recursive function call. Maybe, > > *transaction-stack* can be added to track the active transaction > > stack. Get it pushed and poped in right place of execute- > > transaction. Then, in my-current-transaction, check *transaction- > > stack* to see if there is an active transaction belongs to the same > > store-controller. If it is found, use it. My simple test shows it > > works. If this is the right direction, I can do more test. > > > > Thanks for your help. > > Quan > > > > > > > > > > > > 2008/12/30 quan hu > > Hi Ian, Yarek, > > > > Thanks for providing the information. > > I downloaded the elephant-unstable and test it with BDB4.7. > > The failure symptom is the same: target store controller get > > locked. > > > > After I make following changes in migrate.lisp; The test > passed. > > > > (defmethod copy-btree-contents ((sc store-controller) dst src) > > (let (to-be-migrated) > > (map-btree (lambda (key value) > > (let ((newval (migrate sc > value)) > > (newkey (migrate sc > key))) > > (push (list newkey > > newval) to-be-migrated))) > > ;;;; (setf (get-value > > newkey dst) newval))) ;; > > src) > > (loop for (k v) in to-be-migrated > > do > > (setf (get-value k dst) v)))) > > > > Above debug change just avoids the nested transaction of > > different store controller for the specific test case. > > However, it is not the solution, as the nested transaction > > still could appear in other data pattern. > > > > What confuses me is that the nested transaction of the same > > store controller seem not bring any block. > > Following test passed: > > (with-transaction (:store-controller *migrate-dst*) > > > > (add-to-root 'foo 'foo :sc *migrate-dst*) > > (with-transaction (:store-controller *migrate-dst*) > > > > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > > > But, the nested transaction of different store controller always > > results in lock. > > > > (with-transaction (:store-controller *migrate-dst*) > > > > (add-to-root 'foo 'foo :sc *migrate-dst*) > > (with-transaction (:store-controller *migrate- > > src*) ;; trigger database lock > > (add-to-root 'bar 'bar :sc *migrate-dst*))) > > > > Thanks > > Quan > > > > > > > > 2008/12/30 Yarek Kowalik > > > > Quan, > > > > Unstable is here: > > > > http://www.common-lisp.net/project/elephant/darcs/elephant-unstable > > > > Yarek > > > > > > On Mon, Dec 29, 2008 at 5:37 AM, Ian Eslick > > wrote: > > That would be elephant-unstable > > > > Sent from my iPhone > > > > On Dec 29, 2008, at 7:36 AM, Ian Eslick > wrote: > > > > > Hi Quan, > > > > > > Can you try the latest darcs with BDB 4.6 or 4.7? I made some > > changes > > > to migration, but I can't recall if they were in the latest > darcs or > > > not - I think the latest darcs doesn't play well with BDB 4.5 so > > > please make sure you can reproduce under the above configuration > if > > > you can. > > > > > > Thank you, > > > Ian > > > > > > On Dec 29, 2008, at 3:40 AM, quan hu wrote: > > > > > >> Hello, > > >> > > >> I run into a problem when doing the garbage collection via > data > > >> migration. > > >> The environment is elephant 0.9.1 and BDB 4.5. I also tried > > >> the latest elephant in darc and get the same result. > > >> > > >> 1. Test case to reproduce the problem. > > >> > > >> (defpclass user-profile() > > >> ((id :initform nil :index t) > > >> (sms-inbox :initform (make-pset)))) > > >> > > >> ;; Create a new db for test purpose > > >> (setf *migrate-src* (open-store '(:bdb "/tmp/db/ > src/"))) > > >> (setf *test-obj* (make-instance 'user-profile :sc > > >> *migrate-src*)) > > >> (insert-item 'foo (slot-value *test-obj* 'sms-inbox)) > > >> (setf *migrate-dst* (open-store '(:bdb "/tmp/db/ > dst/"))) > > >> > > >> TEST> (migrate *migrate-dst* *migrate-src*) > > >> Migrating class indexes for: USER-PROFILE > > >> ; => Input get blocked, not response anymore > > >> > > >> 2. Using "db_stat -C A" get following output: > > >> 1 Lock requests not available due to conflicts, > for > > >> which we waited > > >> > > >> 3. I do some debug work and found the problem may be > caused > > >> by nested transaction of different store controller. > > >> I can reproduce the issue with following code segment > > >> > > >> TEST> (ensure-transaction (:store-controller *migrate- > > dst*) > > >> (add-to-root 'foo 'foo :sc *migrate- > > dst*) > > >> (ensure-transaction (:store-controller > > >> *migrate-src*) > > >> (add-to-root 'bar 'bar :sc > > *migrate- > > >> dst*))) > > >> > > >> This kind of nested transaction scenario can appear > in > > >> the migrate process, because it uses source/destination store > > >> controller at the same time. > > >> > > >> I do not understand why different store controller's > > >> transaction can result in the lock conflict and want to know > how to > > >> fix it. > > >> > > >> Is there anyone meet the similar problem before? > > >> > > >> Thanks > > >> Quan > > >> > > >> > > >> > > >> > > >> > > >> _______________________________________________ > > >> elephant-devel site list > > >> elephant-devel at common-lisp.net > > >> http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > > > > _______________________________________________ > > > elephant-devel site list > > > elephant-devel at common-lisp.net > > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > > _______________________________________________ > elephant-devel site list > elephant-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel