List:Internals« Previous MessageNext Message »
From:svoj Date:August 27 2005 11:08am
Subject:bk commit into 5.0 tree (svoj:1.1897)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of svoj. When svoj does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1897 05/08/27 16:08:49 svoj@stripped +6 -0
  WL#2575 - Fulltext: Parser plugin for FTS
  Implemented save and restore parser in .frm.

  sql/unireg.cc
    1.65 05/08/27 16:08:46 svoj@stripped +19 -1
    Saving and restoring fulltext parser routines.

  sql/table.cc
    1.175 05/08/27 16:08:45 svoj@stripped +36 -6
    Saving and restoring fulltext parser routines.

  sql/structs.h
    1.49 05/08/27 16:08:45 svoj@stripped +1 -0
    Added parser plugin variable to KEY type.

  sql/sql_table.cc
    1.265 05/08/27 16:08:45 svoj@stripped +2 -0
    If current fulltext key was create with parser add HA_USES_PARSER flag.

  sql/handler.h
    1.147 05/08/27 16:08:45 svoj@stripped +1 -0
    Added extra_size variable into HA_CREATE_INFO. It holds length of extra data segment.

  include/my_base.h
    1.71 05/08/27 16:08:45 svoj@stripped +1 -0
    Added new HA_USES_PARSER flag for keys.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	svoj
# Host:	svoj-laptop.mysql.com
# Root:	/home/svoj/devel/mysql/CNET/mysql-5.0

--- 1.70/include/my_base.h	2005-06-24 22:34:50 +05:00
+++ 1.71/include/my_base.h	2005-08-27 16:08:45 +05:00
@@ -209,6 +209,7 @@
 #define HA_SPACE_PACK_USED	 4	/* Test for if SPACE_PACK used */
 #define HA_VAR_LENGTH_KEY	 8
 #define HA_NULL_PART_KEY	 64
+#define HA_USES_PARSER           16384  /* Fulltext index uses [pre]parser */
 #ifndef ISAM_LIBRARY
 #define HA_SORT_ALLOWS_SAME      512    /* Intern bit when sorting records */
 #else

--- 1.146/sql/handler.h	2005-07-20 21:02:26 +05:00
+++ 1.147/sql/handler.h	2005-08-27 16:08:45 +05:00
@@ -393,6 +393,7 @@
   uint options;				/* OR of HA_CREATE_ options */
   uint raid_type,raid_chunks;
   uint merge_insert_method;
+  uint extra_size;                      /* length of extra data segment */
   bool table_existed;			/* 1 in create if table existed */
   bool frm_only;                        /* 1 if no ha_create_table() */
   bool varchar;                         /* 1 if table has a VARCHAR */

--- 1.264/sql/sql_table.cc	2005-07-23 00:32:27 +05:00
+++ 1.265/sql/sql_table.cc	2005-08-27 16:08:45 +05:00
@@ -1022,6 +1022,8 @@
 	break;
     case Key::FULLTEXT:
 	key_info->flags= HA_FULLTEXT;
+	if ((key_info->parser= key->parser))
+          key_info->flags|= HA_USES_PARSER;
 	break;
     case Key::SPATIAL:
 #ifdef HAVE_SPATIAL

--- 1.48/sql/structs.h	2005-06-16 12:11:48 +05:00
+++ 1.49/sql/structs.h	2005-08-27 16:08:45 +05:00
@@ -89,6 +89,7 @@
   uint  extra_length;
   uint	usable_key_parts;		/* Should normally be = key_parts */
   enum  ha_key_alg algorithm;
+  struct st_plugin_int *parser;         /* Fulltext [pre]parser */
   KEY_PART_INFO *key_part;
   char	*name;				/* Name of key */
   /*

--- 1.174/sql/table.cc	2005-07-23 00:39:43 +05:00
+++ 1.175/sql/table.cc	2005-08-27 16:08:45 +05:00
@@ -71,7 +71,7 @@
   uint	 rec_buff_length,n_length,int_length,records,key_parts,keys,
          interval_count,interval_parts,read_length,db_create_options;
   uint	 key_info_length, com_length;
-  ulong  pos;
+  ulong  pos, record_offset;
   char	 index_file[FN_REFLEN], *names, *keynames, *comment_pos;
   uchar  head[288],*disk_buff,new_field_pack_flag;
   my_string record;
@@ -321,11 +321,11 @@
                                     rec_buff_length * records)))
     goto err;                                   /* purecov: inspected */
   share->default_values= (byte *) record;
