You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by John McNally <jm...@collab.net> on 2001/11/06 01:25:12 UTC

Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

One thing that could be done to help with the id_table is to remove the
current pk column and use the table_name column as the pk.  The pk is
never referenced elsewhere in the schema, so it should not be a
problem.  Otherwise, I guess if it was accessed via om/peer classes, it
might be possible to use idMethod="native" to get the pk's.  Or should
we define row 0 to be the pk's for the id_table and user
idMethod="idbroker"? not sure if there are problems with this.

john mcnally

Jon Stevens wrote:
> 
> on 11/5/01 3:51 PM, "jvanzyl@apache.org" <jv...@apache.org> wrote:
> 
> > - fixed a typo to make the runtime tests work with postgres and we have the
> >   first problem revealed :-) The IDBroker will not work with Postgres.
> >   I think the system was built being fairly MySQL-centric but we'll fix that
> >   :-)
> >
> 
> The IDBroker needs to be redone using Torque.
> 
> -jon
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by Guido Sohne <ca...@yahoo.com>.
> > If the performance came within 10% and we could get rid of all the crap
> > required to deal with native methods of ID generation would it still bother
> > you?
> 
> I would prefer always having the option of both using the database's
> native sequence generation, or using the ID broker--choice is
> appreciated (as long as reasonable defaults are supplied).  Also of
> note is that use of native sequences is in wide deployment, and
> removal of it would require extensive data migration to production
> sites.

I think choice is good as well. For example, if you have several threads
running idbroker against the same database (with transactions), each thread
gets a set of id number that it can dispense as needed to new objects.

Now what happens if I need to connect to the database using a command line 
SQL client or I need to create some objects by hand ? How will I know what
ID is safe to use ?

Worse, if one decides to solve this issue by convention, such as IDs are 
multiples of ten (gaps in the ID space that can be filled later) then 
two more problems result. First is inconsistency of IDs within the system
because I will basically have to choose an ID that is derived differently
from idbroker to ensure that there is no clash. Just like using reserved
ID ranges for emergencies. Second is that the ID space can become sparse
because some thread quit before it could dispense all IDs from its range.

So I think idbroker is nice but is not the only way to go. It should 
probably be tunable as well as pluggable. Once it can be generated by
Torque, it can use whatever method you prefer in the context of what
you want to achieve.

__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Jason van Zyl <jv...@zenplex.com> writes:

> On 11/6/01 11:23 PM, "Daniel Rall" <dl...@finemaltcoding.com> wrote:
>
>> Jason van Zyl <jv...@zenplex.com> writes:
>> 
>>> Some people like using sequences/autoincrement because they say it's faster,
>>> but while working on the testbed I'm going to make some tests to see what
>>> the actual difference is. It wouldn't bother me at all if the idbroker was
>>> the only choice for ID generation.
>> 
>> It would bother me.  =)
>
> Yes, but the question is why? I asked someone else this too. The belief is
> one of performance but is this assumption justified?
>
> If there was no performance penalty would it still bother you?

I don't what the performance of the ID broker is -- I've never
profiled it and compared it against MySQL and Oracle native sequence
generation.

> If the performance came within 10% and we could get rid of all the crap
> required to deal with native methods of ID generation would it still bother
> you?

I would prefer always having the option of both using the database's
native sequence generation, or using the ID broker--choice is
appreciated (as long as reasonable defaults are supplied).  Also of
note is that use of native sequences is in wide deployment, and
removal of it would require extensive data migration to production
sites.

> I want to run the tests to see what the difference is. I'd actually like to
> try the hi/lo method described in ambler's papers to try and eliminate
> bottlenecks in ID generation. The ID generator will soon be pluggable so
> these things can be tested and than at least we'll have a body of data to
> base decisions on.

I would also like to see some numbers.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by Dan Bachelder <ch...@chowda.net>.
> > It would bother me.  =)
>
> Yes, but the question is why? I asked someone else this too. The belief is
> one of performance but is this assumption justified?
>
> If there was no performance penalty would it still bother you?

We have more than just torque apps operating on this oracle database... if
everything else is using sequences and torque is not... serious problems...
if I could just have exclusively torque apps I would say no prob... but we
are talking legacy stuff here...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by Jason van Zyl <jv...@zenplex.com>.
On 11/7/01 3:03 PM, "John McNally" <jm...@collab.net> wrote:

