~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/hash/hash.src

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*-
2
 
 * See the file LICENSE for redistribution information.
3
 
 *
4
 
 * Copyright (c) 1996-2002
5
 
 *      Sleepycat Software.  All rights reserved.
6
 
 *
7
 
 * $Id$
8
 
 */
9
 
/*
10
 
 * Copyright (c) 1995, 1996
11
 
 *      Margo Seltzer.  All rights reserved.
12
 
 */
13
 
/*
14
 
 * Copyright (c) 1995, 1996
15
 
 *      The President and Fellows of Harvard University.  All rights reserved.
16
 
 *
17
 
 * This code is derived from software contributed to Berkeley by
18
 
 * Margo Seltzer.
19
 
 *
20
 
 * Redistribution and use in source and binary forms, with or without
21
 
 * modification, are permitted provided that the following conditions
22
 
 * are met:
23
 
 * 1. Redistributions of source code must retain the above copyright
24
 
 *    notice, this list of conditions and the following disclaimer.
25
 
 * 2. Redistributions in binary form must reproduce the above copyright
26
 
 *    notice, this list of conditions and the following disclaimer in the
27
 
 *    documentation and/or other materials provided with the distribution.
28
 
 * 3. Neither the name of the University nor the names of its contributors
29
 
 *    may be used to endorse or promote products derived from this software
30
 
 *    without specific prior written permission.
31
 
 *
32
 
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
33
 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34
 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35
 
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
36
 
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37
 
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38
 
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39
 
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40
 
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41
 
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42
 
 * SUCH DAMAGE.
43
 
 */
44
 
 
45
 
PREFIX  __ham
46
 
DBPRIVATE
47
 
 
48
 
INCLUDE #include "db_config.h"
49
 
INCLUDE
50
 
INCLUDE #ifndef NO_SYSTEM_INCLUDES
51
 
INCLUDE #include <sys/types.h>
52
 
INCLUDE
53
 
INCLUDE #include <ctype.h>
54
 
INCLUDE #include <string.h>
55
 
INCLUDE #endif
56
 
INCLUDE
57
 
INCLUDE #include "db_int.h"
58
 
INCLUDE #include "dbinc/crypto.h"
59
 
INCLUDE #include "dbinc/db_page.h"
60
 
INCLUDE #include "dbinc/db_dispatch.h"
61
 
INCLUDE #include "dbinc/db_am.h"
62
 
INCLUDE #include "dbinc/hash.h"
63
 
INCLUDE #include "dbinc/rep.h"
64
 
INCLUDE #include "dbinc/log.h"
65
 
INCLUDE #include "dbinc/txn.h"
66
 
INCLUDE
67
 
 
68
 
/*
69
 
 * HASH-insdel: used for hash to insert/delete a pair of entries onto a master
70
 
 * page. The pair might be regular key/data pairs or they might be the
71
 
 * structures that refer to off page items, duplicates or offpage duplicates.
72
 
 *  opcode - PUTPAIR/DELPAIR + big masks
73
 
 *  fileid - identifies the file referenced
74
 
 *  pgno - page within file
75
 
 *  ndx - index on the page of the item being added (item index)
76
 
 *  pagelsn - lsn on the page before the update
77
 
 *  key - the key being inserted
78
 
 *  data - the data being inserted
79
 
 */
80
 
BEGIN insdel            21
81
 
ARG     opcode          u_int32_t       lu
82
 
DB      fileid          int32_t         ld
83
 
WRLOCK  pgno            db_pgno_t       lu
84
 
ARG     ndx             u_int32_t       lu
85
 
POINTER pagelsn         DB_LSN *        lu
86
 
DBT     key             DBT             s
87
 
DBT     data            DBT             s
88
 
END
89
 
 
90
 
/*
91
 
 * Used to add and remove overflow pages.
92
 
 * prev_pgno is the previous page that is going to get modified to
93
 
 *      point to this one.  If this is the first page in a chain
94
 
 *      then prev_pgno should be PGNO_INVALID.
95
 
 * new_pgno is the page being allocated.
96
 
 * next_pgno is the page that follows this one.  On allocation,
97
 
 *      this should be PGNO_INVALID.  For deletes, it may exist.
98
 
 * pagelsn is the old lsn on the page.
99
 
 */
