~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_search.c

  • Committer: Monty Taylor
  • Date: 2008-07-16 19:10:24 UTC
  • mfrom: (51.1.127 remove-dbug)
  • mto: This revision was merged to the branch mainline in revision 176.
  • Revision ID: monty@inaugust.com-20080716191024-prjgoh7fbri7rx26
MergedĀ fromĀ remove-dbug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
  uint nod_flag;
62
62
  uchar *keypos,*maxpos;
63
63
  uchar lastkey[MI_MAX_KEY_BUFF],*buff;
64
 
  DBUG_ENTER("_mi_search");
65
 
  DBUG_PRINT("enter",("pos: %lu  nextflag: %u  lastpos: %lu",
66
 
                      (ulong) pos, nextflag, (ulong) info->lastpos));
67
 
  DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,key,key_len););
68
64
 
69
65
  if (pos == HA_OFFSET_ERROR)
70
66
  {
71
67
    my_errno=HA_ERR_KEY_NOT_FOUND;                      /* Didn't find key */
72
68
    info->lastpos= HA_OFFSET_ERROR;
73
69
    if (!(nextflag & (SEARCH_SMALLER | SEARCH_BIGGER | SEARCH_LAST)))
74
 
      DBUG_RETURN(-1);                          /* Not found ; return error */
75
 
    DBUG_RETURN(1);                             /* Search at upper levels */
 
70
      return(-1);                          /* Not found ; return error */
 
71
    return(1);                             /* Search at upper levels */
76
72
  }
77
73
 
78
74
  if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff,
79
75
                               test(!(nextflag & SEARCH_SAVE_BUFF)))))
80
76
    goto err;
81
 
  DBUG_DUMP("page",(uchar*) buff,mi_getint(buff));
82
77
 
83
78
  flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag,
84
79
                              &keypos,lastkey, &last_key);
85
80
  if (flag == MI_FOUND_WRONG_KEY)
86
 
    DBUG_RETURN(-1);
 
81
    return(-1);
87
82
  nod_flag=mi_test_if_nod(buff);
88
83
  maxpos=buff+mi_getint(buff)-1;
89
84
 
91
86
  {
92
87
    if ((error=_mi_search(info,keyinfo,key,key_len,nextflag,
93
88
                          _mi_kpos(nod_flag,keypos))) <= 0)
94
 
      DBUG_RETURN(error);
 
89
      return(error);
95
90
 
96
91
    if (flag >0)
97
92
    {
98
93
      if (nextflag & (SEARCH_SMALLER | SEARCH_LAST) &&
99
94
          keypos == buff+2+nod_flag)
100
 
        DBUG_RETURN(1);                                 /* Bigger than key */
 
95
        return(1);                                 /* Bigger than key */
101
96
    }
102
97
    else if (nextflag & SEARCH_BIGGER && keypos >= maxpos)
103
 
      DBUG_RETURN(1);                                   /* Smaller than key */
 
98
      return(1);                                   /* Smaller than key */
104
99
  }
105
100
  else
106
101
  {
111
106
      if ((error=_mi_search(info,keyinfo,key,key_len,SEARCH_FIND,
112
107
                            _mi_kpos(nod_flag,keypos))) >= 0 ||
113
108
          my_errno != HA_ERR_KEY_NOT_FOUND)
114
 
        DBUG_RETURN(error);
 
109
        return(error);
115
110
      info->last_keypage= HA_OFFSET_ERROR;              /* Buffer not in mem */
116
111
    }
117
112
  }
156
151
  info->page_changed=0;
157
152
  info->buff_used= (info->buff != buff);        /* If we have to reread buff */
158
153
 
159
 
  DBUG_PRINT("exit",("found key at %lu",(ulong) info->lastpos));
160
 
  DBUG_RETURN(0);
 
154
  return(0);
161
155
 
162
156
err:
163
 
  DBUG_PRINT("exit",("Error: %d",my_errno));
164
157
  info->lastpos= HA_OFFSET_ERROR;
165
158
  info->page_changed=1;
166
 
  DBUG_RETURN (-1);
 
159
  return (-1);
167
160
} /* _mi_search */
168
161
 
169
162
 
179
172
  register int start,mid,end,save_end;
180
173
  int flag;
181
174
  uint totlength,nod_flag,not_used[2];