> Jason van Zyl wrote:
>> 
>> On 11/6/01 11:23 PM, "Daniel Rall" <dl...@finemaltcoding.com> wrote:
>> 
>>> Jason van Zyl <jv...@zenplex.com> writes:
>>> 
>>>> Some people like using sequences/autoincrement because they say it's
>>>> faster,
>>>> but while working on the testbed I'm going to make some tests to see what
>>>> the actual difference is. It wouldn't bother me at all if the idbroker was
>>>> the only choice for ID generation.
>>> 
>>> It would bother me.  =)
>> 
>> Yes, but the question is why? I asked someone else this too. The belief is
>> one of performance but is this assumption justified?
>> 
>> If there was no performance penalty would it still bother you?
> 
> With a mixture of apps written in different languages, the native id
> approach can be and is probably already specified as it is the easiest
> way to avoid key conflicts.

What about apps that don't use databases for persistence?
 
>> 
>> If the performance came within 10% and we could get rid of all the crap
>> required to deal with native methods of ID generation would it still bother
>> you?
>> 
>> I want to run the tests to see what the difference is. I'd actually like to
>> try the hi/lo method described in ambler's papers to try and eliminate
>> bottlenecks in ID generation. The ID generator will soon be pluggable so
>> these things can be tested and than at least we'll have a body of data to
>> base decisions on.
> 
> I think the idbroker already contains the benefit of the hi/lo method
> without being quite as complex.  I just grabs a series of keys all at
> once and doles them out as needed.  What other benefits would arise from
> separating into a two part key?

The relevant sections in the Mapping Objects To Relational Databases are
2.3 and specificially 2.5.2 (which is how we do it) and 2.3.5 which is a
description of the high/lo method. I've just added references to Ambler's
papers on the Torque site.

 
> john mcnally
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by John McNally <jm...@collab.net>.
Jason van Zyl wrote:
> 
> On 11/6/01 11:23 PM, "Daniel Rall" <dl...@finemaltcoding.com> wrote:
> 
> > Jason van Zyl <jv...@zenplex.com> writes:
> >
> >> Some people like using sequences/autoincrement because they say it's faster,
> >> but while working on the testbed I'm going to make some tests to see what
> >> the actual difference is. It wouldn't bother me at all if the idbroker was
> >> the only choice for ID generation.
> >
> > It would bother me.  =)
> 
> Yes, but the question is why? I asked someone else this too. The belief is
> one of performance but is this assumption justified?
> 
> If there was no performance penalty would it still bother you?

With a mixture of apps written in different languages, the native id
approach can be and is probably already specified as it is the easiest
way to avoid key conflicts.

> 
> If the performance came within 10% and we could get rid of all the crap
> required to deal with native methods of ID generation would it still bother
> you?
> 
> I want to run the tests to see what the difference is. I'd actually like to
> try the hi/lo method described in ambler's papers to try and eliminate
> bottlenecks in ID generation. The ID generator will soon be pluggable so
> these things can be tested and than at least we'll have a body of data to
> base decisions on.

I think the idbroker already contains the benefit of the hi/lo method
without being quite as complex.  I just grabs a series of keys all at
once and doles them out as needed.  What other benefits would arise from
separating into a two part key?

john mcnally

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by "Gonzalo A. Diethelm" <go...@aditiva.com>.
> >> Some people like using sequences/autoincrement because they
> say it's faster,
> >> but while working on the testbed I'm going to make some tests
> to see what
> >> the actual difference is. It wouldn't bother me at all if the
> idbroker was
> >> the only choice for ID generation.
> >
> > It would bother me.  =)
>
> Yes, but the question is why? I asked someone else this too. The belief is
> one of performance but is this assumption justified?
>
> If there was no performance penalty would it still bother you?

I think one reason to stick to the native way (sequences, whatever)
is to be able to generate the ids from other, non-Java apps. For
example, if you are using Oracle, it could make sense to write a
stored procedure to insert new rows in a table; this stored procedure
would surely use the same sequence that the Torque-generated OM code
would use to insert the rows. This way, consistency is assured.

If this scenario makes sense (to me it does), then it is not just
a matter of performance.


