Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

How to report duplicate key values in handler::add_index()?

From: Marko Mäkelä <marko.makela(at)oracle.com>
Date: Wed Aug 15 2007 - 06:03:27 EDT


Before the handler::add_index() interface was introduced, CREATE INDEX was implemented by MySQL performing a table scan and invoking handler::write_row() on every record, every index.

I have a problem with reporting duplicate key errors in CREATE UNIQUE INDEX. How can the storage engine return a duplicate key value in handler::add_index()?

As far as I understand, the key value that MySQL reports to the client is read from the TABLE::key_info array by key_unpack(), in sql/key.cc. But it is not obvious to me how this information could be updated. Perhaps something like restore_record() followed by something that copies table->record[0] to table->key_info[]?

Furthermore, is there any better documentation for TABLE than this in table.h:

struct st_table {
...

  uchar *record[2];			/* Pointer to records */
  uchar *write_row_record;		/* Used as optimisation in
  					   THD::write_row */

...
uint status; /* What's in record[0] */

...

};

I don't see any method THD::write_row(). Is the comment supposed to refer to THD::binlog_write_row()? What are the possible values of "status"? What can there be in record[1]?

Best regards,

	Marko Mäkelä
	Innobase Oy/Oracle Corp.
-- 
MySQL Internals Mailing List
For list archives: 
http://lists.mysql.com/internals
To unsubscribe:    
http://lists.mysql.com/internals?unsub=lists@pantek.com
Received on Wed Aug 15 06:04:27 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 07:59:13 EDT

Do you need help?X

Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library