Commit graph

54 commits

Author SHA1 Message Date
Ramil Kalimullin
2b179caf9a Fix for bug #34779: crash in checksum table on federated tables
with blobs containing nulls

Problem: FEDERATED SE improperly stores NULL fields in the record buffer.

Fix: store them properly.


mysql-test/r/federated.result:
  Fix for bug #34779: crash in checksum table on federated tables 
  with blobs containing nulls
    - test result.
mysql-test/t/federated.test:
  Fix for bug #34779: crash in checksum table on federated tables 
  with blobs containing nulls
    - test case.
sql/ha_federated.cc:
  Fix for bug #34779: crash in checksum table on federated tables 
  with blobs containing nulls
    - storing a NULL field in the record buffer
      we must initialize its data as other code
      may rely on it.
2008-08-15 11:40:05 +05:00
unknown
5ad505dda2 BUG#35509 - Federated leaks memory when connecting to
localhost/default port

When creating federated table that points to unspecified host or
localhost on unspecified port or port is 0, small memory leak occurs.

This happens because we make a copy of unix socket path, which is
never freed.

With this fix we do not make a copy of unix socket path, instead
share->socket points to MYSQL_UNIX_ADDR constant directly.

This fix is covered by a test case for BUG34788.

Affects 5.0 only.


mysql-test/t/federated.test:
  A test case for BUG#35509.
sql/ha_federated.cc:
  When creating federated table we call parse_url() to check if connect
  string is correct. parse_url() may make a copy of unix socket path if
  port is not specified or 0 and host is not specified or 'localhost'.
  This copy is never freed.
  
  As there is no need to make a copy of unix socket path, let
  share->socket point to MYSQL_UNIX_ADDR directly.
2008-03-25 12:47:57 +04:00
unknown
8030bdfc16 BUG#34788 - malformed federated connection url is not handled
correctly - crashes server !

Creating federated table with connect string containing empty
(zero-length) host name and port is evaluated as 0 (port is
incorrect, omitted or 0) crashes server.

This happens because federated calls strcmp() with NULL pointer.

Fixed by avoiding strcmp() call if hostname is set to NULL.


mysql-test/r/federated.result:
  A test case for BUG#34788.
mysql-test/t/federated.test:
  A test case for BUG#34788.
sql/ha_federated.cc:
  Fixed that parse_url() may call strcmp() with NULL pointer.
2008-03-20 19:07:17 +04:00
unknown
55f6727b70 BUG#33946 - Join on Federated tables with Unique index gives error 1430
from storage engine

Federated may crash a server, return wrong result set, return
"ERROR 1030 (HY000): Got error 1430 from storage engine" message
when local (engine=federated) table has a key against nullable
column.

The problem was wrong implementation of function that creates
WHERE clause for remote query from key.


mysql-test/r/federated.result:
  A test case for BUG#33946.
mysql-test/t/federated.test:
  A test case for BUG#33946.
sql/ha_federated.cc:
  Fixed that federated adds " IS NULL " condition to a remote query,
  whereas "IS NOT NULL" requested by original query.
  
  Fixed that federated didn't check for end of key buffer, didn't
  setup key buffer pointer and remaining lenght of key buffer,
  didn't add " AND " between conditions in case original query
  has IS [NOT] NULL condition against nullable column.
  
  Fixed that federated wrongly shifts key buffer pointer by extra
  one byte when key part may be null (was: store_length + 1,
  now: store_length).
2008-02-14 16:27:01 +04:00
unknown
cef31e05e5 Bug #32374 crash with filesort when selecting from federated table and view.
filesort() uses file->estimate_rows_upper_bound() call to allocate
internal buffers. If this function returns a value smaller than
a number of row that will be returned later in find_all_keys(),
that can cause server crash.
Fixed by implementing ha_federated::estimate_rows_upper_bound() to
return maximum possible number of rows.
Present estimation for FEDERATED always returns 0 if the linked to the VIEW.


mysql-test/r/federated.result:
  Bug #32374 crash with filesort when selecting from federated table and view.
  
  test result
mysql-test/t/federated.test:
  Bug #32374 crash with filesort when selecting from federated table and view.
  
  test case
sql/ha_federated.cc:
  Bug #32374 crash with filesort when selecting from federated table and view.
  
  ha_federated::estimate_rows_upper_bound() implemented
sql/ha_federated.h:
  Bug #32374 crash with filesort when selecting from federated table and view.
  
  ha_federated::estimate_rows_upper_bound() interface
2007-11-30 17:08:00 +04:00
unknown
e6701d746d Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.(none):/opt/local/work/mysql-5.0-runtime


mysql-test/r/federated.result:
  Auto merged
mysql-test/t/federated.test:
  Auto merged
sql/item.cc:
  Auto merged
2007-08-08 11:34:35 +04:00
unknown
41ac5d83b2 Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50


mysql-test/r/federated.result:
  Auto merged
mysql-test/t/federated.test:
  Auto merged
sql/ha_federated.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Manual merge
mysql-test/t/innodb_mysql.test:
  Manual merge
2007-08-01 18:14:50 -06:00
unknown
586304c814 Add a test case for Bug#18287 create federated table always times out,
error 1159 ' ' (fixed by the patch for Bug 25679)


mysql-test/r/federated.result:
  Update results (Bug#18287)
mysql-test/t/federated.test:
  Add a test case for Bug#18287 create federated table always times out,
   error 1159 ' '
2007-08-02 03:32:54 +04:00
unknown
b42247bca8 Bug#25679
"Federated Denial of Service"
  Federated storage engine used to attempt to open connections within
  the ::create() and ::open() methods which are invoked while LOCK_open
  mutex is being held by mysqld. As a result, no other client sessions
  can open tables while Federated is attempting to open a connection.
  Long DNS lookup times would stall mysqld's operation and a rogue
  connection string which connects to a remote server which simply
  stalls during handshake can stall mysqld for a much longer period of
  time.
  This patch moves the opening of the connection much later, when the
  federated actually issues queries, by which time the LOCK_open mutex is
  no longer being held.


mysql-test/r/federated.result:
  change of test/results due to patch for bug25679
mysql-test/t/federated.test:
  change of test/results due to patch for bug25679
sql/ha_federated.cc:
  bug25679
    remove function check_foreign_fata_source()
    ha_federated::open() no longer opens the federated connection.
    ha_federated::create() no longer opens and tests connection.
    ha_federated::real_connect() opens connection and tests presence of table.
    ha_federated::real_query() sends query, calling real_connect() if neccessary.
sql/ha_federated.h:
  bug25679
    new methods real_query() and real_connect()
2007-07-25 12:23:24 -07:00
unknown
6a5fff64a3 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint


mysql-test/t/federated.test:
  Auto merged
sql/ha_federated.h:
  Auto merged
mysql-test/r/federated.result:
  Manual merge.
2007-07-19 15:33:27 -04:00
unknown
8b8b430bbc Bug#26909: Specified key was too long; max key length is 255 bytes \
when creating table

Federated tables had an artificially low maximum of key length, 
because the handler failed to implement a method to return it and 
the default value is taked from the prototype handler.

Now, implement that method and return the maximum possible key
length, which is that of InnoDB.


mysql-test/r/federated.result:
  Verify that unique keys may be longer than 255 characters.
mysql-test/t/federated.test:
  Verify that unique keys may be longer than 255 characters.
sql/ha_federated.h:
  Implement the virtual method that tells the max size of parts to 
  make a key.
  
  Backport the length defined in 5.1.
2007-07-18 14:03:58 -04:00
unknown
94beb7cd8d Bug#25511
"Federated INSERT failures"
  Federated does not correctly handle "INSERT...ON DUPLICATE KEY UPDATE"
  However, implementing such support is not reasonably possible without
  increasing complexity of the storage engine: checking that constraints
  on remote server match local server and parsing error messages.
  This patch causes 'ON DUPLICATE KEY' to fail with ER_DUP_KEY message
  if a conflict occurs and not to fail silently.


include/my_base.h:
  bug25511
    new storage engine hint: HA_EXTRA_INSERT_WITH_UPDATE
mysql-test/r/federated.result:
  test for bug25511
mysql-test/t/federated.test:
  test for bug25511
sql/ha_federated.cc:
  bug25511
    implement support for handling HA_EXTRA_INSERT_WITH_UPDATE hint
sql/ha_federated.h:
  bug25511
    new property: insert_dup_update
sql/sql_insert.cc:
  bug25511
    implement support for HA_EXTRA_INSERT_WITH_UPDATE
    When checking duplicates flag, if it is DUP_UPDATE, send hint
    to the storage engine.
2007-06-28 13:36:26 -07:00
unknown
0e5e884b11 Bug#29019
"REPLACE/INSERT IGNORE/UPDATE IGNORE doesn't work"
  Federated does not record neccessary HA_EXTRA flags in order to
  support REPLACE/INSERT IGNORE/UPDATE IGNORE.
  Implement ::extra() to capture flags neccessary for functionality.
New function append_ident() to better escape identifiers consistantly.


mysql-test/r/federated.result:
  test for bug29019
mysql-test/t/federated.test:
  test for bug29019
sql/ha_federated.cc:
  Bug29019
    Federated does not record neccessary HA_EXTRA flags in order to
    support REPLACE/INSERT IGNORE/UPDATE IGNORE.
    Implement ::extra() to capture flags neccessary for functionality.
  New function append_ident() to better escape identifiers consistantly.
sql/ha_federated.h:
  bug29019
    add 2 member values to ha_federated class
      ignore_duplicates and replace_duplicates.
    add 1 member method to ha_federated class
      extra()
2007-06-28 00:23:14 -07:00
unknown
403fa25473 federated.test:
fixed test to replace port to SLAVE_PORT in result file
federated.result:
  new result file


mysql-test/t/federated.test:
  fixed test to replace port to SLAVE_PORT in result file
mysql-test/r/federated.result:
  new result file
2006-11-29 13:56:59 -05:00
unknown
16a0bdd7da BUG# 17044 Federated Storage Engine not UTF8 clean
- Added 'SET NAMES <charset>" upon ::open
- Added test and results for simple UTF test

federated.test:
  BUG #17044 Federated Storage Engine not UTF8 clean
  New test. Using hex - pasting various charsets in the terminal doesn't work.
federated.result:
  BUG# 17044 Federated Storage Engine not UTF8 clean
  New test results
ha_federated.cc:
  BUG# 17044 Federated Storage Engine not UTF8 clean
  Upon ::open, set names to table's charset


sql/ha_federated.cc:
  BUG# 17044 Federated Storage Engine not UTF8 clean
          Upon ::open, set names to table's charset
mysql-test/t/federated.test:
   BUG #17044 Federated Storage Engine not UTF8 clean
      New test. Using hex - pasting various charsets in the terminal doesn't work.
    federated.result:
    BUG# 17044 Federated Storage Engine not UTF8 clean
      New test results
mysql-test/r/federated.result:
  BUG# 17044 Federated Storage Engine not UTF8 clean
          New test results
2006-11-15 21:24:58 -05:00
unknown
fe4d656d55 BUG #15133 "unique index with nullable value not accepted in federated table"
Added HA_NULL_IN_KEY to table flags to allow for nullable unique indexes
and added test to verify

ha_federated.h:
  BUG #15133 "unique index with nullable value not accepted in federated table"
  added HA_NULL_IN_KEY to table flags to allow for nullable unique indexes
federated.test:
  BUG #15133 "unique index with nullable value not accepted in federated table"
  New test to show that nullable unique indexes work
federated.result:
  BUG #15133 "unique index with nullable value not accepted in federated table"
  New results for new test


sql/ha_federated.h:
  BUG #15133 "unique index with nullable value not accepted in federated table"
  added HA_NULL_IN_KEY to table flags to allow for nullable unique indexes
mysql-test/t/federated.test:
  BUG #15133 "unique index with nullable value not accepted in federated table"
  New test to show that nullable unique indexes work
mysql-test/r/federated.result:
  BUG #15133 "unique index with nullable value not accepted in federated table"
  New results for new test
2006-07-25 18:38:09 -04:00
unknown
9378fc627e "BUG #18764: Delete conditions causing inconsistencies in Federated tables"
Post merge changes.
2006-07-18 18:41:36 -07:00
unknown
6ab68cdf29 Merge pgalbraith@bk-internal.mysql.com:/home/bk/mysql-5.0-engines
into  govinda.patg.net:/home/patg/mysql-build/mysql-5.0-bug18764.2


mysql-test/r/federated.result:
  "BUG #18764: Delete conditions causing inconsistencies in Federated tables"
  
  hand merge
mysql-test/t/federated.test:
  "BUG #18764: Delete conditions causing inconsistencies in Federated tables"
  
  hand merge
sql/ha_federated.cc:
  "BUG #18764: Delete conditions causing inconsistencies in Federated tables"
  
  hand merge
2006-07-18 17:21:50 -07:00
unknown
469813c7f3 "BUG #18764: Delete conditions causing inconsistencies in Federated tables"
Removed logic in ha_federated::write_row, which checks field query ids in the
loop which builds the query to run on the remote server.


mysql-test/r/federated.result:
  "BUG #18764: Delete conditions causing inconsistencies in Federated tables"
  
  
  New test results for test that verifies that one can insert to rows using 
  "insert into... select * from..", delete 
  them by id, then immediately insert them in the same way they were originally 
  inserted.
mysql-test/t/federated.test:
  "BUG #18764: Delete conditions causing inconsistencies in Federated tables"
  
  
  New test that verifies that one can insert to rows using 
  "insert into... select * from..", delete 
  them by id, then immediately insert them in the same way they were originally 
  inserted.
sql/ha_federated.cc:
  "BUG #18764: Delete conditions causing inconsistencies in Federated tables"
  
  Removed the logic in ha_federated::write_row which checked the query id of 
  each field and compared it to the thread query id.
  
  Each field has a query id, and the problem used to be that if I did an insert
  no fields specified, the field value would contain the last inserted value 
  for that field. The way to work around this was to see if the query id for 
  that field was the same as the current query id or of the rest of the field 
  query ids. If it wasn't, that told me the query didn't have the field value 
  specified.
  
  Somewhere from when I wrote that code to now the problem went away, and there
  was no longer the need for this logic. 
  
  Also removed the bool "has_fields", which needs not exist and using 
  table->s->fields is sufficient.
2006-07-17 16:45:04 -07:00
unknown
abbf7ad014 Bug #17608: String literals lost during INSERT query on FEDERATED table
The Federated storage engine used Field methods that had arbitrary limits on
  the amount of data they could process, which caused problems with data
  over that limit (4K). By removing those Field methods and just using
  features of the String class, we can avoid this problem.


mysql-test/r/federated.result:
  Add new results
mysql-test/t/federated.test:
  Add new regression test
sql/field.cc:
  Remove unnecessary methods
sql/field.h:
  Remove unnecessary methods
sql/ha_federated.cc:
  Remove use of quote_data, use String::print() to get escaping of strings,
  and don't bother with needs_quotes, just always quote values.
2006-07-12 16:33:29 -07:00
unknown
cad24c097e Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge-41


myisam/mi_create.c:
  Auto merged
mysql-test/r/myisam.result:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_trigger.cc:
  Auto merged
support-files/mysql.spec.sh:
  Auto merged
mysql-test/r/federated.result:
  Manual merge.
mysql-test/t/federated.test:
  Manual merge.
2006-07-08 21:45:02 +04:00
unknown
685ccf85d4 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mysql.com:/home/dlenev/mysql-5.0-bg18437-3


mysql-test/t/federated.test:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_trigger.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
mysql-test/r/federated.result:
  Manual merge.
2006-07-06 14:31:32 +04:00
unknown
ae9724cce1 Fix for bug#18437 "Wrong values inserted with a before update trigger on
NDB table".

SQL-layer was not marking fields which were used in triggers as such. As
result these fields were not always properly retrieved/stored by handler
layer. So one might got wrong values or lost changes in triggers for NDB,
Federated and possibly InnoDB tables.
This fix solves the problem by marking fields used in triggers
appropriately.

Also this patch contains the following cleanup of ha_ndbcluster code:

We no longer rely on reading LEX::sql_command value in handler in order
to determine if we can enable optimization which allows us to handle REPLACE
statement in more efficient way by doing replaces directly in write_row()
method without reporting error to SQL-layer.
Instead we rely on SQL-layer informing us whether this optimization
applicable by calling handler::extra() method with
HA_EXTRA_WRITE_CAN_REPLACE flag.
As result we no longer apply this optimzation in cases when it should not
be used (e.g. if we have on delete triggers on table) and use in some
additional cases when it is applicable (e.g. for LOAD DATA REPLACE).

Finally this patch includes fix for bug#20728 "REPLACE does not work
correctly for NDB table with PK and unique index".
  
This was yet another problem which was caused by improper field mark-up.
During row replacement fields which weren't explicity used in REPLACE
statement were not marked as fields to be saved (updated) so they have
retained values from old row version. The fix is to mark all table
fields as set for REPLACE statement. Note that in 5.1 we already solve
this problem by notifying handler that it should save values from all
fields only in case when real replacement happens.


include/my_base.h:
  Added HA_EXTRA_WRITE_CAN_REPLACE, HA_EXTRA_WRITE_CANNOT_REPLACE - new
  parameters for ha_extra() method. We use them to inform handler that
  write_row() which tries to insert new row into the table and encounters
  some already existing row with same primary/unique key can replace old
  row with new row instead of reporting error.
mysql-test/r/federated.result:
  Additional test for bug#18437 "Wrong values inserted with a before update
  trigger on NDB table".
mysql-test/r/ndb_replace.result:
  Added test for bug #20728 "REPLACE does not work correctly for NDB table
  with PK and unique index". Updated wrong results from older test.
mysql-test/t/federated.test:
  Additional test for bug#18437 "Wrong values inserted with a before update
  trigger on NDB table".
mysql-test/t/ndb_replace.test:
  Added test for bug #20728 "REPLACE does not work correctly for NDB table
  with PK and unique index".
sql/ha_ndbcluster.cc:
  We no longer rely on reading LEX::sql_command value in handler in order
  to determine if we can enable optimization which allows us to handle REPLACE
  statement in more efficient way by doing replaces directly in write_row()
  method without reporting error to SQL-layer.
  Instead we rely on SQL-layer informing us whether this optimization
  applicable by calling handler::extra() method with
  HA_EXTRA_WRITE_CAN_REPLACE flag.
  As result we no longer apply this optimization in cases when it should not
  be used (e.g. if we have on delete triggers on table) and use in some
  additional cases when it is applicable (e.g. for LOAD DATA REPLACE).
sql/item.cc:
  Item_trigger_field::setup_field():
    Added comment explaining why we don't set Field::query_id in this method.
sql/mysql_priv.h:
  mysql_alter_table() function no longer takes handle_duplicates argument.
  Added declaration of mark_fields_used_by_triggers_for_insert_stmt() function.
sql/sql_delete.cc:
  Mark fields which are used by ON DELETE triggers so handler will retrieve
  values for these fields.
sql/sql_insert.cc:
  Explicitly inform handler that we are doing REPLACE (using ha_extra() method)
  in cases when it can promote insert operation done by write_row() to replace.
  Also when we do REPLACE we want to store values for all columns so we should
  inform handler about it.
  Finally we should mark fields used by ON UPDATE/ON DELETE triggers as such
  so handler can properly retrieve/restore values in these fields during
  execution of REPLACE and INSERT ... ON DUPLICATE KEY UPDATE statements.
sql/sql_load.cc:
  Explicitly inform handler that we are doing LOAD DATA REPLACE (using
  ha_extra() method) in cases when it can promote insert operation done by
  write_row() to replace.
  Also when we do replace we want to save (replace) values for all columns
  so we should inform handler about it.
  Finally to properly execute LOAD DATA for table with triggers we should
  mark fields used by ON INSERT triggers as such so handler can properly
  store values for these fields.
sql/sql_parse.cc:
  mysql_alter_table() function no longer takes handle_duplicates argument.
sql/sql_table.cc:
  Got rid of handle_duplicates argument in mysql_alter_table() and
  copy_data_between_tables() functions. These functions were always
  called with handle_duplicates == DUP_ERROR and thus contained dead
  (and probably incorrect) code.
sql/sql_trigger.cc:
  Added Table_triggers_list::mark_fields_used() method which is used to mark
  fields read/set by triggers as such so handlers will be able properly
  retrieve/store values in these fields.
sql/sql_trigger.h:
  Table_triggers_list:
    Added mark_fields_used() method which is used to mark fields read/set by
    triggers as such so handlers will be able properly retrieve/store values
    in these fields. To implement this method added 'trigger_fields' member
    which is array of lists linking items for all fields used in triggers
    grouped by event and action time.
sql/sql_update.cc:
  Mark fields which are used by ON UPDATE triggers so handler will retrieve
  and save values for these fields.
mysql-test/r/ndb_trigger.result:
  Added test for bug#18437 "Wrong values inserted with a before update trigger
  on NDB table".
mysql-test/t/ndb_trigger.test:
  Added test for bug#18437 "Wrong values inserted with a before update trigger
  on NDB table".
2006-07-02 01:51:10 +04:00
unknown
16d2ad61c3 Fixed yet another forgotten port number replacement. 2006-06-29 14:03:53 +02:00
unknown
66f650b931 Merge mysql.com:/home/mydev/mysql-5.0--main
into  mysql.com:/home/mydev/mysql-5.0-bug11824


mysql-test/r/federated.result:
  Auto merged
mysql-test/t/federated.test:
  Auto merged
2006-06-29 13:43:56 +02:00
unknown
9ee8e42d1c Fix test files to work with non-standard ports (MTR_BUILD_THREAD).
mysql-test/t/federated.test:
  Use --replace_result to make test work on non-standard ports.
mysql-test/r/federated.result:
  Use --replace_result to make test work on non-standard ports.
2006-06-29 10:35:16 +02:00
unknown
579d0519a2 Merge mysql.com:/home/mydev/mysql-5.0-amerge
into  mysql.com:/home/mydev/mysql-5.0-bug11824


configure.in:
  Auto merged
mysql-test/r/federated.result:
  Auto merged
mysql-test/t/federated.test:
  Auto merged
sql/ha_federated.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
2006-06-29 10:18:29 +02:00
unknown
01d3a61fef Merge bk-internal:/home/bk/mysql-5.0-engines
into  mysql.com:/home/jimw/my/mysql-5.0-16494


sql/ha_federated.cc:
  Auto merged
mysql-test/r/federated.result:
  Resolve conflict
mysql-test/t/federated.test:
  Resolve conflict
2006-06-28 12:26:21 -07:00
unknown
9016a6be20 BUG #19773
Pushbuild fixes to result file, test, and header file for federated.


mysql-test/r/federated.result:
  BUG #19773
  
  Pushbuild fixes - result file had hard-coded port
mysql-test/t/federated.test:
  BUG #19773
  
  Pushbuild fixes Test was missing --replace_result
sql/ha_federated.h:
  BUG #19773
  
  HPUX and Windows failed with variable named row and *row in method declaration
2006-06-28 12:18:21 -07:00
unknown
2ee3ef2edc BUG #19773
Final-review fixes per Monty, pre-push. OK'd for 
push. Please see each file's comments.



mysql-test/r/federated.result:
  BUG #19773
      
  Results for multi-table deletes, updates
mysql-test/t/federated.test:
  BUG #19773
      
  Test multi table update and delete. Added drop table to end of previous test.
sql/ha_federated.cc:
  BUG #19773 
      
  Post-review changes, per Monty. 3rd patch, OK'd for push.
  - Added index_read_idx_with_result_set, which uses the result set passed to it
  - Hash by entire connection scheme
  - Protected store_result result set for table scan by adding a method result set
    to index_read_idx and index_read which is passed to index_read_with_result, which
    in turn iterates over the single record via read_next.
    This is a change from having two result sets in the first two patches. 
    This keeps the code clean and avoids the need for yet another result set.
  - Rewrote ::position and ::rnd_pos to store position - if primary key use 
    primary key, if not, use record buffer.
  - Rewrote get_share to store hash with connect string vs. table name
  - delete_row added subtration of "records" by affected->rows
  - Added read_next to handle what rnd_next used to do (converting raw record
     to query and vice versa)
  - Removed many DBUG_PRINT lines
  - Removed memset initialisation since subsequent loop accomplishes
  - Removed un-necessary mysql_free_result lines
sql/ha_federated.h:
   BUG #19773
      
      Fixed "SET " to " SET " to make sure built statements are built with 
      "UPDATE `t1` SET .." instead of "UPDATE `t1`SET"
2006-06-27 23:49:48 -07:00
unknown
f3c3c9c341 Bug #16494: Updates that set a column to NULL fail sometimes
When building the UPDATE query to send to the remote server, the
 federated storage engine built the query incorrectly if it was updating
 a field to be NULL.

 Thanks to Bjšrn Steinbrink for an initial patch for the problem.


mysql-test/r/federated.result:
  Add new results
mysql-test/t/federated.test:
  Add new regression test
sql/ha_federated.cc:
  Fix logic of how fields are added to SET and WHERE clauses of an
  UPDATE statement. Fields that were NULL were being handled incorrectly.
  Also reorganizes the code a little bit so the update of the two
  clauses is consistent.
2006-06-26 16:59:52 -07:00
unknown
701b699144 Bug#17377 Federated Engine returns wrong Data, always the rows with the highest ID
- Always make rnd_pos reposition the cursor in the fetched result set.


mysql-test/r/federated.result:
  Update test result
mysql-test/t/federated.test:
  Add test for bug#17377
sql/ha_federated.cc:
  Remove the "scan_flag" variable. rnd_pos should always move to a new position in the result set. 
  The "scan" flag in rnd_init will protect from the old result set being 
  closed and a new fecthed. I think the "scan_flag" was added before check of the "scan" argument in rnd_init was added.
sql/ha_federated.h:
  Remove class variable "scan_flag"
2006-02-28 11:17:40 +01:00
unknown
bccad0dcd9 Fix missing --replace_result on $SLAVE_MYPORT in federated.
mysql-test/t/federated.test:
  Fix missing --replace_result on $SLAVE_MYPORT to work with MTR_BUILD_THREAD.
mysql-test/r/federated.result:
  Fix missing --replace_result on $SLAVE_MYPORT to work with MTR_BUILD_THREAD.
2006-01-31 09:15:28 +01:00
unknown
e13a840ad7 BUG# 14768
Added fixes to make last_insert_id() to work.


mysql-test/r/federated.result:
  BUG #14768
  
  New test results for last_insert_id()
mysql-test/t/federated.test:
  BUG #14768
  
  Tests for last_insert_id()
sql/ha_federated.cc:
  BUG# 14768
  
  * Added code to set last_insert_id()
  * Added code to free share->scheme
sql/ha_federated.h:
  BUG #14768
  
  New method for setting last_insert_id()
2006-01-27 15:43:44 -08:00
unknown
31b6796238 BUG# 14532
Post-review fixes


mysql-test/r/federated.result:
  BUG# 14532
  
  Regenerated test results
mysql-test/t/federated.test:
  BUG# 14532 
  
  Added comments to test
2005-10-31 17:26:45 -08:00
unknown
67c6d0f071 BUG #14532
Added FIELD_TYPE_BIT to field method 'needs_quotes' to make BIT columns
work.


mysql-test/r/federated.result:
  BUG# 14532
  
  Test fix by creating table with bit column and inserting,selecting
mysql-test/t/federated.test:
  BUG# 14532
  
  Test fix by creating table with bit column and inserting,selecting
sql/field.cc:
  BUG #14532
  
  Just needed to quote/escape bit field, add FIELD_TYPE_BIT to switch
2005-10-31 17:17:16 -08:00
unknown
842fd992f6 Merge abarkov@bk-internal:/home/bk/mysql-5.0
into  mysql.com:/usr/home/bar/mysql-5.0.b9278


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/r/cast.result:
  Auto merged
mysql-test/r/federated.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
mysql-test/t/cast.test:
  Auto merged
mysql-test/t/federated.test:
  Auto merged
2005-10-13 19:19:05 +05:00
unknown
60e411eb32 type_binary.result, type_binary.test:
new file
mysql_fix_privilege_tables.sql, mysql_create_system_tables.sh:
  Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
Many files:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
  Adding true BINARY/VARBINARY: new pad_char structure member.
ctype-bin.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
  New strnxfrm, with two trailing length bytes.
field.cc:
  Adding true BINARY/VARBINARY.


sql/field.cc:
  Adding true BINARY/VARBINARY.
strings/ctype-big5.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-bin.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
  New strnxfrm, with two trailing length bytes.
strings/ctype-cp932.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-czech.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-euc_kr.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-eucjpms.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-extra.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-gb2312.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-gbk.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-latin1.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-simple.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-sjis.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-tis620.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-uca.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-ucs2.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-ujis.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-utf8.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
strings/ctype-win1250ch.c:
  Adding true BINARY/VARBINARY: new pad_char structure member.
include/m_ctype.h:
  Adding true BINARY/VARBINARY: new pad_char structure member.
mysql-test/t/alter_table.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/binary.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/cast.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/ctype_cp1251.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/ctype_many.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/federated.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/func_in.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/ndb_condition_pushdown.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/ndb_types.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/sp.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/t/type_blob.test:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/alter_table.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/binary.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/cast.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/ctype_cp1251.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/ctype_many.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/federated.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/func_in.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/ndb_condition_pushdown.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/ndb_types.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/sp.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/system_mysql_db.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
mysql-test/r/type_blob.result:
  Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
scripts/mysql_create_system_tables.sh:
  Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
scripts/mysql_fix_privilege_tables.sql:
  Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
2005-10-13 19:16:19 +05:00
unknown
06c8c18a91 replace port number with string identifier so that it may have different ports and still run
(problem found by kent)


mysql-test/r/federated.result:
  replace port number with a named identifier
mysql-test/t/federated.test:
  add call to replace the resulting display of the port number with a string
2005-10-12 14:33:08 -07:00
unknown
7efa1939ee BUG#13724 conditionally added CONNECTION='connect string' for SHOW CREATE TABLE
mysql-test/r/federated.result:
  test results for SHOW CREATE TABLE
mysql-test/t/federated.test:
  added test for SHOW CREATE TABLE
sql/sql_show.cc:
  added connect_string for SHOW CREATE TABLE
2005-10-10 17:41:36 -07:00
unknown
d553b66791 Move handler specific options into handlerton flag check
BUG#13108


mysql-test/r/federated.result:
  added test results for federated alter table
mysql-test/t/federated.test:
  added test for federated alter table
sql/examples/ha_example.cc:
  supports table re-creation
sql/examples/ha_tina.cc:
  supports table re-creation
sql/ha_blackhole.cc:
  supports table re-creation
sql/ha_federated.cc:
  added flag for not supporting alter
sql/ha_heap.cc:
  supports table recreation
sql/ha_myisam.cc:
  supports table recreation
sql/ha_myisammrg.cc:
  supports table re-creation
sql/handler.cc:
  implemented flag check function
sql/handler.h:
  added additional handlerton flags
  created a function to test flags
  replace ha_supports_generate macro with call to flag check
sql/sql_delete.cc:
  replaced ha_supports_generate with handlerton flag check
sql/sql_table.cc:
  added check for handlerton check for alter support
2005-09-30 16:26:48 -07:00
unknown
00d77fdd75 Made changes to add federated CONNECTION information to the .frm file
(per Monty's patch).
Remove references to the "COMMENT" field.
WL#2414


mysql-test/r/federated.result:
  alter from "COMMENT=" to "CONNECTION="
mysql-test/r/federated_archive.result:
  change "COMMENT=" to "CONNECTION="
mysql-test/t/federated.test:
  change from "COMMENT=" to "CONNECTION="
mysql-test/t/federated_archive.test:
  change from "COMMENT=" to "CONNECTION="
sql/ha_federated.cc:
  Change parsing of char* table->s->comment to LEX_STRING table->s->connect_string
  (per Monty's patch)
sql/handler.h:
  added LEX_STRING "connection_string"
  (per Monty's patch)
sql/sql_yacc.yy:
  added setting of "connect_string" string and length
sql/table.cc:
  Modifying frm file to store connecting information (code change came from Monty).
sql/table.h:
  added connect_string
sql/unireg.cc:
  Storing information on connection_string (code came from Monty).
2005-09-12 18:02:17 -07:00
unknown
f9e4c6e76e Eric's implentation of OPTIMIZE TABLE and REPAIR TABLE,
as well as changes to the test.


mysql-test/r/federated.result:
  New test results
mysql-test/t/federated.test:
  Removed explains per brian's suggestion since on his 64-bit amd, you get 
  different information, something to be ironed out later, as well as it 
  having nothing to do with federated.
sql/ha_federated.cc:
  - Eric Herman's implementation of repair and optimize!!!
  - Eric's changes to 1EQ0 to FALSE
sql/ha_federated.h:
  Eric's addition of LEN for each SQL string tokens.
2005-07-19 03:04:51 +02:00
unknown
d887a6924e This is the same patch as 1.1937, with small variable declaration changes, memory
deallocation cleanup


mysql-test/r/federated.result:
  new test results
mysql-test/t/federated.test:
  New tests, and added explains per Timour's suggestion. This will keep
          track of whether changes have been made to the optimiser that might affect
          Federated.
          Also changed the error codes to federated error codes in the error tests
sql/ha_federated.cc:
  1. Not using MAX_REMOTE_SIZE, so removed
           2. Changed all defines that were IO_SIZE to FEDERATED_QUERY_BUFFER_SIZE
           3. Now using Federated Error Codes
           4. Implemented ::info (gets valid 'records' number)
           5. Implemented ::read_range_first - now uses indexes in range operations
           6. Better allocation in get_share
           7. Cleaned up memory bug in get_share
           8. Better initial query "SELECT * FROM t1 WHERE 1=0" for check_foreign_data_src
           9. emit_key_part_name and emit_key_part_element for read_range_first to not
              have redundancy
           10. Made sure all 'append's pass length, and use append("") to ensure proper
               null termination of strings being built.
           11. Better message creation. If ER_QUERY_ON_FOREIGN_DATA_SRC, I also pass
               the actual error code and message from the foreign data src.
           12. Cleaned up how the result set and share->scheme is freed.
sql/share/errmsg.txt:
  New Federated error messages that are more tailored to the type of information
  we want to see when federated has an error.
mysql-test/include/federated.inc:
  New bitkeeper file, include file for separating setup from main test suite
mysql-test/include/federated_cleanup.inc:
  New BitKeeper file ``mysql-test/include/federated_cleanup.inc''
sql/ha_federated.h:
  Added comments where needed, one was already commented about
2005-07-15 17:33:47 -07:00
unknown
63d9bd0c54 Comment and test changes per review request by Timour. All tests pass on production with this code.
mysql-test/r/federated.result:
  added explain results to join test results per Timour's request.
mysql-test/t/federated.test:
  Added explain to test per Timour's request
sql/ha_federated.cc:
  better comment to explain why we need table->status set to 0
2005-05-27 22:07:46 +02:00
unknown
b4508ef33a changes to fix joins not working (bug #10848). New tests, as well as table->status being set in index_read_idx
mysql-test/r/federated.result:
  new join test results
mysql-test/t/federated.test:
  new simple join tests (more to come with subsequent commits)
sql/ha_federated.cc:
  This fixes joins not working. Monty discussed that having to deal 
  with table->status needs to be moved from the handler/storage engine
  to a higher level
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
2005-05-25 02:15:09 +02:00
unknown
b7264f8bc1 Federated Storage Handler - test and result fix.
mysql-test/r/federated.result:
  made sure result has SLAVE_PORT!
mysql-test/t/federated.test:
  added --replace_result to a table creation that I forgot to add before
2005-03-20 23:17:35 -08:00
unknown
24dc8331f7 WL #2094 Federated Storage Engine
Changes to a test with a update to a table with 1001 columns, the last being a blob. 
On HP, the test worked properly, but on other OSs, there's a problem with using the 
blob column in an update where clause. The field method val_string(String *, char *) 
should work, but doesn't seem to deal with blobd, and for some reason, cannot get
the correct value of the blob column from the byte pointer in update_row, "*old_data"
which is a byte pointer to the row in mysql format, that will be replaced with 
"*new_data" (which conveniently has a field pointer to use to get values from).

Will document this.


mysql-test/r/federated.result:
  New test results. These results have been tested on production and hpita2 successfully.
mysql-test/t/federated.test:
  Changed blob column in this test due to some issues with HPUX handling it correctly
  and other OSs not. Will document this (blobs in update where clause)
2005-03-15 18:49:58 -08:00
unknown
2b1a8acda5 This changeset contains changes approved in code review by
Konstja and Georg, change sets 1.1806, 1.1805. These changes has been successfully 
tested on both my own workstation (Suse 9.0) and production.mysql.com.


mysql-test/r/federated.result:
  new test results for error handling tests.
mysql-test/t/federated.test:
  new error handling tests
sql/ha_federated.cc:
  - check_foreign_data source added
  - table names now enclosed in '`' to allow for '%' or other characters
  - better error handling
  - mysql_init now checked to see if it returns true/false, error out if false (Georg)
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
2005-03-15 00:32:21 -08:00
unknown
f6c9db08b6 WL# 2094 Federated Storage Handler
Patch #2, all coding style changes per Kostja's review 
(as requested to keep style changes separate from functionality changes),
as well as changes to the test suit to no longer use hard-coded port 
values in foreign table creation statement


mysql-test/r/federated.result:
  Now using SLAVE_PORT as opposed to hard-coded port value
mysql-test/t/federated.test:
  - changed test to use SLAVE_MYPORT
  - made all standard SQL uppercase
  - made test 80 cols, except blob inserts of text
sql/ha_federated.cc:
  - made sure all comments and style changes were according to Kostja's 
  review 
  - combined parse_url error handling into a 'error:' block, took out 
  triple exclamation points.
  - clarified commented documentation
  - got rid of all trailing spaces
2005-02-23 00:38:29 -08:00