Hi,

Thanks a lot for your help! I have merged the pull requests.

I agree the bit field should not be needed. It is currently needed mainly
for the PageStore storage mechanism; I think this can be removed once we
only need to support the MVStore.

Regards,
Thomas


On Wed, Apr 15, 2015 at 11:38 AM, Sergi Vladykin <[email protected]>
wrote:

> Thanks, Noel!
>
> But here you are trying to workaround BitField growth while it should not
> grow infinitely at first. Nevertheless your optimization can be helpful.
> I've found out that it was really id leak: in CreateTable.update() we
> allocate object id but since this is a session local object it is not
> getting stored into meta table, then in DropTable we call
> Database.removeMeta, can't find meta entry to drop and don't clear id bit.
> I fixed it and submitted pull request on Github.
>
> Sergi
>
>
> 2015-04-14 17:39 GMT+03:00 Noel Grandin <[email protected]>:
>
>>
>>
>> On 2015-04-14 03:04 PM, Sergi Vladykin wrote:
>>
>>> Guys,
>>>
>>> There is an important performance issue with
>>> Database.allocateObjectId(). Over time it becomes slower and slower.
>>>
>>>
>> Does this patch help?
>>
>> Index: src/main/org/h2/engine/Database.java
>> ===================================================================
>> --- src/main/org/h2/engine/Database.java        (revision 6118)
>> +++ src/main/org/h2/engine/Database.java        (working copy)
>> @@ -920,6 +920,7 @@
>>                      session.log(meta, UndoLogRecord.DELETE, found);
>>                  }
>>                  objectIds.clear(id);
>> +                objectIdsLastClearBit = Math.min(objectIdsLastClearBit,
>> id);
>>                  if (SysProperties.CHECK) {
>>                      checkMetaFree(session, id);
>>                  }
>> @@ -1421,14 +1422,17 @@
>>          }
>>      }
>>
>> +    private int objectIdsLastClearBit = 0;
>> +
>>      /**
>>       * Allocate a new object id.
>>       *
>>       * @return the id
>>       */
>>      public synchronized int allocateObjectId() {
>> -        int i = objectIds.nextClearBit(0);
>> +        int i = objectIds.nextClearBit(objectIdsLastClearBit);
>>          objectIds.set(i);
>> +        objectIdsLastClearBit = i;
>>          return i;
>>
>>      }
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "H2 Database" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/h2-database.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to