+  record_offset= (ulong)(uint2korr(head+6)+
+                         ((uint2korr(head+14) == 0xffff ?
+                             uint4korr(head+47) : uint2korr(head+14))));
   if (my_pread(file,(byte*) record, (uint) share->reclength,
-	       (ulong) (uint2korr(head+6)+
-                        ((uint2korr(head+14) == 0xffff ?
-                            uint4korr(head+47) : uint2korr(head+14)))),
-	       MYF(MY_NABP)))
+               record_offset, MYF(MY_NABP)))
     goto err; /* purecov: inspected */
 
   if (records == 1)
@@ -342,6 +342,34 @@
       outparam->record[1]= outparam->record[0];   // Safety
   }
 
+  if ((n_length= uint2korr(head+55)))
+  {
+    /* Read extra data segment */
+    char *buff, *next_chunk, *buff_end;
+    if (!(next_chunk= buff= alloc_root(&outparam->mem_root, n_length)))
+      goto err;
+    if (my_pread(file, buff, n_length, record_offset + share->reclength,
+                 MYF(MY_NABP)))
+      goto err;
+    buff_end= buff + n_length;
+    keyinfo= outparam->key_info;
+    for (i= 0; i < keys; i++, keyinfo++)
+    {
+      if (keyinfo->flags & HA_USES_PARSER)
+      {
+        LEX_STRING parser_name;
+        if (next_chunk >= buff_end)
+          goto err;
+        parser_name.str= next_chunk;
+        parser_name.length= strlen(next_chunk);
+        keyinfo->parser= plugin_find(&parser_name, PLUGIN_TYPE_FULLTEXT_PARSER);
+        if (! keyinfo->parser)
+          goto err;
+        next_chunk+= parser_name.length + 1;
+      }
+    }
+  }
+
 #ifdef HAVE_purify
   /*
     We need this because when we read var-length rows, we are not updating
@@ -1381,7 +1409,8 @@
     fileinfo[4]=1;
     int2store(fileinfo+6,IO_SIZE);		/* Next block starts here */
     key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16;
-    length=(ulong) next_io_size((ulong) (IO_SIZE+key_length+reclength));
+    length=(ulong) next_io_size((ulong) (IO_SIZE+key_length+reclength+
+                                         create_info->extra_size));
     int4store(fileinfo+10,length);
     tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff;
     int2store(fileinfo+14,tmp_key_length);
@@ -1403,6 +1432,7 @@
     int4store(fileinfo+47, key_length);
     tmp= MYSQL_VERSION_ID;          // Store to avoid warning from int4store
     int4store(fileinfo+51, tmp);
+    int2store(fileinfo+55, create_info->extra_size);
     bzero(fill,IO_SIZE);
     for (; length > IO_SIZE ; length-= IO_SIZE)
     {

--- 1.64/sql/unireg.cc	2005-07-23 00:35:11 +05:00
+++ 1.65/sql/unireg.cc	2005-08-27 16:08:46 +05:00
@@ -75,7 +75,7 @@
 		      uint keys, KEY *key_info,
 		      handler *db_file)
 {
-  uint reclength,info_length,screens,key_info_length,maxlength;
+  uint reclength,info_length,screens,key_info_length,maxlength,i;
   ulong key_buff_length;
   File file;
   ulong filepos, data_offset;
@@ -116,6 +116,14 @@
   }
   reclength=uint2korr(forminfo+266);
 
+  /* Calculate extra data segment length */
+  create_info->extra_size= 0;
+  for (i= 0; i < keys; i++)
+  {
+    if (key_info[i].parser)
+      create_info->extra_size+= key_info[i].parser->name.length + 1;
+  }
+  
   if ((file=create_frm(thd, file_name, table, db, reclength, fileinfo,
 		       create_info, keys)) < 0)
   {
@@ -149,6 +157,16 @@
   if (make_empty_rec(thd,file,create_info->db_type,create_info->table_options,
 		     create_fields,reclength, data_offset))
     goto err;
+
+  for (i= 0; i < keys; i++)
+  {
+    if (key_info[i].parser)
+    {
+      if (my_write(file, key_info[i].parser->name.str,
+                   key_info[i].parser->name.length + 1, MYF(MY_NABP)))
+        goto err;
+    }
+  }
 
   VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
   if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
Thread
bk commit into 5.0 tree (svoj:1.1897)svoj27 Aug