182
 
  DBUG_ENTER("_mi_bin_search");
183
175
 
184
176
  totlength=keyinfo->keylength+(nod_flag=mi_test_if_nod(page));
185
177
  start=0; mid=1;
186
178
  save_end=end=(int) ((mi_getint(page)-2-nod_flag)/totlength-1);
187
 
  DBUG_PRINT("test",("mi_getint: %d  end: %d",mi_getint(page),end));
188
179
  page+=2+nod_flag;
189
180
 
190
181
  while (start != end)
204
195
    start++;                    /* point at next, bigger key */
205
196
  *ret_pos=page+(uint) start*totlength;
206
197
  *last_key= end == save_end;
207
 
  DBUG_PRINT("exit",("flag: %d  keypos: %d",flag,start));
208
 
  DBUG_RETURN(flag);
 
198
  return(flag);
209
199
} /* _mi_bin_search */
210
200
 
211
201
 
242
232
  int flag=0;
243
233
  uint nod_flag,length=0,not_used[2];
244
234
  uchar t_buff[MI_MAX_KEY_BUFF],*end;
245
 
  DBUG_ENTER("_mi_seq_search");
246
235
 
247
236
  end= page+mi_getint(page);
248
237
  nod_flag=mi_test_if_nod(page);
256
245
    {
257
246
      mi_print_error(info->s, HA_ERR_CRASHED);
258
247
      my_errno=HA_ERR_CRASHED;
259
 
      DBUG_PRINT("error",
260
 
                 ("Found wrong key:  length: %u  page: 0x%lx  end: 0x%lx",
261
 
                  length, (long) page, (long) end));
262
 
      DBUG_RETURN(MI_FOUND_WRONG_KEY);
 
248
      return(MI_FOUND_WRONG_KEY);
263
249
    }
264
250
    if ((flag=ha_key_cmp(keyinfo->seg,t_buff,key,key_len,comp_flag,
265
251
                         not_used)) >= 0)
266
252
      break;
267
 
#ifdef EXTRA_DEBUG
268
 
    DBUG_PRINT("loop",("page: 0x%lx  key: '%s'  flag: %d", (long) page, t_buff,
269
 
                       flag));
270
 
#endif
271
253
    memcpy(buff,t_buff,length);
272
254
    *ret_pos=page;
273
255
  }
274
256
  if (flag == 0)
275
257
    memcpy(buff,t_buff,length);                 /* Result is first key */
276
258
  *last_key= page == end;
277
 
  DBUG_PRINT("exit",("flag: %d  ret_pos: 0x%lx", flag, (long) *ret_pos));
278
 
  DBUG_RETURN(flag);
 
259
  return(flag);
279
260
} /* _mi_seq_search */
280
261
 
281
262
 
298
279
  uchar *saved_from=NULL, *saved_to=NULL, *saved_vseg=NULL;
299
280
  uint  saved_length=0, saved_prefix_len=0;
300
281
  uint  length_pack;
301
 
  DBUG_ENTER("_mi_prefix_search");
302
282
 
303
283
  t_buff[0]=0;                                  /* Avoid bugs */
304
284
  end= page+mi_getint(page);
312
292
  key_len_left=(int) key_len- (int) key_len_skip;
313
293
  /* If key_len is 0, then lenght_pack is 1, then key_len_left is -1. */
314
294
  cmplen=(key_len_left>=0) ? kseg_len : key_len-length_pack;
315
 
  DBUG_PRINT("info",("key: '%.*s'",kseg_len,kseg));
316
295
 
317
296
  /*
318
297
    Keys are compressed the following way:
374
353
    saved_vseg=vseg;
375
354
    saved_prefix_len=prefix_len;
376
355
 
377
 
    DBUG_PRINT("loop",("page: '%.*s%.*s'",prefix_len,t_buff+seg_len_pack,
378
 
                       suffix_len,vseg));
379
356
    {
380
357
      uchar *from=vseg+suffix_len;
381
358
      HA_KEYSEG *keyseg;
407
384
    {
408
385
      mi_print_error(info->s, HA_ERR_CRASHED);
409
386
      my_errno=HA_ERR_CRASHED;
410
 
      DBUG_PRINT("error",
411
 
                 ("Found wrong key:  length: %u  page: 0x%lx  end: %lx",
412
 
                  length, (long) page, (long) end));
413
 
      DBUG_RETURN(MI_FOUND_WRONG_KEY);
 
387
      return(MI_FOUND_WRONG_KEY);
414
388
    }
415
389
 
416
390
    if (matched >= prefix_len)
485
459
          for (vseg_end= vseg + (len-cmplen) ;
486
460
               vseg < vseg_end && *vseg == (uchar) ' ';
487
461
               vseg++, matched++) ;
488
 
          DBUG_ASSERT(vseg < vseg_end);
 
462
          assert(vseg < vseg_end);
489
463
 
490
464
          if (*vseg > (uchar) ' ')
491
465
          {
511
485
              visited and 0 otherwise,  i.e. flag <=0 here always !!!
512
486
            */
513
487
        fix_flag:
514
 
            DBUG_ASSERT(flag <= 0);
 
488
            assert(flag <= 0);
515
489
            if (nextflag & (SEARCH_NO_FIND | SEARCH_LAST))
516
490
              flag=(nextflag & (SEARCH_BIGGER | SEARCH_LAST)) ? -1 : 1;
517
491
            if (flag>=0)
543
517
 
544
518
  *last_key= page == end;
545
519
 
546
 
  DBUG_PRINT("exit",("flag: %d  ret_pos: 0x%lx", flag, (long) *ret_pos));
547
 
  DBUG_RETURN(flag);
 
520
  return(flag);
548
521
} /* _mi_prefix_search */
549
522
 
550
523
 
804
777
          key+= length;                         /* Same diff_key as prev */
805
778
          if (length > keyseg->length)
806
779
          {
807
 
            DBUG_PRINT("error",
808
 
                       ("Found too long null packed key: %u of %u at 0x%lx",
809
 
                        length, keyseg->length, (long) *page_pos));
810
 
            DBUG_DUMP("key",(uchar*) *page_pos,16);
811
780
            mi_print_error(keyinfo->share, HA_ERR_CRASHED);
812
781
            my_errno=HA_ERR_CRASHED;
813
782
            return 0;
862
831
      }
863
832
      if (length > (uint) keyseg->length)
864
833
      {
865
 
        DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx",
866
 
                            length, keyseg->length, (long) *page_pos));
867
 
        DBUG_DUMP("key",(uchar*) *page_pos,16);
868
834
        mi_print_error(keyinfo->share, HA_ERR_CRASHED);
869
835
        my_errno=HA_ERR_CRASHED;
870
836
        return 0;                               /* Error */
908
874
  register HA_KEYSEG *keyseg;
909
875
  uchar *start_key,*page,*page_end,*from,*from_end;
910
876
  uint length,tmp;
911
 
  DBUG_ENTER("_mi_get_binary_pack_key");
912
877
 
913
878
  page= *page_pos;
914
879
  page_end=page+MI_MAX_KEY_BUFF+1;
933
898
  {
934
899
    if (length > keyinfo->maxlength)
935
900
    {
936
 
      DBUG_PRINT("error",
937
 
                 ("Found too long binary packed key: %u of %u at 0x%lx",
938
 
                  length, keyinfo->maxlength, (long) *page_pos));
939
 
      DBUG_DUMP("key",(uchar*) *page_pos,16);
940
901
      mi_print_error(keyinfo->share, HA_ERR_CRASHED);
941
902
      my_errno=HA_ERR_CRASHED;
942
 
      DBUG_RETURN(0);                                 /* Wrong key */
 
903
      return(0);                                 /* Wrong key */
943
904
    }
944
905
    /* Key is packed against prev key, take prefix from prev key. */
945
906
    from= key;
992
953
      length-=tmp;
993
954
      from=page; from_end=page_end;
994
955
    }
995
 
    DBUG_PRINT("info",("key: 0x%lx  from: 0x%lx  length: %u",
996
 
                       (long) key, (long) from, length));
997
956
    memmove((uchar*) key, (uchar*) from, (size_t) length);
998
957
    key+=length;
999
958
    from+=length;
1020
979
    */
1021
980
    if (from_end != page_end)
1022
981
    {
1023
 
      DBUG_PRINT("error",("Error when unpacking key"));
1024
982
      mi_print_error(keyinfo->share, HA_ERR_CRASHED);
1025
983
      my_errno=HA_ERR_CRASHED;
1026
 
      DBUG_RETURN(0);                                 /* Error */
 
984
      return(0);                                 /* Error */
1027
985
    }