100
 
BEGIN newpage           22
101
 
ARG     opcode          u_int32_t       lu
102
 
DB      fileid          int32_t         ld
103
 
WRLOCKNZ prev_pgno      db_pgno_t       lu
104
 
POINTER prevlsn         DB_LSN *        lu
105
 
WRLOCKNZ new_pgno       db_pgno_t       lu
106
 
POINTER pagelsn         DB_LSN *        lu
107
 
WRLOCKNZ next_pgno      db_pgno_t       lu
108
 
POINTER nextlsn         DB_LSN *        lu
109
 
END
110
 
 
111
 
/*
112
 
 * Splitting requires two types of log messages.  The second logs the
113
 
 * data on the original page.  To redo the split, we have to visit the
114
 
 * new page (pages) and add the items back on the page if they are not
115
 
 * yet there.
116
 
 */
117
 
BEGIN splitdata         24
118
 
DB      fileid          int32_t         ld
119
 
ARG     opcode          u_int32_t       lu
120
 
WRLOCK  pgno            db_pgno_t       lu
121
 
PGDBT   pageimage       DBT             s
122
 
POINTER pagelsn         DB_LSN *        lu
123
 
END
124
 
 
125
 
/*
126
 
 * HASH-replace: is used for hash to handle partial puts that only
127
 
 * affect a single master page.
128
 
 *  fileid - identifies the file referenced
129
 
 *  pgno - page within file
130
 
 *  ndx - index on the page of the item being modified (item index)
131
 
 *  pagelsn - lsn on the page before the update
132
 
 *  off - offset in the old item where the new item is going.
133
 
 *  olditem - DBT that describes the part of the item being replaced.
134
 
 *  newitem - DBT of the new item.
135
 
 *  makedup - this was a replacement that made an item a duplicate.
136
 
 */
137
 
BEGIN replace           25
138
 
DB      fileid          int32_t         ld
139
 
WRLOCK  pgno            db_pgno_t       lu
140
 
ARG     ndx             u_int32_t       lu
141
 
POINTER pagelsn         DB_LSN *        lu
142
 
ARG     off             int32_t         ld
143
 
DBT     olditem         DBT             s
144
 
DBT     newitem         DBT             s
145
 
ARG     makedup         u_int32_t       lu
146
 
END
147
 
 
148
 
/*
149
 
 * Used when we empty the first page in a bucket and there are pages after
150
 
 * it.  The page after it gets copied into the bucket page (since bucket
151
 
 * pages have to be in fixed locations).
152
 
 * pgno: the bucket page
153
 
 * pagelsn: the old LSN on the bucket page
154
 
 * next_pgno: the page number of the next page
155
 
 * nnext_pgno: page after next_pgno (may need to change its prev)
156
 
 * nnextlsn: the LSN of nnext_pgno.
157
 
 */
158
 
BEGIN copypage          28
159
 
DB      fileid          int32_t         ld
160
 
WRLOCK  pgno            db_pgno_t       lu
161
 
POINTER pagelsn         DB_LSN *        lu
162
 
WRLOCK  next_pgno       db_pgno_t       lu
163
 
POINTER nextlsn         DB_LSN *        lu
164
 
WRLOCKNZ nnext_pgno     db_pgno_t       lu
165
 
POINTER nnextlsn        DB_LSN *        lu
166
 
PGDBT   page            DBT             s
167
 
END
168
 
 
169
 
/*
170
 
 * This record logs the meta-data aspects of a split operation.  It has enough
171
 
 * information so that we can record both an individual page allocation as well
172
 
 * as a group allocation which we do because in sub databases, the pages in
173
 
 * a hash doubling, must be contiguous.  If we do a group allocation, the
174
 
 * number of pages allocated is bucket + 1, pgno is the page number of the
175
 
 * first newly allocated bucket.
176
 
 *
177
 
 * bucket:      Old maximum bucket number.
178
 
 * mmpgno:      Master meta-data page number (0 if same as mpgno).
179
 
 * mmetalsn:    Lsn of the master meta-data page.
180
 
 * mpgno:       Meta-data page number.
181
 
 * metalsn:     Lsn of the meta-data page.
182
 
 * pgno:        Page allocated to bucket + 1 (first newly allocated page)
183
 
 * pagelsn:     Lsn of either the first page allocated (if newalloc == 0) or
184
 
 *              the last page allocated (if newalloc == 1).
185
 
 * newalloc:    1 indicates that this record did the actual allocation;
186
 
 *              0 indicates that the pages were already allocated from a
187
 
 *              previous (failed) allocation.
188
 
 */
