From nopa90 at gmail.com Thu Jun 19 02:50:53 2008 From: nopa90 at gmail.com (John Janecek) Date: Thu, 19 Jun 2008 10:50:53 +0800 Subject: [rucksack-devel] Too many seperate transactions mess up rucksack Message-ID: <6e2418ba0806181950r78a50792tbc9ba537e11d12a7@mail.gmail.com> I am a lisp newbie so maybe I am mistaken I am on SBCL 1.015 I make class (with-rucksack (rs *rs-dir* );:if-exists :supersede) (with-transaction () (defclass account () ((username :initform nil :initarg :username :index :number-index :accessor username-of) (password :initform nil :initarg :password :accessor password-of) ) (:index t) (:metaclass persistent-class)))) and then 2 functions below (defun make-test-data () (dotimes (i 100) (print i) (with-rucksack (rs *rs-dir*) (with-transaction () (make-instance 'account :username (random 1000000) :password (random 1919191)) )) )) (defun make-test-data1 () (with-rucksack (rs *rs-dir*) (with-transaction () (dotimes (i 100) (print i) (make-instance 'account :username (random 1000000) :password (random 1919191)) )))) if i do (make-test-data) not all the accounts will end up in the rucksack (sometimes if first time yes) but second time i run no If i do make-test-data1 no problem What is going on ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From alemmens at xs4all.nl Tue Jun 24 20:31:57 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Tue, 24 Jun 2008 22:31:57 +0200 Subject: [rucksack-devel] Too many seperate transactions mess up rucksack In-Reply-To: <6e2418ba0806181950r78a50792tbc9ba537e11d12a7@mail.gmail.com> References: <6e2418ba0806181950r78a50792tbc9ba537e11d12a7@mail.gmail.com> Message-ID: John Janecek wrote: > (defun make-test-data () > (dotimes (i 100) > (print i) > (with-rucksack (rs *rs-dir*) > (with-transaction () > (make-instance 'account :username (random 1000000) :password > (random 1919191)) > )) > )) > > (defun make-test-data1 () > (with-rucksack (rs *rs-dir*) > (with-transaction () > (dotimes (i 100) > (print i) > (make-instance 'account :username (random 1000000) :password (random > 1919191)) > )))) > > if i do (make-test-data) not all the accounts will end up in the rucksack > (sometimes if first time yes) but second time i run no How do you know that not all accounts end up in the rucksack? Could you show the code that you use for determining this? Or do you somehow inspect this manually? Arthur From nopa90 at gmail.com Thu Jun 26 23:48:12 2008 From: nopa90 at gmail.com (John Janecek) Date: Fri, 27 Jun 2008 07:48:12 +0800 Subject: [rucksack-devel] Too many seperate transactions mess up rucksack In-Reply-To: References: <6e2418ba0806181950r78a50792tbc9ba537e11d12a7@mail.gmail.com> Message-ID: <6e2418ba0806261648x43e595fexe84accbe879b4583@mail.gmail.com> > > How do you know that not all accounts end up in the rucksack? > Could you show the code that you use for determining this? Or > do you somehow inspect this manually? > > Arthur > Here is rest of code :) class definition (defvar *rs-dir* (merge-pathnames "Projects/sand-box/data1/" (user-homedir-pathname))) (with-rucksack (rs *rs-dir* );:if-exists :supersede) (with-transaction () (defclass account () ((username :initform nil :initarg :username :index :number-index :accessor username-of) (password :initform nil :initarg :password :accessor password-of) ) (:index t) (:metaclass persistent-class)))) then function that prints and dumps objects (defmethod print-object ((obj account) stream) (print-unreadable-object (obj stream :type t) (with-slots (username password) obj (format stream "~A ~A" username password)))) (defun print-accounts () (with-rucksack (rs *rs-dir*) (with-transaction () (let ((i 0)) (rucksack-map-class rs 'account (lambda (object) (print i) (print object) (setf i (+ i 1)) )))) nil )) So i run (make-test-data) then if i dump the accounts sometimes not all of them ended up inside the rucksack. if i run (make-test-data) a second times, ussually only first few accounts created end up in rucksack. if i do (make-test-data1) it seems ok. Possibly problem is i do not understand how to use rucksack properly. -------------- next part -------------- An HTML attachment was scrubbed... URL: