[rt-users] Can the ticket ID fields in the database be INT UNSIGNED?

Dusty Wilson [Megagram] dusty at megagram.com
Tue Jun 30 15:51:56 EDT 2009


I've noticed that in the tables that the ticket ID is not unsigned.
Is there a use for ticket IDs smaller than zero?  I've adjusted the
schema for my system to use INT UNSIGNED for all of the ticket ID
fields.  I'm needing a big ticket ID number for my purposes.  I just
wonder if I'm going to be breaking anything by doing this.

For some background info:  Our usage of RT is distributed across many
servers.  The ticket ID numbers are generated this way:

    ##### (WILSOND @ 200906210335)
    # use customized ticket id for creation
    my ($id, $ticket_message);
    my $try_create = !$params{id};
    while ($try_create) # loop until no collision (collision has yet to occur)
    {
      my $serverId = 1234; # 4 digits max (example server ID)
      my $randId = int(rand() * 10000); # 4 digits max
      $params{id} = sprintf('%s%04s%04s', time(), $serverId, $randId);
# 18 digits: epochtime(10) + serverId(4) + randId(4)
      ($id, $ticket_message) = $self->SUPER::Create(%params);
      $try_create = 0 if $id; # if success, stop trying
    }
    else
    {
      ($id, $ticket_message) = $self->SUPER::Create(%params);
    }
    #####

Basically it generates a ticket ID using time(), serverId, and a 4
digit random number.  This is used as a form of UUID to ensure that
there aren't any ticket ID collisions in case the different RT servers
don't stay in sync at high precision (sync lag, VPN down, server down,
etc).

Our RT system is being used by a large number of groups at the same
time, all completely separate from each other.  We created a separate
UI to interface with RT for our purposes.  In the future, we could
easily hit 10 new tickets created per second.

Thanks,
Dusty



More information about the rt-users mailing list