1028
986
    /* Copy data pointer and, if appropriate, key block pointer. */
1029
987
    memcpy((uchar*) key,(uchar*) from,(size_t) length);
1030
988
    *page_pos= from+length;
1031
989
  }
1032
 
  DBUG_RETURN((uint) (key-start_key)+keyseg->length);
 
990
  return((uint) (key-start_key)+keyseg->length);
1033
991
}
1034
992
 
1035
993
 
1040
998
                   uchar *key, uchar *keypos, uint *return_key_length)
1041
999
{
1042
1000
  uint nod_flag;
1043
 
  DBUG_ENTER("_mi_get_key");
1044
1001
 
1045
1002
  nod_flag=mi_test_if_nod(page);
1046
1003
  if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
1047
1004
  {
1048
1005
    bmove((uchar*) key,(uchar*) keypos,keyinfo->keylength+nod_flag);
1049
 
    DBUG_RETURN(keypos+keyinfo->keylength+nod_flag);
 
1006
    return(keypos+keyinfo->keylength+nod_flag);
1050
1007
  }
1051
1008
  else
1052
1009
  {
1059
1016
      {
1060
1017
        mi_print_error(info->s, HA_ERR_CRASHED);
1061
1018
        my_errno=HA_ERR_CRASHED;
1062
 
        DBUG_RETURN(0);
 
1019
        return(0);
1063
1020
      }
1064
1021
    }
1065
1022
  }
1066
 
  DBUG_PRINT("exit",("page: 0x%lx  length: %u", (long) page,
1067
 
                     *return_key_length));
1068
 
  DBUG_RETURN(page);
 
1023
  return(page);
1069
1024
} /* _mi_get_key */
1070
1025
 
1071
1026
 
1077
1032
                                uint *return_key_length)
1078
1033
{
1079
1034
  uint nod_flag;
1080
 
  DBUG_ENTER("_mi_get_prev_key");
1081
1035
 
1082
1036
  nod_flag=mi_test_if_nod(page);
1083
1037
  if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
1085
1039
    *return_key_length=keyinfo->keylength;
1086
1040
    bmove((uchar*) key,(uchar*) keypos- *return_key_length-nod_flag,
1087
1041
          *return_key_length);
1088
 
    DBUG_RETURN(0);
 
1042
    return(0);
1089
1043
  }
1090
1044
  else
1091
1045
  {
1098
1052
      {
1099
1053
        mi_print_error(info->s, HA_ERR_CRASHED);
1100
1054
        my_errno=HA_ERR_CRASHED;
1101
 
        DBUG_RETURN(1);
 
1055
        return(1);
1102
1056
      }
1103
1057
    }
1104
1058
  }
1105
 
  DBUG_RETURN(0);
 
1059
  return(0);
1106
1060
} /* _mi_get_key */
1107
1061
 
1108
1062
 
1115
1069
{
1116
1070
  uint nod_flag;
1117
1071
  uchar *lastpos;
1118
 
  DBUG_ENTER("_mi_get_last_key");
1119
 
  DBUG_PRINT("enter",("page: 0x%lx  endpos: 0x%lx", (long) page,
1120
 
                      (long) endpos));
1121
1072
 
1122
1073
  nod_flag=mi_test_if_nod(page);
1123
1074
  if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
1137
1088
      *return_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,lastkey);
1138
1089
      if (*return_key_length == 0)
1139
1090
      {
1140
 
        DBUG_PRINT("error",("Couldn't find last key:  page: 0x%lx",
1141
 
                            (long) page));
1142
1091
        mi_print_error(info->s, HA_ERR_CRASHED);
1143
1092
        my_errno=HA_ERR_CRASHED;
1144
 
        DBUG_RETURN(0);
 
1093
        return(0);
1145
1094
      }
1146
1095
    }
1147
1096
  }
1148
 
  DBUG_PRINT("exit",("lastpos: 0x%lx  length: %u", (long) lastpos,
1149
 
                     *return_key_length));
1150
 
  DBUG_RETURN(lastpos);
 
1097
  return(lastpos);
1151
1098
} /* _mi_get_last_key */
1152
1099
 
1153
1100
 
1230
1177
  int error;
