~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_delete.c

  • Committer: Jay Pipes
  • Date: 2008-07-16 16:14:22 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: jay@mysql.com-20080716161422-fy1bl8o5q7m8kglq
Removed all DBUG symbols from heap storage engine

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
  uchar *pos;
23
23
  HP_SHARE *share=info->s;
24
24
  HP_KEYDEF *keydef, *end, *p_lastinx;
25
 
  DBUG_ENTER("heap_delete");
26
 
  DBUG_PRINT("enter",("info: 0x%lx  record: 0x%lx", (long) info, (long) record));
27
25
 
28
26
  test_active(info);
29
27
 
30
28
  if (info->opt_flag & READ_CHECK_USED && hp_rectest(info,record))
31
 
    DBUG_RETURN(my_errno);                      /* Record changed */
 
29
    return(my_errno);                   /* Record changed */
32
30
  share->changed=1;
33
31
 
34
32
  if ( --(share->records) < share->blength >> 1) share->blength>>=1;
48
46
  pos[share->reclength]=0;              /* Record deleted */
49
47
  share->deleted++;
50
48
  info->current_hash_ptr=0;
51
 
#if !defined(DBUG_OFF) && defined(EXTRA_HEAP_DEBUG)
52
 
  DBUG_EXECUTE("check_heap",heap_check_heap(info, 0););
53
 
#endif
54
49
 
55
 
  DBUG_RETURN(0);
 
50
  return(0);
56
51
err:
57
52
  if (++(share->records) == share->blength)
58
53
    share->blength+= share->blength;
59
 
  DBUG_RETURN(my_errno);
 
54
  return(my_errno);
60
55
}
61
56
 
62
57
 
107
102
  ulong blength,pos2,pos_hashnr,lastpos_hashnr;
108
103
  HASH_INFO *lastpos,*gpos,*pos,*pos3,*empty,*last_ptr;
109
104
  HP_SHARE *share=info->s;
110
 
  DBUG_ENTER("hp_delete_key");
111
105
 
112
106
  blength=share->blength;
113
107
  if (share->records+1 == blength)
128
122
    gpos=pos;
129
123
    if (!(pos=pos->next_key))
130
124
    {
131
 
      DBUG_RETURN(my_errno=HA_ERR_CRASHED);     /* This shouldn't happend */
 
125
      return(my_errno=HA_ERR_CRASHED);  /* This shouldn't happend */
132
126
    }
133
127
  }
134
128
 
139
133
    /* Save for heap_rnext/heap_rprev */
140
134
    info->current_hash_ptr=last_ptr;
141
135
    info->current_ptr = last_ptr ? last_ptr->ptr_to_rec : 0;
142
 
    DBUG_PRINT("info",("Corrected current_ptr to point at: 0x%lx",
143
 
                       (long) info->current_ptr));
144
136
  }
145
137
  empty=pos;
146
138
  if (gpos)
155
147
    keyinfo->hash_buckets--;
156
148
 
157
149
  if (empty == lastpos)                 /* deleted last hash key */
158
 
    DBUG_RETURN (0);
 
150
    return (0);
159
151
 
160
152
  /* Move the last key (lastpos) */
161
153
  lastpos_hashnr = hp_rec_hashnr(keyinfo, lastpos->ptr_to_rec);
165
157
  if (pos == empty)                     /* Move to empty position. */
166
158
  {
167
159
    empty[0]=lastpos[0];
168
 
    DBUG_RETURN(0);
 
160
    return(0);
169
161
  }
170
162
  pos_hashnr = hp_rec_hashnr(keyinfo, pos->ptr_to_rec);
171
163
  /* pos3 is where the pos should be */
176
168
    empty[0]=pos[0];                    /* Save it here */
177
169
    pos[0]=lastpos[0];                  /* This shold be here */
178
170
    hp_movelink(pos, pos3, empty);      /* Fix link to pos */
179
 
    DBUG_RETURN(0);
 
171
    return(0);
180
172
  }
181
173
  pos2= hp_mask(lastpos_hashnr, blength, share->records + 1);
182
174
  if (pos2 == hp_mask(pos_hashnr, blength, share->records + 1))
185
177
    {
186
178
      empty[0]=lastpos[0];
187
179
      hp_movelink(lastpos, pos, empty);
188
 
      DBUG_RETURN(0);
 
180
      return(0);
189
181
    }
190
182
    pos3= pos;                          /* Link pos->next after lastpos */
191
183
  }
198
190
  empty[0]=lastpos[0];
199
191
  hp_movelink(pos3, empty, pos->next_key);
200
192
  pos->next_key=empty;
201
 
  DBUG_RETURN(0);
 
193
  return(0);
202
194
}