activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruce Snyder" <bruce.sny...@gmail.com>
Subject Re: mysql 4.1 ACTIVEMQ_ACKS primary key length
Date Fri, 17 Oct 2008 16:44:11 GMT
On Thu, Oct 16, 2008 at 1:38 AM, tricpod <tricpod@googlemail.com> wrote:
>
> Hi,
> I  have to install ActiveMQ on a mysql 4.1 database.
> If I create ACTIVEMQ_ACKS with
> CREATE TABLE ACTIVEMQ_ACKS (
>    CONTAINER varchar(250) collate utf8_general_ci NOT NULL,
>    SUB_DEST varchar(250) collate utf8_general_ci default NULL,
>    CLIENT_ID varchar(250) collate utf8_general_ci NOT NULL,
>    SUB_NAME varchar(250) collate utf8_general_ci NOT NULL,
>    SELECTOR varchar(250) collate utf8_general_ci default NULL,
>    LAST_ACKED_ID int(11) default NULL,
>    PRIMARY KEY  (CONTAINER,CLIENT_ID,SUB_NAME)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
>  I got a Error Code : 1071 Specified key was too long; max key length is
> 1024 bytes
> There was written before to it should be safe do decrease some field to 128.
> What kind of data is written to CONTAINER, CLIENT_ID and SUB_NAME?
> To create the primary key I have to decrease all 3 to varchar(113) (3 Byte
> UFT-8*3=1017).
> What is the best way to get this table? All fields same size? Don't use key?

Below is a breakdown of what is stored in each column of the
ACTIVEMQ_ACKS table in ActiveMQ 5.1:

CONTAINER - the destination name
CLIENT_ID - a generated sequence id for the producer
SUB_NAME - the subscription name
SELECTOR - the message selector
LAST_ACKED_ID - the id of the last message that was acked (grabbed from the db)
SUB_DEST - the destination to which the client originally subscribed

Given that none of these items will typically need more than 100
characters, I think you might be OK dropping the size to 113. But this
is, of course, dependent upon the variable length of some of the
fields. I'd say just create it using the shorter length columns and
then test it out with the ActiveMQ examples in the example dir. Just
atart up ActiveMQ and then run 'ant producer' from the example dir to
send 2000 messages to the TEST.FOO queue and then run 'ant consumer'
from the example dir to consume them all. If this works, chances are
you'll be OK unless you will be persisting a large enough number of
messages to push beyond the shorter length columns because there are
incrementing sequences.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/

Mime
View raw message