--
Gonzalo A. Diethelm
gonzalo.diethelm@aditiva.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by Jason van Zyl <jv...@zenplex.com>.
On 11/6/01 11:23 PM, "Daniel Rall" <dl...@finemaltcoding.com> wrote:

> Jason van Zyl <jv...@zenplex.com> writes:
> 
>> Some people like using sequences/autoincrement because they say it's faster,
>> but while working on the testbed I'm going to make some tests to see what
>> the actual difference is. It wouldn't bother me at all if the idbroker was
>> the only choice for ID generation.
> 
> It would bother me.  =)

Yes, but the question is why? I asked someone else this too. The belief is
one of performance but is this assumption justified?

If there was no performance penalty would it still bother you?

If the performance came within 10% and we could get rid of all the crap
required to deal with native methods of ID generation would it still bother
you?

I want to run the tests to see what the difference is. I'd actually like to
try the hi/lo method described in ambler's papers to try and eliminate
bottlenecks in ID generation. The ID generator will soon be pluggable so
these things can be tested and than at least we'll have a body of data to
base decisions on.
 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Jason van Zyl <jv...@zenplex.com> writes:

> Some people like using sequences/autoincrement because they say it's faster,
> but while working on the testbed I'm going to make some tests to see what
> the actual difference is. It wouldn't bother me at all if the idbroker was
> the only choice for ID generation.

It would bother me.  =)

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


UUIdGenerator [was Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile]

Posted by John McNally <jm...@collab.net>.
resending as I did not wrap the lines very well on the last post and
this thread deserves a subject change

I wrote a UUIdGenerator class and it is in turbine-2 under util.db.  One
problem I had with w3c's and castor's uuid generators is that they use
something like InetAddress.getLocalHost().getHostAddress() to determine
the ip address based part of the id.  This method call (or something
like it, i do not remember exactly what w3c's generator used, but i did
test it) returns 127.0.0.1 on my machine this is certainly not very
unique and even if it did manage to get the address the machine is using
on the lan that is not going to be unique either, if your app is running
on several servers scattered around the internet.  It may be unique
enough for many purposes even given that you have several hosts all
using 127.0.0.1, since you have a millisec precision on the second part
of the key.  But it is not a guarantee of uniqueness.  You should really
use a MAC address which is unavailable to Java or make sure you are
using a public ip address.  So I made this a property setting, which
means it introduces a possible configuration error leading to non-unique
keys, but i think it is better than relying on java to get it right.

Another thing i disliked about these other key generators is that they
create overly long keys as they add non unique delimiter characters,
which i can't see serving any purpose since the keys are too long for
the delimiters to be helpful in remembering the key and there is very
little reason to do so.  They also only hex encode (base16?) the
resulting bytes that make up the key.  Why not base64 encode the bytes
so they are the most compact representation possible?

john mcnally

