Page "Proposals/BEP-0010" was added by matevzb
Comment: initial draft
Content:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
= BEP 10 : Ticket Numbering

[[PageOutline]]

|| '''BEP''' || 10 ||
|| '''Title''' || Ticket Numbering ||
|| '''Version''' || Draft ||
|| '''Last-Modified''' ||  ||
|| '''Author''' ||  ||
|| '''Status''' || Draft ||
|| '''Type''' || Standards Track ||
|| '''Content-Type''' || [wiki:PageTemplates/Proposals text/x-trac-wiki] ||
|| '''Created''' ||  ||
|| '''Post-History''' ||  ||

----


== Abstract
This proposal describes a new ticket numbering mechanism to provide a more 
seamless transition for upgrading single-product environments to a multiproduct 
one, as well as for importing data from other multiproduct-aware issue trackers.


== Motivation
A ticket identifier in Trac consists of a single unique integer, the ticket ID. 
This ID is used to reference specific tickets throughout a Trac environment - 
in wiki links, ticket comments, queries etc. It is also used to build URLs that 
point to specific tickets - for example, an ID of {{{42}}} maps to ticket URL 
{{{<host>/<environment>/ticket/42}}}.

With the introduction of multiproduct functionality in Bloodhound the numbering 
schema did not change, however the semantics of ticket IDs did.
A ticket ID in itself is not bound to a specific product (i.e. it remains 
"global", and also unique), but a ticket URL generated from the ID is. The 
ticket with ID {{{42}}}, belonging to a product {{{"turtle"}}} is mapped to URL 
{{{<host>/<environment>/products/turtle/ticket/42}}}.

As a consequence, it is currently impossible to preserve ticket references when 
importing multiple products into one Bloodhound environment.


== Proposal
For multiproduct purposes it would be beneficial to have product-scoped ticket 
IDs. The main reasons for this are:
* Existing ticket URLs remain the "same" after upgrade to multiproduct, e.g. 
{{{/env/ticket/42}}} becomes {{{/env/products/prefix/ticket/42}}}. This will 
mostly affect existing Trac and Bloodhound installations.
* When importing a new product, the same product-scoped IDs can be kept 
regardless of the (possibly different) global ticket IDs. This will be 
especially relevant for any future plugins/utilities that would implement 
functionality for importing from other, non-Trac-based defect trackers (e.g. 
Redmine, Subversion's issue tracker, Jira, Bugzilla etc.)

There are two main ideas proposed for implementation, outlined below.

=== Alternative 1: Global ID + scoped ID
A new, product-scoped ID would be added to the Ticket table, the global ID 
would remain the same. The scoped ID would be unique per product, and a pair of 
(product-prefix, scoped-id) would form a new, unique identifier for the ticket.

Tickets can thus be referenced in two ways:
* Using the global ID, e.g. /env/ticket/42. This would function the same as 
before upgrade.
* Using the product + scoped ID, e.g. /env/ticket/product/<prefix>/10

When upgrading a single product environment to a multiproduct Bloodhound, the 
global IDs would equal the scoped IDs, to ease the transition. Using our 
previous example, the ticket /env/ticket/42 would be upgraded to 
/env/ticket/product/<prefix>/42.


**Database changes**

Old schema
{{{
  PRIMARY KEY: (ticket-id) -> ticket
}}}

New schema
{{{
  PRIMARY KEY: (ticket-id) -> ticket
   UNIQUE KEY: (product-prefix, scoped-id) -> ticket
}}}

Creating a new ticket would increment the ticket-id (same as before), and 
additionally the scoped-id. In order to avoid another database table to keep 
track of the scoped-id,
the scoped-id could be calculated using the SELECT MAX SQL statement.


**URL mappings**
{{{
  /env/ticket/<ticket-id> -> (ticket-id) -> ticket
  /env/products/<product-prefix>/ticket/<scoped-id> -> (product-prefix, 
scoped-id) -> ticket
}}}


**Upgrade**

Upgrading from a single product environment would retain the global IDs. The 
scoped IDs created during upgrade would be identical their global IDs.


**Import**

Importing a new product into existing multiproduct environment would work in 
the following manner:
* Each ticket gets a new global ID
* The scoped IDs are retained from the imported product

**Implications**

{{{TBD}}}


=== Alternative 2: Modification of global ID
In this case the global ID would lose its role as a unique database primary 
key. Instead it would be changed to being unique only per product, and the pair 
of (product-prefix, global-id) would become a new database primary key.


**Database changes**

Old schema
{{{
  PRIMARY KEY: (ticket-id) -> ticket
}}}

New schema
{{{
  PRIMARY KEY: (product-prefix, ticket-id) -> ticket
}}}

**URL mappings**
{{{
  /env/products/<product-prefix>/ticket/<ticket-id> -> (product-prefix, 
ticket-id) -> ticket
}}}


**Upgrade**

Upgrading from a single product environment would remove the primary key from 
the global ID column, and add a new unique primary key for the (product-prefix, 
ticket-id) pair.


**Import**

Importing a new product into existing multiproduct environment would simply 
create the (product-prefix, ticket-id) pair for each imported ticket.

**Implications**

{{{TBD}}}
(Potential technical/performance issues with index not being incremental, check 
against supported SQL databases)



== Resources
Source code management is powered by [http://subversion.apache.org/ Apache™ 
Subversion].


== References
=== Bloodhound Proposals
* [wiki:BEP-0003 BEP 3 : Multi-product architecture]

=== Mailing list discussions
* http://apache.markmail.org/thread/j76pfehwxccqvq2f

== Copyright
Copyright © 2009-2013 The [http://www.apache.org Apache Software Foundation] 
[[BR]] 
Licensed under the [http://www.apache.org/licenses/LICENSE-2.0 Apache License, 
Version 2.0].

Apache Bloodhound, Apache, the Apache feather logo, and the Apache Bloodhound 
project logo are trademarks of The Apache Software Foundation.
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://issues.apache.org/bloodhound/wiki/Proposals/BEP-0010>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

This is an automated message. Someone added your email address to be
notified of changes on 'Proposals/BEP-0010' page.
If it was not you, please report to .

Reply via email to