189
 
BEGIN metagroup         29
190
 
DB      fileid          int32_t         ld
191
 
ARG     bucket          u_int32_t       lu
192
 
WRLOCK  mmpgno          db_pgno_t       lu
193
 
POINTER mmetalsn        DB_LSN *        lu
194
 
WRLOCKNZ mpgno          db_pgno_t       lu
195
 
POINTER metalsn         DB_LSN *        lu
196
 
WRLOCK  pgno            db_pgno_t       lu
197
 
POINTER pagelsn         DB_LSN *        lu
198
 
ARG     newalloc        u_int32_t       lu
199
 
END
200
 
 
201
 
/*
202
 
 * groupalloc
203
 
 *
204
 
 * This is used in conjunction with MPOOL_NEW_GROUP when we are creating
205
 
 * a new database to make sure that we recreate or reclaim free pages
206
 
 * when we allocate a chunk of contiguous ones during database creation.
207
 
 *
208
 
 * pgno: meta-data page number
209
 
 * metalsn: meta-data lsn
210
 
 * start_pgno: starting page number
211
 
 * num: number of allocated pages
212
 
 */
213
 
BEGIN groupalloc        32
214
 
DB      fileid          int32_t         ld
215
 
POINTER meta_lsn        DB_LSN *        lu
216
 
WRLOCK  start_pgno      db_pgno_t       lu
217
 
ARG     num             u_int32_t       lu
218
 
ARG     free            db_pgno_t       lu
219
 
END
220
 
 
221
 
/*
222
 
 * Records for backing out cursor adjustment.
223
 
 *   curadj - added or deleted a record or a dup
224
 
 *      within a record.
225
 
 *      pgno    - page that was effected
226
 
 *      indx    - indx of recrod effected.
227
 
 *      len     - if a dup its length.
228
 
 *      dup_off - if a dup its offset
229
 
 *      add     - 1 if add 0 if delete
230
 
 *      is_dup  - 1 if dup 0 otherwise.
231
 
 *      order   - order assigned to this deleted record or dup.
232
 
 *
233
 
 *   chgpg - rmoved a page, move the records to a new page
234
 
 *      mode    - CHGPG page was deleted or records move to new page.
235
 
 *              - SPLIT we split a bucket
236
 
 *              - DUP we convered to off page duplicates.
237
 
 *      old_pgno, new_pgno - old and new page numbers.
238
 
 *      old_index, new_index - old and new index numbers, NDX_INVALID if
239
 
 *              it effects all records on the page.
240
 
 *              For three opcodes new in 3.3 (DB_HAM_DELFIRSTPG, DELMIDPG,
241
 
 *              and DELLASTPG), we overload old_indx and new_indx to avoid
242
 
 *              needing a new log record type:  old_indx stores the only
243
 
 *              indx of interest to these records, and new_indx stores the
244
 
 *              order that's assigned to the lowest deleted record we're
245
 
 *              moving.
246
 
 */
247
 
BEGIN curadj    33
248
 
DB      fileid          int32_t         ld
249
 
ARG     pgno            db_pgno_t       lu
250
 
ARG     indx            u_int32_t       lu
251
 
ARG     len             u_int32_t       lu
252
 
ARG     dup_off         u_int32_t       lu
253
 
ARG     add             int             ld
254
 
ARG     is_dup          int             ld
255
 
ARG     order           u_int32_t       lu
256
 
END
257
 
 
258
 
BEGIN chgpg     34
259
 
DB      fileid          int32_t         ld
260
 
ARG     mode            db_ham_mode     ld
261
 
ARG     old_pgno        db_pgno_t       lu
262
 
ARG     new_pgno        db_pgno_t       lu
263
 
ARG     old_indx        u_int32_t       lu
264
 
ARG     new_indx        u_int32_t       lu
265
 
END
266