bplawler@pacbell.net wrote:
> 
> I have been using global universal id's in our application and it has come
> in quite handy on several occasions.  I am definitely of the jvz school of
> thought when it comes to being isolated from particular database features,
> such as automatic id generation.  I initially used the idbroker to create
> id's on the application I am working on now, but changed later to a UUID
> generator from W3C (org.w3c.util.UUID).  This approach takes up more space
> in the database, but it is VERY isolated from the database feature set and
> does not require database activity of any sort to come up with the next
> value.
> 
> -Brian
> 
> On Mon, 5 Nov 2001, Jason van Zyl wrote:
> 
> > On 11/5/01 7:43 PM, "Guido Sohne" <ca...@yahoo.com> wrote:
> >
> > > Also, e.g. MySQL, why bother with idbroker if the database
> > > supports autoincrement or sequences ? Am curious to know
> > > why idbroker.
> >
> > Because it is entirely database vendor independent and it will work with all
> > your applications. Binding yourself to the features of a particular database
> > is a bad idea. Torque can probably deal with this transparently so it's
> > probably not a big deal.
> >
> > Some people like using sequences/autoincrement because they say it's faster,
> > but while working on the testbed I'm going to make some tests to see what
> > the actual difference is. It wouldn't bother me at all if the idbroker was
> > the only choice for ID generation.
> >
> > > I think code like this should be in the database
> > > server itself ...
> >
> > I disagree. Code to support sequences/autoincrement has made Torque more
> > complex. I would imagine that generating id values can be done efficiently.
> > Maybe there is a huge disparity, I don't know for sure but I'll find soon
> > enough.
> >
> > > I also think idbroker should be smart enough to decide what kind
> > > of approach to use. Sequence, autoincrement or transaction etc.
> > >
> > > Would also help to reduce the confusion when trying to decide
> > > what to choose in the schema. Reduce choices in XML schema. I
> > > suppose as Turbine develops it's going to get more complex and
> > > it would be great to make an effort to limit the complexity.
> >
> > Yes, I too would like to limit the complexity. I'd like to get rid of
> > sequence and autoincrement support all together if an IDBroker can be made
> > to be somewhere close to the speed of native handling. If there is a huge
> > disparity than I will recant.
> >
> > > It's been a while since I took a look at the code but I remember
> > > it seeming a bit complex for dispensing numbers from a hashtable
> > > that is populated from the database row values.
> >
> > There are numerous options for the IDBroker and it can eventually made to be
> > pluggable.
> >
> > > --- John McNally <jm...@collab.net> wrote:
> > >> One thing that could be done to help with the id_table is to remove the
> > >> current pk column and use the table_name column as the pk.  The pk is
> > >> never referenced elsewhere in the schema, so it should not be a
> > >> problem.  Otherwise, I guess if it was accessed via om/peer classes, it
> > >> might be possible to use idMethod="native" to get the pk's.  Or should
> > >> we define row 0 to be the pk's for the id_table and user
> > >> idMethod="idbroker"? not sure if there are problems with this.
> > >>
> > >> john mcnally
> > >>
> > >> Jon Stevens wrote:
> > >>>
> > >>> on 11/5/01 3:51 PM, "jvanzyl@apache.org" <jv...@apache.org> wrote:
> > >>>
> > >>>> - fixed a typo to make the runtime tests work with postgres and we have the
> > >>>>   first problem revealed :-) The IDBroker will not work with Postgres.
> > >>>>   I think the system was built being fairly MySQL-centric but we'll fix
> > >>>> that
> > >>>>   :-)
> > >>>>
> > >>>
> > >>> The IDBroker needs to be redone using Torque.
> > >>>
> > >>> -jon
> > >>>
> > >>> --
> > >>> To unsubscribe, e-mail:
> > >>> <ma...@jakarta.apache.org>
> > >>> For additional commands, e-mail:
> > >>> <ma...@jakarta.apache.org>
> > >>
> > >> --
> > >> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > >> For additional commands, e-mail: <ma...@jakarta.apache.org>
> > >>
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Find a job, post your resume.
> > > http://careers.yahoo.com
> > >
> > > --
> > > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > > For additional commands, e-mail: <ma...@jakarta.apache.org>
> >
> >
> 
> --
> ===========================
> Brian Lawler
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:  
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by John McNally <jm...@collab.net>.
I wrote a UUIdGenerator class and it is in turbine-2 under util.db.  One problem I had with w3c's and castor's uuid generators is that they use something like
InetAddress.getLocalHost().getHostAddress() to determine the ip address based part of the id.  This method call (or something like it, i do not remember exactly what w3c's generator used, but i did
test it) returns 127.0.0.1 on my machine this is certainly not very unique and even if it did manage to get the address the machine is using on the lan that is not going to be unique either, if your
app is running on several servers scattered around the internet.  It may be unique enough for many purposes even given that you have several hosts all using 127.0.0.1, since you have a millisec
precision on the second part of the key.  But it is not a guarantee of uniqueness.  You should really use a MAC address which is unavailable to Java or make sure you are using a public ip address.  So
I made this a property setting, which means it introduces a possible configuration error leading to non-unique keys, but i think it is better than relying on java to get it right.

Another thing i disliked about these other key generators is that they create overly long keys as they add non unique delimiter characters, which i can't see serving any purpose since the keys are too
long for the delimiters to be helpful in remembering the key and there is very little reason to do so.  They also only hex encode (base16?) the resulting bytes that make up the key.  Why not base64
encode the bytes so they are the most compact representation possible?

john mcnally