1231
1178
  uint nod_flag;
1232
1179
  uchar lastkey[MI_MAX_KEY_BUFF];
1233
 
  DBUG_ENTER("_mi_search_next");
1234
 
  DBUG_PRINT("enter",("nextflag: %u  lastpos: %lu  int_keypos: %lu",
1235
 
                      nextflag, (ulong) info->lastpos,
1236
 
                      (ulong) info->int_keypos));
1237
 
  DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,key,key_length););
1238
1180
 
1239
1181
  /* Force full read if we are at last key or if we are not on a leaf
1240
1182
     and the key tree has changed since we used it last time
1247
1189
      info->page_changed ||
1248
1190
      (info->int_keytree_version != keyinfo->version &&
1249
1191
       (info->int_nod_flag || info->buff_used)))
1250
 
    DBUG_RETURN(_mi_search(info,keyinfo,key, USE_WHOLE_KEY,
 
1192
    return(_mi_search(info,keyinfo,key, USE_WHOLE_KEY,
1251
1193
                           nextflag | SEARCH_SAVE_BUFF, pos));
1252
1194
 
1253
1195
  if (info->buff_used)
1254
1196
  {
1255
1197
    if (!_mi_fetch_keypage(info,keyinfo,info->last_search_keypage,
1256
1198
                           DFLT_INIT_HITS,info->buff,0))
1257
 
      DBUG_RETURN(-1);
 
1199
      return(-1);
1258
1200
    info->buff_used=0;
1259
1201
  }
1260
1202
 
1268
1210
    {
1269
1211
      if ((error=_mi_search(info,keyinfo,key, USE_WHOLE_KEY,
1270
1212
                            nextflag | SEARCH_SAVE_BUFF, tmp_pos)) <=0)
1271
 
        DBUG_RETURN(error);
 
1213
        return(error);
1272
1214
    }
1273
1215
    memcpy(lastkey,key,key_length);
1274
1216
    if (!(info->lastkey_length=(*keyinfo->get_key)(keyinfo,nod_flag,
1275
1217
                                                   &info->int_keypos,lastkey)))
1276
 
      DBUG_RETURN(-1);
 
1218
      return(-1);
1277
1219
  }
1278
1220
  else                                                  /* Previous key */
1279
1221
  {
1282
1224
    info->int_keypos=_mi_get_last_key(info,keyinfo,info->buff,lastkey,
1283
1225
                                      info->int_keypos, &length);
1284
1226
    if (!info->int_keypos)
1285
 
      DBUG_RETURN(-1);
 
1227
      return(-1);
1286
1228
    if (info->int_keypos == info->buff+2)
1287
 
      DBUG_RETURN(_mi_search(info,keyinfo,key, USE_WHOLE_KEY,
 
1229
      return(_mi_search(info,keyinfo,key, USE_WHOLE_KEY,
1288
1230
                             nextflag | SEARCH_SAVE_BUFF, pos));
1289
1231
    if ((error=_mi_search(info,keyinfo,key, USE_WHOLE_KEY,
1290
1232
                          nextflag | SEARCH_SAVE_BUFF,
1291
1233
                          _mi_kpos(nod_flag,info->int_keypos))) <= 0)
1292
 
      DBUG_RETURN(error);
 
1234
      return(error);
1293
1235
 
1294
1236
    /* QQ: We should be able to optimize away the following call */
1295
1237
    if (! _mi_get_last_key(info,keyinfo,info->buff,lastkey,
1296
1238
                           info->int_keypos,&info->lastkey_length))
1297
 
      DBUG_RETURN(-1);
 
1239
      return(-1);
1298
1240
  }
1299
1241
  memcpy(info->lastkey,lastkey,info->lastkey_length);
1300
1242
  info->lastpos=_mi_dpos(info,0,info->lastkey+info->lastkey_length);
1301
 
  DBUG_PRINT("exit",("found key at %lu",(ulong) info->lastpos));
1302
 
  DBUG_RETURN(0);
 
1243
  return(0);
1303
1244
} /* _mi_search_next */
1304
1245
 
1305
1246
 
1311
1252
{
1312
1253
  uint nod_flag;
1313
1254
  uchar *page;
1314
 
  DBUG_ENTER("_mi_search_first");
1315
1255
 
1316
1256
  if (pos == HA_OFFSET_ERROR)
1317
1257
  {
1318
1258
    my_errno=HA_ERR_KEY_NOT_FOUND;
1319
1259
    info->lastpos= HA_OFFSET_ERROR;
1320
 
    DBUG_RETURN(-1);
 
1260
    return(-1);
1321
1261
  }
1322
1262
 
1323
1263
  do
1325
1265
    if (!_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff,0))
1326
1266
    {
1327
1267
      info->lastpos= HA_OFFSET_ERROR;
1328
 
      DBUG_RETURN(-1);
 
1268
      return(-1);
1329
1269
    }
1330
1270
    nod_flag=mi_test_if_nod(info->buff);
1331
1271
    page=info->buff+2+nod_flag;
1333
1273
 
1334
1274
  if (!(info->lastkey_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,
1335
1275
                                                 info->lastkey)))
