Dear all, i am using hierachyroot with inheritance schema as ClassTable. when i see my root table,i find values like this:
I dont understand why after Id = 4 , it starts from 129.. i jsut have three tables with all only 4 rows. domainbuilder creates the four rows again n again on each application start up, it should come from id = 5 ,right, but it is coming from id 129.. i checked other meta tables but no one has consumed those auto generated id... could you please help me to understand this behaviour. there are no object created in between 4 to 129 then y the id is changing... thanks HAN Updated at 18.08.2010 12:07:11sure psulek, that ids will not be rollback. my simple question is how id is getting generated. it has Int64-Generator table which has identity column and it has increment value 128. when i am running the application , key range has been taken which will be 128.,,,i create some 500 records and stop application, now when i run the application again, what wud be the id starting from and how DO knows what id to generate. thats it. pls clear my doubt. thanks HAN Updated at 19.08.2010 6:56:27Thanks Alex, i understand that it will fall into fourth slab i.e 0-128,129-256,257-384,385-512, and so on...hence next time when app runs it will be 513. is it that you are internally checking it that what was the last id generated, based on that check the slab, then generate the new id. Updated at 23.08.2010 7:57:13Sorry Alex, but for sure i am missing some small piece of info. when you say that generetor gives you the next id ,how can generator give you next id when it has null value...you mentioned that you insert default value and then rollback transaction,so this table has null value. so how it can give you next id when it has null value. pls help. This thread was imported from our support forum. The original discussion may contain more detailed answer. |
Alex (Xtensive) wrote:That's because:
Increment size (i.e. key generator cache size) is manageable. DomainConfiguration.KeyGeneratorCacheSize controls this, but globally - i.e. it sets default value for all key generators. AFAIK, currently it's impossible to specify it for a particular key generator, but likely, I'll fix this in few days. Alex (Xtensive) wrote:That's because we always rollback the transaction inserting new row to this table to get new key range. Are these rows really necessary for you there? ;) If you'd study the log produced by DO4 with Debug level, you'll see something like this:
Btw, there is a nice problem related to full IDENTITY support: http://blog.alexyakunin.com/2010/08/con ... oblem.html - see if you'd like to torture your brain a bit ;) psulek wrote:
I'm not MS SQL Server expert but i think that even if you rollback transaction already generated identity ids are not rolled-back and thus each time you make begin tran/new identity insert/rollback tran/ you always generate new identity ids? Am i right, alex? Alex (Xtensive) wrote:> Am i right, alex? Yes. > now when i run the application again, what wud be the id starting from and how DO knows what id to generate. thats it. DO will simply allocate the next bulk of keys by query shown above. Since identity seed value is incremented by 128 each time this happens, if you'll start from Id=1, create exactly 500 entries and will restart the application, the next generated Id will be 513. Issue about specifying cache size for a particular key generator: http://code.google.com/p/dataobjectsdot ... ail?id=779 hannankhanji wrote: Thanks Alex, its clear to me now. but one thing i need to ask here is my "Int64-Generator" table has always one value and that is null. is it right. shouldnt it have some value , like last id generated or so. pls advice. Thanks HAN Test comment - I'd like to check e-mail. Generators with non-default increment are supported now. See http://code.google.com/p/dataobjectsdotnet/issues/detail?id=779 |