bplawler@pacbell.net wrote:
> 
> I have been using global universal id's in our application and it has come
> in quite handy on several occasions.  I am definitely of the jvz school of
> thought when it comes to being isolated from particular database features,
> such as automatic id generation.  I initially used the idbroker to create
> id's on the application I am working on now, but changed later to a UUID
> generator from W3C (org.w3c.util.UUID).  This approach takes up more space
> in the database, but it is VERY isolated from the database feature set and
> does not require database activity of any sort to come up with the next
> value.
> 
> -Brian
> 
> On Mon, 5 Nov 2001, Jason van Zyl wrote:
> 
> > On 11/5/01 7:43 PM, "Guido Sohne" <ca...@yahoo.com> wrote:
> >
> > > Also, e.g. MySQL, why bother with idbroker if the database
> > > supports autoincrement or sequences ? Am curious to know
> > > why idbroker.
> >
> > Because it is entirely database vendor independent and it will work with all
> > your applications. Binding yourself to the features of a particular database
> > is a bad idea. Torque can probably deal with this transparently so it's
> > probably not a big deal.
> >
> > Some people like using sequences/autoincrement because they say it's faster,
> > but while working on the testbed I'm going to make some tests to see what
> > the actual difference is. It wouldn't bother me at all if the idbroker was
> > the only choice for ID generation.
> >
> > > I think code like this should be in the database
> > > server itself ...
> >
> > I disagree. Code to support sequences/autoincrement has made Torque more
> > complex. I would imagine that generating id values can be done efficiently.
> > Maybe there is a huge disparity, I don't know for sure but I'll find soon
> > enough.
> >
> > > I also think idbroker should be smart enough to decide what kind
> > > of approach to use. Sequence, autoincrement or transaction etc.
> > >
> > > Would also help to reduce the confusion when trying to decide
> > > what to choose in the schema. Reduce choices in XML schema. I
> > > suppose as Turbine develops it's going to get more complex and
> > > it would be great to make an effort to limit the complexity.
> >
> > Yes, I too would like to limit the complexity. I'd like to get rid of
> > sequence and autoincrement support all together if an IDBroker can be made
> > to be somewhere close to the speed of native handling. If there is a huge
> > disparity than I will recant.
> >
> > > It's been a while since I took a look at the code but I remember
> > > it seeming a bit complex for dispensing numbers from a hashtable
> > > that is populated from the database row values.
> >
> > There are numerous options for the IDBroker and it can eventually made to be
> > pluggable.
> >
> > > --- John McNally <jm...@collab.net> wrote:
> > >> One thing that could be done to help with the id_table is to remove the
> > >> current pk column and use the table_name column as the pk.  The pk is
> > >> never referenced elsewhere in the schema, so it should not be a
> > >> problem.  Otherwise, I guess if it was accessed via om/peer classes, it
> > >> might be possible to use idMethod="native" to get the pk's.  Or should
> > >> we define row 0 to be the pk's for the id_table and user
> > >> idMethod="idbroker"? not sure if there are problems with this.
> > >>
> > >> john mcnally
> > >>
> > >> Jon Stevens wrote:
> > >>>
> > >>> on 11/5/01 3:51 PM, "jvanzyl@apache.org" <jv...@apache.org> wrote:
> > >>>
> > >>>> - fixed a typo to make the runtime tests work with postgres and we have the
> > >>>>   first problem revealed :-) The IDBroker will not work with Postgres.
> > >>>>   I think the system was built being fairly MySQL-centric but we'll fix
> > >>>> that
> > >>>>   :-)
> > >>>>
> > >>>
> > >>> The IDBroker needs to be redone using Torque.
> > >>>
> > >>> -jon
> > >>>
> > >>> --
> > >>> To unsubscribe, e-mail:
> > >>> <ma...@jakarta.apache.org>
> > >>> For additional commands, e-mail:
> > >>> <ma...@jakarta.apache.org>
> > >>
> > >> --
> > >> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > >> For additional commands, e-mail: <ma...@jakarta.apache.org>
> > >>
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Find a job, post your resume.
> > > http://careers.yahoo.com
> > >
> > > --
> > > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > > For additional commands, e-mail: <ma...@jakarta.apache.org>
> >
> >
> 
> --
> ===========================
> Brian Lawler
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by bp...@pacbell.net.
I have been using global universal id's in our application and it has come
in quite handy on several occasions.  I am definitely of the jvz school of
thought when it comes to being isolated from particular database features,
such as automatic id generation.  I initially used the idbroker to create
id's on the application I am working on now, but changed later to a UUID
generator from W3C (org.w3c.util.UUID).  This approach takes up more space
in the database, but it is VERY isolated from the database feature set and
does not require database activity of any sort to come up with the next
value.