1336
 
    DBUG_RETURN(-1);                            /* Crashed */
 
1276
    return(-1);                            /* Crashed */
1337
1277
 
1338
1278
  info->int_keypos=page; info->int_maxpos=info->buff+mi_getint(info->buff)-1;
1339
1279
  info->int_nod_flag=nod_flag;
1342
1282
  info->page_changed=info->buff_used=0;
1343
1283
  info->lastpos=_mi_dpos(info,0,info->lastkey+info->lastkey_length);
1344
1284
 
1345
 
  DBUG_PRINT("exit",("found key at %lu", (ulong) info->lastpos));
1346
 
  DBUG_RETURN(0);
 
1285
  return(0);
1347
1286
} /* _mi_search_first */
1348
1287
 
1349
1288
 
1355
1294
{
1356
1295
  uint nod_flag;
1357
1296
  uchar *buff,*page;
1358
 
  DBUG_ENTER("_mi_search_last");
1359
1297
 
1360
1298
  if (pos == HA_OFFSET_ERROR)
1361
1299
  {
1362
1300
    my_errno=HA_ERR_KEY_NOT_FOUND;                      /* Didn't find key */
1363
1301
    info->lastpos= HA_OFFSET_ERROR;
1364
 
    DBUG_RETURN(-1);
 
1302
    return(-1);
1365
1303
  }
1366
1304
 
1367
1305
  buff=info->buff;
1370
1308
    if (!_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,buff,0))
1371
1309
    {
1372
1310
      info->lastpos= HA_OFFSET_ERROR;
1373
 
      DBUG_RETURN(-1);
 
1311
      return(-1);
1374
1312
    }
1375
1313
    page= buff+mi_getint(buff);
1376
1314
    nod_flag=mi_test_if_nod(buff);
1378
1316
 
1379
1317
  if (!_mi_get_last_key(info,keyinfo,buff,info->lastkey,page,
1380
1318
                        &info->lastkey_length))
1381
 
    DBUG_RETURN(-1);
 
1319
    return(-1);
1382
1320
  info->lastpos=_mi_dpos(info,0,info->lastkey+info->lastkey_length);
1383
1321
  info->int_keypos=info->int_maxpos=page;
1384
1322
  info->int_nod_flag=nod_flag;
1386
1324
  info->last_search_keypage=info->last_keypage;
1387
1325
  info->page_changed=info->buff_used=0;
1388
1326
 
1389
 
  DBUG_PRINT("exit",("found key at %lu",(ulong) info->lastpos));
1390
 
  DBUG_RETURN(0);
 
1327
  return(0);
1391
1328
} /* _mi_search_last */
1392
1329
 
1393
1330
 
1571
1508
  }
1572
1509
  s_temp->totlength=(uint) length;
1573
1510
  s_temp->prev_length=0;
1574
 
  DBUG_PRINT("test",("tot_length: %u  length: %d  uniq_key_length: %u",
1575
 
                     key_length, length, s_temp->key_length));
1576
1511
 
1577
1512
        /* If something after that hasn't length=0, test if we can combine */
1578
1513
  if ((s_temp->next_key_pos=next_key))
1676
1611
        ref_length=0;
1677
1612
        next_length_pack=0;
1678
1613
      }
1679
 
      DBUG_PRINT("test",("length: %d  next_key: 0x%lx", length,
1680
 
                         (long) next_key));
1681
1614
 
1682
1615
      {
1683
1616
        uint tmp_length;