-Brian


On Mon, 5 Nov 2001, Jason van Zyl wrote:

> On 11/5/01 7:43 PM, "Guido Sohne" <ca...@yahoo.com> wrote:
> 
> > Also, e.g. MySQL, why bother with idbroker if the database
> > supports autoincrement or sequences ? Am curious to know
> > why idbroker. 
> 
> Because it is entirely database vendor independent and it will work with all
> your applications. Binding yourself to the features of a particular database
> is a bad idea. Torque can probably deal with this transparently so it's
> probably not a big deal.
> 
> Some people like using sequences/autoincrement because they say it's faster,
> but while working on the testbed I'm going to make some tests to see what
> the actual difference is. It wouldn't bother me at all if the idbroker was
> the only choice for ID generation.
> 
> > I think code like this should be in the database
> > server itself ...
> 
> I disagree. Code to support sequences/autoincrement has made Torque more
> complex. I would imagine that generating id values can be done efficiently.
> Maybe there is a huge disparity, I don't know for sure but I'll find soon
> enough.
>  
> > I also think idbroker should be smart enough to decide what kind
> > of approach to use. Sequence, autoincrement or transaction etc.
> > 
> > Would also help to reduce the confusion when trying to decide
> > what to choose in the schema. Reduce choices in XML schema. I
> > suppose as Turbine develops it's going to get more complex and
> > it would be great to make an effort to limit the complexity.
> 
> Yes, I too would like to limit the complexity. I'd like to get rid of
> sequence and autoincrement support all together if an IDBroker can be made
> to be somewhere close to the speed of native handling. If there is a huge
> disparity than I will recant.
>  
> > It's been a while since I took a look at the code but I remember
> > it seeming a bit complex for dispensing numbers from a hashtable
> > that is populated from the database row values.
> 
> There are numerous options for the IDBroker and it can eventually made to be
> pluggable.
>  
> > --- John McNally <jm...@collab.net> wrote:
> >> One thing that could be done to help with the id_table is to remove the
> >> current pk column and use the table_name column as the pk.  The pk is
> >> never referenced elsewhere in the schema, so it should not be a
> >> problem.  Otherwise, I guess if it was accessed via om/peer classes, it
> >> might be possible to use idMethod="native" to get the pk's.  Or should
> >> we define row 0 to be the pk's for the id_table and user
> >> idMethod="idbroker"? not sure if there are problems with this.
> >> 
> >> john mcnally
> >> 
> >> Jon Stevens wrote:
> >>> 
> >>> on 11/5/01 3:51 PM, "jvanzyl@apache.org" <jv...@apache.org> wrote:
> >>> 
> >>>> - fixed a typo to make the runtime tests work with postgres and we have the
> >>>>   first problem revealed :-) The IDBroker will not work with Postgres.
> >>>>   I think the system was built being fairly MySQL-centric but we'll fix
> >>>> that
> >>>>   :-)
> >>>> 
> >>> 
> >>> The IDBroker needs to be redone using Torque.
> >>> 
> >>> -jon
> >>> 
> >>> --
> >>> To unsubscribe, e-mail:
> >>> <ma...@jakarta.apache.org>
> >>> For additional commands, e-mail:
> >>> <ma...@jakarta.apache.org>
> >> 
> >> --
> >> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> >> For additional commands, e-mail: <ma...@jakarta.apache.org>
> >> 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Find a job, post your resume.
> > http://careers.yahoo.com
> > 
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 

-- 
===========================
Brian Lawler


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by Jason van Zyl <jv...@zenplex.com>.
On 11/5/01 7:43 PM, "Guido Sohne" <ca...@yahoo.com> wrote:

> Also, e.g. MySQL, why bother with idbroker if the database
> supports autoincrement or sequences ? Am curious to know
> why idbroker. 

Because it is entirely database vendor independent and it will work with all
your applications. Binding yourself to the features of a particular database
is a bad idea. Torque can probably deal with this transparently so it's
probably not a big deal.

Some people like using sequences/autoincrement because they say it's faster,
but while working on the testbed I'm going to make some tests to see what
the actual difference is. It wouldn't bother me at all if the idbroker was
the only choice for ID generation.

> I think code like this should be in the database
> server itself ...

I disagree. Code to support sequences/autoincrement has made Torque more
complex. I would imagine that generating id values can be done efficiently.
Maybe there is a huge disparity, I don't know for sure but I'll find soon
enough.
 
> I also think idbroker should be smart enough to decide what kind
> of approach to use. Sequence, autoincrement or transaction etc.
> 
> Would also help to reduce the confusion when trying to decide
> what to choose in the schema. Reduce choices in XML schema. I
> suppose as Turbine develops it's going to get more complex and
> it would be great to make an effort to limit the complexity.

Yes, I too would like to limit the complexity. I'd like to get rid of
sequence and autoincrement support all together if an IDBroker can be made
to be somewhere close to the speed of native handling. If there is a huge
disparity than I will recant.
 
> It's been a while since I took a look at the code but I remember
> it seeming a bit complex for dispensing numbers from a hashtable
> that is populated from the database row values.

There are numerous options for the IDBroker and it can eventually made to be
pluggable.
 
> --- John McNally <jm...@collab.net> wrote:
>> One thing that could be done to help with the id_table is to remove the
>> current pk column and use the table_name column as the pk.  The pk is
>> never referenced elsewhere in the schema, so it should not be a
>> problem.  Otherwise, I guess if it was accessed via om/peer classes, it
>> might be possible to use idMethod="native" to get the pk's.  Or should
>> we define row 0 to be the pk's for the id_table and user
>> idMethod="idbroker"? not sure if there are problems with this.
>> 
>> john mcnally
>> 
>> Jon Stevens wrote:
>>> 
>>> on 11/5/01 3:51 PM, "jvanzyl@apache.org" <jv...@apache.org> wrote:
>>> 
>>>> - fixed a typo to make the runtime tests work with postgres and we have the
>>>>   first problem revealed :-) The IDBroker will not work with Postgres.
>>>>   I think the system was built being fairly MySQL-centric but we'll fix
>>>> that
>>>>   :-)
>>>> 
>>> 
>>> The IDBroker needs to be redone using Torque.
>>> 
>>> -jon
>>> 
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>> 
>> --
>> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>> For additional commands, e-mail: <ma...@jakarta.apache.org>
>> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Find a job, post your resume.
> http://careers.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-torque/profilejvz.postgres.profile

Posted by Guido Sohne <ca...@yahoo.com>.
Also, e.g. MySQL, why bother with idbroker if the database 
supports autoincrement or sequences ? Am curious to know 
why idbroker. I think code like this should be in the database
server itself ...

I also think idbroker should be smart enough to decide what kind
of approach to use. Sequence, autoincrement or transaction etc.

Would also help to reduce the confusion when trying to decide
what to choose in the schema. Reduce choices in XML schema. I
suppose as Turbine develops it's going to get more complex and
it would be great to make an effort to limit the complexity.

It's been a while since I took a look at the code but I remember
it seeming a bit complex for dispensing numbers from a hashtable
that is populated from the database row values.

--- John McNally <jm...@collab.net> wrote:
> One thing that could be done to help with the id_table is to remove the
> current pk column and use the table_name column as the pk.  The pk is
> never referenced elsewhere in the schema, so it should not be a
> problem.  Otherwise, I guess if it was accessed via om/peer classes, it
> might be possible to use idMethod="native" to get the pk's.  Or should
> we define row 0 to be the pk's for the id_table and user
> idMethod="idbroker"? not sure if there are problems with this.
> 
> john mcnally
> 
> Jon Stevens wrote:
> > 
> > on 11/5/01 3:51 PM, "jvanzyl@apache.org" <jv...@apache.org> wrote:
> > 
> > > - fixed a typo to make the runtime tests work with postgres and we have the
> > >   first problem revealed :-) The IDBroker will not work with Postgres.
> > >   I think the system was built being fairly MySQL-centric but we'll fix that
> > >   :-)
> > >
> > 
> > The IDBroker needs to be redone using Torque.
> > 
> > -jon
> > 
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>