forked from percona/PerconaFT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb-4.6.19.h
2670 lines (2394 loc) · 104 KB
/
db-4.6.19.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
/*
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2007 Oracle. All rights reserved.
*
* $Id$
*
* db.h include file layout:
* General.
* Database Environment.
* Locking subsystem.
* Logging subsystem.
* Shared buffer cache (mpool) subsystem.
* Transaction subsystem.
* Access methods.
* Access method cursors.
* Dbm/Ndbm, Hsearch historic interfaces.
*/
#ifndef _DB_H_
#define _DB_H_
#ifndef __NO_SYSTEM_INCLUDES
#include <sys/types.h>
#include <inttypes.h>
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#endif
#if defined(__cplusplus)
extern "C" {
#endif
#undef __P
#define __P(protos) protos
/*
* Berkeley DB version information.
*/
#define DB_VERSION_MAJOR 4
#define DB_VERSION_MINOR 6
#define DB_VERSION_PATCH 19
#define DB_VERSION_STRING "Berkeley DB 4.6.19: (August 10, 2007)"
/*
* !!!
* Berkeley DB uses specifically sized types. If they're not provided by
* the system, typedef them here.
*
* We protect them against multiple inclusion using __BIT_TYPES_DEFINED__,
* as does BIND and Kerberos, since we don't know for sure what #include
* files the user is using.
*
* !!!
* We also provide the standard u_int, u_long etc., if they're not provided
* by the system.
*/
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
#endif
/*
* Missing ANSI types.
*
* uintmax_t --
* Largest unsigned type, used to align structures in memory. We don't store
* floating point types in structures, so integral types should be sufficient
* (and we don't have to worry about systems that store floats in other than
* power-of-2 numbers of bytes). Additionally this fixes compilers that rewrite
* structure assignments and ANSI C memcpy calls to be in-line instructions
* that happen to require alignment.
*
* uintptr_t --
* Unsigned type that's the same size as a pointer. There are places where
* DB modifies pointers by discarding the bottom bits to guarantee alignment.
* We can't use uintmax_t, it may be larger than the pointer, and compilers
* get upset about that. So far we haven't run on any machine where there's
* no unsigned type the same size as a pointer -- here's hoping.
*/
/*
* Sequences are only available on machines with 64-bit integral types.
*/
typedef int64_t db_seq_t;
/* Thread and process identification. */
typedef pthread_t db_threadid_t;
/* Basic types that are exported or quasi-exported. */
typedef uint32_t db_pgno_t; /* Page number type. */
typedef uint16_t db_indx_t; /* Page offset type. */
#define DB_MAX_PAGES 0xffffffff /* >= # of pages in a file */
typedef uint32_t db_recno_t; /* Record number type. */
#define DB_MAX_RECORDS 0xffffffff /* >= # of records in a tree */
typedef uint32_t db_timeout_t; /* Type of a timeout. */
/*
* Region offsets are the difference between a pointer in a region and the
* region's base address. With private environments, both addresses are the
* result of calling malloc, and we can't assume anything about what malloc
* will return, so region offsets have to be able to hold differences between
* arbitrary pointers.
*/
typedef uintptr_t roff_t;
/*
* Forward structure declarations, so we can declare pointers and
* applications can get type checking.
*/
struct __db; typedef struct __db DB;
struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT;
struct __db_cipher; typedef struct __db_cipher DB_CIPHER;
struct __db_compact; typedef struct __db_compact DB_COMPACT;
struct __db_dbt; typedef struct __db_dbt DBT;
struct __db_env; typedef struct __db_env DB_ENV;
struct __db_h_stat; typedef struct __db_h_stat DB_HASH_STAT;
struct __db_ilock; typedef struct __db_ilock DB_LOCK_ILOCK;
struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT;
struct __db_lock_hstat; typedef struct __db_lock_hstat DB_LOCK_HSTAT;
struct __db_lock_u; typedef struct __db_lock_u DB_LOCK;
struct __db_locker; typedef struct __db_locker DB_LOCKER;
struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ;
struct __db_locktab; typedef struct __db_locktab DB_LOCKTAB;
struct __db_log; typedef struct __db_log DB_LOG;
struct __db_log_cursor; typedef struct __db_log_cursor DB_LOGC;
struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT;
struct __db_lsn; typedef struct __db_lsn DB_LSN;
struct __db_mpool; typedef struct __db_mpool DB_MPOOL;
struct __db_mpool_fstat;typedef struct __db_mpool_fstat DB_MPOOL_FSTAT;
struct __db_mpool_stat; typedef struct __db_mpool_stat DB_MPOOL_STAT;
struct __db_mpoolfile; typedef struct __db_mpoolfile DB_MPOOLFILE;
struct __db_mutex_stat; typedef struct __db_mutex_stat DB_MUTEX_STAT;
struct __db_mutex_t; typedef struct __db_mutex_t DB_MUTEX;
struct __db_mutexmgr; typedef struct __db_mutexmgr DB_MUTEXMGR;
struct __db_preplist; typedef struct __db_preplist DB_PREPLIST;
struct __db_qam_stat; typedef struct __db_qam_stat DB_QUEUE_STAT;
struct __db_rep; typedef struct __db_rep DB_REP;
struct __db_rep_stat; typedef struct __db_rep_stat DB_REP_STAT;
struct __db_repmgr_site; \
typedef struct __db_repmgr_site DB_REPMGR_SITE;
struct __db_repmgr_stat; \
typedef struct __db_repmgr_stat DB_REPMGR_STAT;
struct __db_seq_record; typedef struct __db_seq_record DB_SEQ_RECORD;
struct __db_seq_stat; typedef struct __db_seq_stat DB_SEQUENCE_STAT;
struct __db_sequence; typedef struct __db_sequence DB_SEQUENCE;
struct __db_txn; typedef struct __db_txn DB_TXN;
struct __db_txn_active; typedef struct __db_txn_active DB_TXN_ACTIVE;
struct __db_txn_stat; typedef struct __db_txn_stat DB_TXN_STAT;
struct __db_txnmgr; typedef struct __db_txnmgr DB_TXNMGR;
struct __dbc; typedef struct __dbc DBC;
struct __dbc_internal; typedef struct __dbc_internal DBC_INTERNAL;
struct __fh_t; typedef struct __fh_t DB_FH;
struct __fname; typedef struct __fname FNAME;
struct __key_range; typedef struct __key_range DB_KEY_RANGE;
struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE;
/* Key/data structure -- a Data-Base Thang. */
struct __db_dbt {
void *data; /* Key/data */
uint32_t size; /* key/data length */
uint32_t ulen; /* RO: length of user buffer. */
uint32_t dlen; /* RO: get/put record length. */
uint32_t doff; /* RO: get/put record offset. */
void *app_data;
#define DB_DBT_APPMALLOC 0x001 /* Callback allocated memory. */
#define DB_DBT_DUPOK 0x002 /* Insert if duplicate. */
#define DB_DBT_ISSET 0x004 /* Lower level calls set value. */
#define DB_DBT_MALLOC 0x008 /* Return in malloc'd memory. */
#define DB_DBT_MULTIPLE 0x010 /* References multiple records. */
#define DB_DBT_PARTIAL 0x020 /* Partial put/get. */
#define DB_DBT_REALLOC 0x040 /* Return in realloc'd memory. */
#define DB_DBT_USERCOPY 0x080 /* Use the user-supplied callback. */
#define DB_DBT_USERMEM 0x100 /* Return in user's memory. */
uint32_t flags;
};
/*
* Common flags --
* Interfaces which use any of these common flags should never have
* interface specific flags in this range.
*/
#define DB_CREATE 0x0000001 /* Create file as necessary. */
#define DB_DURABLE_UNKNOWN 0x0000002 /* Durability on open (internal). */
#define DB_FORCE 0x0000004 /* Force (anything). */
#define DB_MULTIVERSION 0x0000008 /* Multiversion concurrency control. */
#define DB_NOMMAP 0x0000010 /* Don't mmap underlying file. */
#define DB_RDONLY 0x0000020 /* Read-only (O_RDONLY). */
#define DB_RECOVER 0x0000040 /* Run normal recovery. */
#define DB_THREAD 0x0000080 /* Applications are threaded. */
#define DB_TRUNCATE 0x0000100 /* Discard existing DB (O_TRUNC). */
#define DB_TXN_NOSYNC 0x0000200 /* Do not sync log on commit. */
#define DB_TXN_NOWAIT 0x0000400 /* Do not wait for locks. */
#define DB_TXN_NOT_DURABLE 0x0000800 /* Do not log changes. */
#define DB_TXN_WRITE_NOSYNC 0x0001000 /* Write the log but don't sync. */
#define DB_SPARE_FLAG 0x0002000 /* Spare. */
/*
* Common flags --
* Interfaces which use any of these common flags should never have
* interface specific flags in this range.
*
* DB_AUTO_COMMIT:
* DB_ENV->set_flags, DB->open
* (Note: until the 4.3 release, legal to DB->associate, DB->del,
* DB->put, DB->remove, DB->rename and DB->truncate, and others.)
* DB_READ_COMMITTED:
* DB->cursor, DB->get, DB->join, DBcursor->get, DB_ENV->txn_begin
* DB_READ_UNCOMMITTED:
* DB->cursor, DB->get, DB->join, DB->open, DBcursor->get,
* DB_ENV->txn_begin
* DB_TXN_SNAPSHOT:
* DB_ENV->set_flags, DB_ENV->txn_begin, DB->cursor
*
* !!!
* The DB_READ_COMMITTED and DB_READ_UNCOMMITTED bit masks can't be changed
* without also changing the masks for the flags that can be OR'd into DB
* access method and cursor operation values.
*/
#define DB_IGNORE_LEASE 0x01000000/* Ignore leases. */
#define DB_AUTO_COMMIT 0x02000000/* Implied transaction. */
#define DB_READ_COMMITTED 0x04000000/* Degree 2 isolation. */
#define DB_DEGREE_2 0x04000000/* Historic name. */
#define DB_READ_UNCOMMITTED 0x08000000/* Degree 1 isolation. */
#define DB_DIRTY_READ 0x08000000/* Historic name. */
#define DB_TXN_SNAPSHOT 0x10000000/* Snapshot isolation. */
/*
* Flags common to db_env_create and db_create.
*/
#define DB_CXX_NO_EXCEPTIONS 0x0000001 /* C++: return error values. */
/*
* Flags private to db_env_create.
* Shared flags up to 0x0000001 */
#define DB_RPCCLIENT 0x0000002 /* An RPC client environment. */
/*
* Flags private to db_create.
* Shared flags up to 0x0000001 */
#define DB_XA_CREATE 0x0000002 /* Open in an XA environment. */
/*
* Flags shared by DB_ENV->remove and DB_ENV->open.
* Shared flags up to 0x0002000 */
#define DB_USE_ENVIRON 0x0004000 /* Use the environment. */
#define DB_USE_ENVIRON_ROOT 0x0008000 /* Use the environment if root. */
/*
* Flags private to DB_ENV->open.
*/
#define DB_INIT_CDB 0x0010000 /* Concurrent Access Methods. */
#define DB_INIT_LOCK 0x0020000 /* Initialize locking. */
#define DB_INIT_LOG 0x0040000 /* Initialize logging. */
#define DB_INIT_MPOOL 0x0080000 /* Initialize mpool. */
#define DB_INIT_REP 0x0100000 /* Initialize replication. */
#define DB_INIT_TXN 0x0200000 /* Initialize transactions. */
#define DB_LOCKDOWN 0x0400000 /* Lock memory into physical core. */
#define DB_PRIVATE 0x0800000 /* DB_ENV is process local. */
#define DB_RECOVER_FATAL 0x1000000 /* Run catastrophic recovery. */
#define DB_REGISTER 0x2000000 /* Multi-process registry. */
#define DB_SYSTEM_MEM 0x4000000 /* Use system-backed memory. */
#define DB_JOINENV 0x0 /* Compatibility. */
/*
* Flags private to DB->open.
* Shared flags up to 0x0002000 */
#define DB_EXCL 0x0004000 /* Exclusive open (O_EXCL). */
#define DB_FCNTL_LOCKING 0x0008000 /* UNDOC: fcntl(2) locking. */
#define DB_NO_AUTO_COMMIT 0x0010000 /* Override env-wide AUTOCOMMIT. */
#define DB_RDWRMASTER 0x0020000 /* UNDOC: allow subdb master open R/W */
#define DB_WRITEOPEN 0x0040000 /* UNDOC: open with write lock. */
/*
* Flags private to DB->associate.
* Shared flags up to 0x0002000 */
#define DB_IMMUTABLE_KEY 0x0004000 /* Secondary key is immutable. */
/* Shared flags at 0x1000000 */
/*
* Flags private to DB_ENV->txn_begin.
* Shared flags up to 0x0002000 */
#define DB_TXN_SYNC 0x0004000 /* Always sync log on commit. */
#define DB_TXN_WAIT 0x0008000 /* Always wait for locks in this TXN. */
/*
* Flags private to DB_ENV->txn_checkpoint.
* Shared flags up to 0x0002000 */
#define DB_CKP_INTERNAL 0x0004000 /* Internally generated checkpoint. */
/*
* Flags private to DB_ENV->set_encrypt.
*/
#define DB_ENCRYPT_AES 0x0000001 /* AES, assumes SHA1 checksum */
/*
* Flags private to DB_ENV->set_flags.
* Shared flags up to 0x00002000 */
#define DB_CDB_ALLDB 0x00004000/* Set CDB locking per environment. */
#define DB_DIRECT_DB 0x00008000/* Don't buffer databases in the OS. */
#define DB_DIRECT_LOG 0x00010000/* Don't buffer log files in the OS. */
#define DB_DSYNC_DB 0x00020000/* Set O_DSYNC on the databases. */
#define DB_DSYNC_LOG 0x00040000/* Set O_DSYNC on the log. */
#define DB_LOG_AUTOREMOVE 0x00080000/* Automatically remove log files. */
#define DB_LOG_INMEMORY 0x00100000/* Store logs in buffers in memory. */
#define DB_NOLOCKING 0x00200000/* Set locking/mutex behavior. */
#define DB_NOPANIC 0x00400000/* Set panic state per DB_ENV. */
#define DB_OVERWRITE 0x00800000/* Overwrite unlinked region files. */
#define DB_PANIC_ENVIRONMENT 0x01000000/* Set panic state per environment. */
/* Shared flags at 0x02000000 */
/* Shared flags at 0x04000000 */
/* Shared flags at 0x08000000 */
/* Shared flags at 0x10000000 */
#define DB_REGION_INIT 0x20000000/* Page-fault regions on open. */
#define DB_TIME_NOTGRANTED 0x40000000/* Return NOTGRANTED on timeout. */
#define DB_YIELDCPU 0x80000000/* Yield the CPU (a lot). */
/*
* Flags private to DB->set_feedback's callback.
*/
#define DB_UPGRADE 0x0000001 /* Upgrading. */
#define DB_VERIFY 0x0000002 /* Verifying. */
/*
* Flags private to DB->compact.
* Shared flags up to 0x00002000
*/
#define DB_FREELIST_ONLY 0x00004000 /* Just sort and truncate. */
#define DB_FREE_SPACE 0x00008000 /* Free space . */
#define DB_COMPACT_FLAGS \
(DB_FREELIST_ONLY | DB_FREE_SPACE)
/*
* Flags private to DB_MPOOLFILE->open.
* Shared flags up to 0x0002000 */
#define DB_DIRECT 0x0004000 /* Don't buffer the file in the OS. */
#define DB_EXTENT 0x0008000 /* internal: dealing with an extent. */
#define DB_ODDFILESIZE 0x0010000 /* Truncate file to N * pgsize. */
/*
* Flags private to DB->set_flags.
* Shared flags up to 0x00002000 */
#define DB_CHKSUM 0x00004000 /* Do checksumming */
#define DB_DUP 0x00008000 /* Btree, Hash: duplicate keys. */
#define DB_DUPSORT 0x00010000 /* Btree, Hash: duplicate keys. */
#define DB_ENCRYPT 0x00020000 /* Btree, Hash: duplicate keys. */
#define DB_INORDER 0x00040000 /* Queue: strict ordering on consume */
#define DB_RECNUM 0x00080000 /* Btree: record numbers. */
#define DB_RENUMBER 0x00100000 /* Recno: renumber on insert/delete. */
#define DB_REVSPLITOFF 0x00200000 /* Btree: turn off reverse splits. */
#define DB_SNAPSHOT 0x00400000 /* Recno: snapshot the input. */
/*
* Flags private to the DB_ENV->stat_print, DB->stat and DB->stat_print methods.
*/
#define DB_FAST_STAT 0x0000001 /* Don't traverse the database. */
#define DB_STAT_ALL 0x0000002 /* Print: Everything. */
#define DB_STAT_CLEAR 0x0000004 /* Clear stat after returning values. */
#define DB_STAT_LOCK_CONF 0x0000008 /* Print: Lock conflict matrix. */
#define DB_STAT_LOCK_LOCKERS 0x0000010 /* Print: Lockers. */
#define DB_STAT_LOCK_OBJECTS 0x0000020 /* Print: Lock objects. */
#define DB_STAT_LOCK_PARAMS 0x0000040 /* Print: Lock parameters. */
#define DB_STAT_MEMP_HASH 0x0000080 /* Print: Mpool hash buckets. */
#define DB_STAT_NOERROR 0x0000100 /* Internal: continue on error. */
#define DB_STAT_SUBSYSTEM 0x0000200 /* Print: Subsystems too. */
/*
* Flags private to DB->join.
*/
#define DB_JOIN_NOSORT 0x0000001 /* Don't try to optimize join. */
/*
* Flags private to DB->verify.
*/
#define DB_AGGRESSIVE 0x0000001 /* Salvage whatever could be data.*/
#define DB_NOORDERCHK 0x0000002 /* Skip sort order/hashing check. */
#define DB_ORDERCHKONLY 0x0000004 /* Only perform the order check. */
#define DB_PR_PAGE 0x0000008 /* Show page contents (-da). */
#define DB_PR_RECOVERYTEST 0x0000010 /* Recovery test (-dr). */
#define DB_PRINTABLE 0x0000020 /* Use printable format for salvage. */
#define DB_SALVAGE 0x0000040 /* Salvage what looks like data. */
#define DB_UNREF 0x0000080 /* Report unreferenced pages. */
/*
* !!!
* These must not go over 0x8000, or they will collide with the flags
* used by __bam_vrfy_subtree.
*/
/*
* Flags private to DB->rep_set_transport's send callback.
*/
#define DB_REP_ANYWHERE 0x0000001 /* Message can be serviced anywhere. */
#define DB_REP_NOBUFFER 0x0000002 /* Do not buffer this message. */
#define DB_REP_PERMANENT 0x0000004 /* Important--app. may want to flush. */
#define DB_REP_REREQUEST 0x0000008 /* This msg already been requested. */
/*******************************************************
* Mutexes.
*******************************************************/
typedef uint32_t db_mutex_t;
/*
* Flag arguments for DbEnv.mutex_alloc, DbEnv.is_alive and for the
* DB_MUTEX structure.
*/
#define DB_MUTEX_ALLOCATED 0x01 /* Mutex currently allocated. */
#define DB_MUTEX_LOCKED 0x02 /* Mutex currently locked. */
#define DB_MUTEX_LOGICAL_LOCK 0x04 /* Mutex backs a database lock. */
#define DB_MUTEX_PROCESS_ONLY 0x08 /* Mutex private to a process. */
#define DB_MUTEX_SELF_BLOCK 0x10 /* Must be able to block self. */
struct __db_mutex_stat {
/* The following fields are maintained in the region's copy. */
uint32_t st_mutex_align; /* Mutex alignment */
uint32_t st_mutex_tas_spins; /* Mutex test-and-set spins */
uint32_t st_mutex_cnt; /* Mutex count */
uint32_t st_mutex_free; /* Available mutexes */
uint32_t st_mutex_inuse; /* Mutexes in use */
uint32_t st_mutex_inuse_max; /* Maximum mutexes ever in use */
/* The following fields are filled-in from other places. */
#ifndef __TEST_DB_NO_STATISTICS
uint32_t st_region_wait; /* Region lock granted after wait. */
uint32_t st_region_nowait; /* Region lock granted without wait. */
roff_t st_regsize; /* Region size. */
#endif
};
/* This is the length of the buffer passed to DB_ENV->thread_id_string() */
#define DB_THREADID_STRLEN 128
/*******************************************************
* Locking.
*******************************************************/
#define DB_LOCKVERSION 1
#define DB_FILE_ID_LEN 20 /* Unique file ID length. */
/*
* Deadlock detector modes; used in the DB_ENV structure to configure the
* locking subsystem.
*/
#define DB_LOCK_NORUN 0
#define DB_LOCK_DEFAULT 1 /* Default policy. */
#define DB_LOCK_EXPIRE 2 /* Only expire locks, no detection. */
#define DB_LOCK_MAXLOCKS 3 /* Select locker with max locks. */
#define DB_LOCK_MAXWRITE 4 /* Select locker with max writelocks. */
#define DB_LOCK_MINLOCKS 5 /* Select locker with min locks. */
#define DB_LOCK_MINWRITE 6 /* Select locker with min writelocks. */
#define DB_LOCK_OLDEST 7 /* Select oldest locker. */
#define DB_LOCK_RANDOM 8 /* Select random locker. */
#define DB_LOCK_YOUNGEST 9 /* Select youngest locker. */
/* Flag values for lock_vec(), lock_get(). */
#define DB_LOCK_ABORT 0x001 /* Internal: Lock during abort. */
#define DB_LOCK_NOWAIT 0x002 /* Don't wait on unavailable lock. */
#define DB_LOCK_RECORD 0x004 /* Internal: record lock. */
#define DB_LOCK_SET_TIMEOUT 0x008 /* Internal: set lock timeout. */
#define DB_LOCK_SWITCH 0x010 /* Internal: switch existing lock. */
#define DB_LOCK_UPGRADE 0x020 /* Internal: upgrade existing lock. */
/* Flag values for DbEnv.set_timeout. */
#define DB_SET_LOCK_TIMEOUT 1 /* Set lock timeout */
#define DB_SET_TXN_NOW 2 /* Timeout lock now (internal) */
#define DB_SET_TXN_TIMEOUT 3 /* Set transaction timeout */
/*
* Simple R/W lock modes and for multi-granularity intention locking.
*
* !!!
* These values are NOT random, as they are used as an index into the lock
* conflicts arrays, i.e., DB_LOCK_IWRITE must be == 3, and DB_LOCK_IREAD
* must be == 4.
*/
typedef enum {
DB_LOCK_NG=0, /* Not granted. */
DB_LOCK_READ=1, /* Shared/read. */
DB_LOCK_WRITE=2, /* Exclusive/write. */
DB_LOCK_WAIT=3, /* Wait for event */
DB_LOCK_IWRITE=4, /* Intent exclusive/write. */
DB_LOCK_IREAD=5, /* Intent to share/read. */
DB_LOCK_IWR=6, /* Intent to read and write. */
DB_LOCK_READ_UNCOMMITTED=7, /* Degree 1 isolation. */
DB_LOCK_WWRITE=8 /* Was Written. */
} db_lockmode_t;
/*
* Request types.
*/
typedef enum {
DB_LOCK_DUMP=0, /* Display held locks. */
DB_LOCK_GET=1, /* Get the lock. */
DB_LOCK_GET_TIMEOUT=2, /* Get lock with a timeout. */
DB_LOCK_INHERIT=3, /* Pass locks to parent. */
DB_LOCK_PUT=4, /* Release the lock. */
DB_LOCK_PUT_ALL=5, /* Release locker's locks. */
DB_LOCK_PUT_OBJ=6, /* Release locker's locks on obj. */
DB_LOCK_PUT_READ=7, /* Release locker's read locks. */
DB_LOCK_TIMEOUT=8, /* Force a txn to timeout. */
DB_LOCK_TRADE=9, /* Trade locker ids on a lock. */
DB_LOCK_UPGRADE_WRITE=10 /* Upgrade writes for dirty reads. */
} db_lockop_t;
/*
* Status of a lock.
*/
typedef enum {
DB_LSTAT_ABORTED=1, /* Lock belongs to an aborted txn. */
DB_LSTAT_EXPIRED=2, /* Lock has expired. */
DB_LSTAT_FREE=3, /* Lock is unallocated. */
DB_LSTAT_HELD=4, /* Lock is currently held. */
DB_LSTAT_PENDING=5, /* Lock was waiting and has been
* promoted; waiting for the owner
* to run and upgrade it to held. */
DB_LSTAT_WAITING=6 /* Lock is on the wait queue. */
}db_status_t;
/* Lock statistics structure. */
struct __db_lock_stat {
uint32_t st_id; /* Last allocated locker ID. */
uint32_t st_cur_maxid; /* Current maximum unused ID. */
uint32_t st_maxlocks; /* Maximum number of locks in table. */
uint32_t st_maxlockers; /* Maximum num of lockers in table. */
uint32_t st_maxobjects; /* Maximum num of objects in table. */
int st_nmodes; /* Number of lock modes. */
uint32_t st_nlockers; /* Current number of lockers. */
#ifndef __TEST_DB_NO_STATISTICS
uint32_t st_nlocks; /* Current number of locks. */
uint32_t st_maxnlocks; /* Maximum number of locks so far. */
uint32_t st_maxnlockers; /* Maximum number of lockers so far. */
uint32_t st_nobjects; /* Current number of objects. */
uint32_t st_maxnobjects; /* Maximum number of objects so far. */
uint32_t st_nrequests; /* Number of lock gets. */
uint32_t st_nreleases; /* Number of lock puts. */
uint32_t st_nupgrade; /* Number of lock upgrades. */
uint32_t st_ndowngrade; /* Number of lock downgrades. */
uint32_t st_lock_wait; /* Lock conflicts w/ subsequent wait */
uint32_t st_lock_nowait; /* Lock conflicts w/o subsequent wait */
uint32_t st_ndeadlocks; /* Number of lock deadlocks. */
db_timeout_t st_locktimeout; /* Lock timeout. */
uint32_t st_nlocktimeouts; /* Number of lock timeouts. */
db_timeout_t st_txntimeout; /* Transaction timeout. */
uint32_t st_ntxntimeouts; /* Number of transaction timeouts. */
uint32_t st_objs_wait; /* Object lock granted after wait. */
uint32_t st_objs_nowait; /* Object lock granted without wait. */
uint32_t st_lockers_wait; /* Locker lock granted after wait. */
uint32_t st_lockers_nowait; /* Locker lock granted without wait. */
uint32_t st_locks_wait; /* Lock lock granted after wait. */
uint32_t st_locks_nowait; /* Lock lock granted without wait. */
uint32_t st_region_wait; /* Region lock granted after wait. */
uint32_t st_region_nowait; /* Region lock granted without wait. */
uint32_t st_hash_len; /* Max length of bucket. */
roff_t st_regsize; /* Region size. */
#endif
};
struct __db_lock_hstat {
uint32_t st_nrequests; /* Number of lock gets. */
uint32_t st_nreleases; /* Number of lock puts. */
uint32_t st_nupgrade; /* Number of lock upgrades. */
uint32_t st_ndowngrade; /* Number of lock downgrades. */
uint32_t st_lock_wait; /* Lock conflicts w/ subsequent wait */
uint32_t st_lock_nowait; /* Lock conflicts w/o subsequent wait */
uint32_t st_nlocktimeouts; /* Number of lock timeouts. */
uint32_t st_ntxntimeouts; /* Number of transaction timeouts. */
uint32_t st_hash_len; /* Max length of bucket. */
};
/*
* DB_LOCK_ILOCK --
* Internal DB access method lock.
*/
struct __db_ilock {
db_pgno_t pgno; /* Page being locked. */
uint8_t fileid[DB_FILE_ID_LEN];/* File id. */
#define DB_HANDLE_LOCK 1
#define DB_RECORD_LOCK 2
#define DB_PAGE_LOCK 3
uint32_t type; /* Type of lock. */
};
/*
* DB_LOCK --
* The structure is allocated by the caller and filled in during a
* lock_get request (or a lock_vec/DB_LOCK_GET).
*/
struct __db_lock_u {
roff_t off; /* Offset of the lock in the region */
uint32_t ndx; /* Index of the object referenced by
* this lock; used for locking. */
uint32_t gen; /* Generation number of this lock. */
db_lockmode_t mode; /* mode of this lock. */
};
/* Lock request structure. */
struct __db_lockreq {
db_lockop_t op; /* Operation. */
db_lockmode_t mode; /* Requested mode. */
db_timeout_t timeout; /* Time to expire lock. */
DBT *obj; /* Object being locked. */
DB_LOCK lock; /* Lock returned. */
};
/*******************************************************
* Logging.
*******************************************************/
#define DB_LOGVERSION 13 /* Current log version. */
#define DB_LOGOLDVER 8 /* Oldest log version supported. */
#define DB_LOGMAGIC 0x040988
/* Flag values for DB_ENV->log_archive(). */
#define DB_ARCH_ABS 0x001 /* Absolute pathnames. */
#define DB_ARCH_DATA 0x002 /* Data files. */
#define DB_ARCH_LOG 0x004 /* Log files. */
#define DB_ARCH_REMOVE 0x008 /* Remove log files. */
/* Flag values for DB_ENV->log_put(). */
#define DB_FLUSH 0x001 /* Flush data to disk (public). */
#define DB_LOG_CHKPNT 0x002 /* Flush supports a checkpoint */
#define DB_LOG_COMMIT 0x004 /* Flush supports a commit */
#define DB_LOG_NOCOPY 0x008 /* Don't copy data */
#define DB_LOG_NOT_DURABLE 0x010 /* Do not log; keep in memory */
#define DB_LOG_WRNOSYNC 0x020 /* Write, don't sync log_put */
/*
* A DB_LSN has two parts, a fileid which identifies a specific file, and an
* offset within that file. The fileid is an unsigned 4-byte quantity that
* uniquely identifies a file within the log directory -- currently a simple
* counter inside the log. The offset is also an unsigned 4-byte value. The
* log manager guarantees the offset is never more than 4 bytes by switching
* to a new log file before the maximum length imposed by an unsigned 4-byte
* offset is reached.
*/
struct __db_lsn {
uint32_t file; /* File ID. */
uint32_t offset; /* File offset. */
};
/*
* Application-specified log record types start at DB_user_BEGIN, and must not
* equal or exceed DB_debug_FLAG.
*
* DB_debug_FLAG is the high-bit of the uint32_t that specifies a log record
* type. If the flag is set, it's a log record that was logged for debugging
* purposes only, even if it reflects a database change -- the change was part
* of a non-durable transaction.
*/
#define DB_user_BEGIN 10000
#define DB_debug_FLAG 0x80000000
/*
* DB_LOGC --
* Log cursor.
*/
struct __db_log_cursor {
DB_ENV *dbenv; /* Enclosing dbenv. */
DB_FH *fhp; /* File handle. */
DB_LSN lsn; /* Cursor: LSN */
uint32_t len; /* Cursor: record length */
uint32_t prev; /* Cursor: previous record's offset */
DBT dbt; /* Return DBT. */
DB_LSN p_lsn; /* Persist LSN. */
uint32_t p_version; /* Persist version. */
uint8_t *bp; /* Allocated read buffer. */
uint32_t bp_size; /* Read buffer length in bytes. */
uint32_t bp_rlen; /* Read buffer valid data length. */
DB_LSN bp_lsn; /* Read buffer first byte LSN. */
uint32_t bp_maxrec; /* Max record length in the log file. */
/* DB_LOGC PUBLIC HANDLE LIST BEGIN */
int (*close) __P((DB_LOGC *, uint32_t));
int (*get) __P((DB_LOGC *, DB_LSN *, DBT *, uint32_t));
int (*version) __P((DB_LOGC *, uint32_t *, uint32_t));
/* DB_LOGC PUBLIC HANDLE LIST END */
#define DB_LOG_DISK 0x01 /* Log record came from disk. */
#define DB_LOG_LOCKED 0x02 /* Log region already locked */
#define DB_LOG_SILENT_ERR 0x04 /* Turn-off error messages. */
uint32_t flags;
};
/* Log statistics structure. */
struct __db_log_stat {
uint32_t st_magic; /* Log file magic number. */
uint32_t st_version; /* Log file version number. */
int st_mode; /* Log file permissions mode. */
uint32_t st_lg_bsize; /* Log buffer size. */
uint32_t st_lg_size; /* Log file size. */
uint32_t st_wc_bytes; /* Bytes to log since checkpoint. */
uint32_t st_wc_mbytes; /* Megabytes to log since checkpoint. */
#ifndef __TEST_DB_NO_STATISTICS
uint32_t st_record; /* Records entered into the log. */
uint32_t st_w_bytes; /* Bytes to log. */
uint32_t st_w_mbytes; /* Megabytes to log. */
uint32_t st_wcount; /* Total I/O writes to the log. */
uint32_t st_wcount_fill; /* Overflow writes to the log. */
uint32_t st_rcount; /* Total I/O reads from the log. */
uint32_t st_scount; /* Total syncs to the log. */
uint32_t st_region_wait; /* Region lock granted after wait. */
uint32_t st_region_nowait; /* Region lock granted without wait. */
uint32_t st_cur_file; /* Current log file number. */
uint32_t st_cur_offset; /* Current log file offset. */
uint32_t st_disk_file; /* Known on disk log file number. */
uint32_t st_disk_offset; /* Known on disk log file offset. */
uint32_t st_maxcommitperflush; /* Max number of commits in a flush. */
uint32_t st_mincommitperflush; /* Min number of commits in a flush. */
roff_t st_regsize; /* Region size. */
#endif
};
/*
* We need to record the first log record of a transaction. For user
* defined logging this macro returns the place to put that information,
* if it is need in rlsnp, otherwise it leaves it unchanged. We also
* need to track the last record of the transaction, this returns the
* place to put that info.
*/
#define DB_SET_TXN_LSNP(txn, blsnp, llsnp) \
((txn)->set_txn_lsnp(txn, blsnp, llsnp))
/*******************************************************
* Shared buffer cache (mpool).
*******************************************************/
/* Flag values for DB_MPOOLFILE->get. */
#define DB_MPOOL_CREATE 0x001 /* Create a page. */
#define DB_MPOOL_DIRTY 0x002 /* Get page for an update. */
#define DB_MPOOL_EDIT 0x004 /* Modify without copying. */
#define DB_MPOOL_FREE 0x008 /* Free page if present. */
#define DB_MPOOL_LAST 0x010 /* Return the last page. */
#define DB_MPOOL_NEW 0x020 /* Create a new page. */
/* Undocumented flag value for DB_MPOOLFILE->close. */
#define DB_MPOOL_DISCARD 0x001 /* Discard file. */
/* Flags values for DB_MPOOLFILE->set_flags. */
#define DB_MPOOL_NOFILE 0x001 /* Never open a backing file. */
#define DB_MPOOL_UNLINK 0x002 /* Unlink the file on last close. */
/* Priority values for DB_MPOOLFILE->{put,set_priority}. */
typedef enum {
DB_PRIORITY_UNCHANGED=0,
DB_PRIORITY_VERY_LOW=1,
DB_PRIORITY_LOW=2,
DB_PRIORITY_DEFAULT=3,
DB_PRIORITY_HIGH=4,
DB_PRIORITY_VERY_HIGH=5
} DB_CACHE_PRIORITY;
/* Per-process DB_MPOOLFILE information. */
struct __db_mpoolfile {
DB_FH *fhp; /* Underlying file handle. */
/*
* !!!
* The ref, pinref and q fields are protected by the region lock.
*/
uint32_t ref; /* Reference count. */
uint32_t pinref; /* Pinned block reference count. */
/*
* !!!
* Explicit representations of structures from queue.h.
* TAILQ_ENTRY(__db_mpoolfile) q;
*/
struct {
struct __db_mpoolfile *tqe_next;
struct __db_mpoolfile **tqe_prev;
} q; /* Linked list of DB_MPOOLFILE's. */
/*
* !!!
* The rest of the fields (with the exception of the MP_FLUSH flag)
* are not thread-protected, even when they may be modified at any
* time by the application. The reason is the DB_MPOOLFILE handle
* is single-threaded from the viewpoint of the application, and so
* the only fields needing to be thread-protected are those accessed
* by checkpoint or sync threads when using DB_MPOOLFILE structures
* to flush buffers from the cache.
*/
DB_ENV *dbenv; /* Overlying DB_ENV. */
MPOOLFILE *mfp; /* Underlying MPOOLFILE. */
uint32_t clear_len; /* Cleared length on created pages. */
uint8_t /* Unique file ID. */
fileid[DB_FILE_ID_LEN];
int ftype; /* File type. */
int32_t lsn_offset; /* LSN offset in page. */
uint32_t gbytes, bytes; /* Maximum file size. */
DBT *pgcookie; /* Byte-string passed to pgin/pgout. */
int32_t priority; /* Cache priority. */
void *addr; /* Address of mmap'd region. */
size_t len; /* Length of mmap'd region. */
uint32_t config_flags; /* Flags to DB_MPOOLFILE->set_flags. */
/* DB_MPOOLFILE PUBLIC HANDLE LIST BEGIN */
int (*close) __P((DB_MPOOLFILE *, uint32_t));
int (*get)
__P((DB_MPOOLFILE *, db_pgno_t *, DB_TXN *, uint32_t, void *));
int (*get_clear_len) __P((DB_MPOOLFILE *, uint32_t *));
int (*get_fileid) __P((DB_MPOOLFILE *, uint8_t *));
int (*get_flags) __P((DB_MPOOLFILE *, uint32_t *));
int (*get_ftype) __P((DB_MPOOLFILE *, int *));
int (*get_last_pgno) __P((DB_MPOOLFILE *, db_pgno_t *));
int (*get_lsn_offset) __P((DB_MPOOLFILE *, int32_t *));
int (*get_maxsize) __P((DB_MPOOLFILE *, uint32_t *, uint32_t *));
int (*get_pgcookie) __P((DB_MPOOLFILE *, DBT *));
int (*get_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY *));
int (*open) __P((DB_MPOOLFILE *, const char *, uint32_t, int, size_t));
int (*put) __P((DB_MPOOLFILE *, void *, DB_CACHE_PRIORITY, uint32_t));
int (*set_clear_len) __P((DB_MPOOLFILE *, uint32_t));
int (*set_fileid) __P((DB_MPOOLFILE *, uint8_t *));
int (*set_flags) __P((DB_MPOOLFILE *, uint32_t, int));
int (*set_ftype) __P((DB_MPOOLFILE *, int));
int (*set_lsn_offset) __P((DB_MPOOLFILE *, int32_t));
int (*set_maxsize) __P((DB_MPOOLFILE *, uint32_t, uint32_t));
int (*set_pgcookie) __P((DB_MPOOLFILE *, DBT *));
int (*set_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY));
int (*sync) __P((DB_MPOOLFILE *));
/* DB_MPOOLFILE PUBLIC HANDLE LIST END */
/*
* MP_FILEID_SET, MP_OPEN_CALLED and MP_READONLY do not need to be
* thread protected because they are initialized before the file is
* linked onto the per-process lists, and never modified.
*
* MP_FLUSH is thread protected because it is potentially read/set by
* multiple threads of control.
*/
#define MP_FILEID_SET 0x001 /* Application supplied a file ID. */
#define MP_FLUSH 0x002 /* Was opened to flush a buffer. */
#define MP_MULTIVERSION 0x004 /* Opened for multiversion access. */
#define MP_OPEN_CALLED 0x008 /* File opened. */
#define MP_READONLY 0x010 /* File is readonly. */
uint32_t flags;
};
/* Mpool statistics structure. */
struct __db_mpool_stat {
uint32_t st_gbytes; /* Total cache size: GB. */
uint32_t st_bytes; /* Total cache size: B. */
uint32_t st_ncache; /* Number of cache regions. */
uint32_t st_max_ncache; /* Maximum number of regions. */
size_t st_mmapsize; /* Maximum file size for mmap. */
int st_maxopenfd; /* Maximum number of open fd's. */
int st_maxwrite; /* Maximum buffers to write. */
db_timeout_t st_maxwrite_sleep; /* Sleep after writing max buffers. */
uint32_t st_pages; /* Total number of pages. */
#ifndef __TEST_DB_NO_STATISTICS
uint32_t st_map; /* Pages from mapped files. */
uint32_t st_cache_hit; /* Pages found in the cache. */
uint32_t st_cache_miss; /* Pages not found in the cache. */
uint32_t st_page_create; /* Pages created in the cache. */
uint32_t st_page_in; /* Pages read in. */
uint32_t st_page_out; /* Pages written out. */
uint32_t st_ro_evict; /* Clean pages forced from the cache. */
uint32_t st_rw_evict; /* Dirty pages forced from the cache. */
uint32_t st_page_trickle; /* Pages written by memp_trickle. */
uint32_t st_page_clean; /* Clean pages. */
uint32_t st_page_dirty; /* Dirty pages. */
uint32_t st_hash_buckets; /* Number of hash buckets. */
uint32_t st_hash_searches; /* Total hash chain searches. */
uint32_t st_hash_longest; /* Longest hash chain searched. */
uint32_t st_hash_examined; /* Total hash entries searched. */
uint32_t st_hash_nowait; /* Hash lock granted with nowait. */
uint32_t st_hash_wait; /* Hash lock granted after wait. */
uint32_t st_hash_max_nowait; /* Max hash lock granted with nowait. */
uint32_t st_hash_max_wait; /* Max hash lock granted after wait. */
uint32_t st_region_nowait; /* Region lock granted with nowait. */
uint32_t st_region_wait; /* Region lock granted after wait. */
uint32_t st_mvcc_frozen; /* Buffers frozen. */
uint32_t st_mvcc_thawed; /* Buffers thawed. */
uint32_t st_mvcc_freed; /* Frozen buffers freed. */
uint32_t st_alloc; /* Number of page allocations. */
uint32_t st_alloc_buckets; /* Buckets checked during allocation. */
uint32_t st_alloc_max_buckets; /* Max checked during allocation. */
uint32_t st_alloc_pages; /* Pages checked during allocation. */
uint32_t st_alloc_max_pages; /* Max checked during allocation. */
uint32_t st_io_wait; /* Thread waited on buffer I/O. */
roff_t st_regsize; /* Region size. */
#endif
};
/* Mpool file statistics structure. */
struct __db_mpool_fstat {
char *file_name; /* File name. */
uint32_t st_pagesize; /* Page size. */
#ifndef __TEST_DB_NO_STATISTICS
uint32_t st_map; /* Pages from mapped files. */
uint32_t st_cache_hit; /* Pages found in the cache. */
uint32_t st_cache_miss; /* Pages not found in the cache. */
uint32_t st_page_create; /* Pages created in the cache. */
uint32_t st_page_in; /* Pages read in. */
uint32_t st_page_out; /* Pages written out. */
#endif
};
/*******************************************************
* Transactions and recovery.
*******************************************************/
#define DB_TXNVERSION 1
typedef enum {
DB_TXN_ABORT=0, /* Public. */
DB_TXN_APPLY=1, /* Public. */
DB_TXN_BACKWARD_ALLOC=2, /* Internal. */
DB_TXN_BACKWARD_ROLL=3, /* Public. */
DB_TXN_FORWARD_ROLL=4, /* Public. */
DB_TXN_OPENFILES=5, /* Internal. */
DB_TXN_POPENFILES=6, /* Internal. */
DB_TXN_PRINT=7 /* Public. */
} db_recops;
/*
* BACKWARD_ALLOC is used during the forward pass to pick up any aborted
* allocations for files that were created during the forward pass.
* The main difference between _ALLOC and _ROLL is that the entry for
* the file not exist during the rollforward pass.
*/
#define DB_UNDO(op) ((op) == DB_TXN_ABORT || \
(op) == DB_TXN_BACKWARD_ROLL || (op) == DB_TXN_BACKWARD_ALLOC)
#define DB_REDO(op) ((op) == DB_TXN_FORWARD_ROLL || (op) == DB_TXN_APPLY)
struct __db_txn {
DB_TXNMGR *mgrp; /* Pointer to transaction manager. */
DB_TXN *parent; /* Pointer to transaction's parent. */
uint32_t txnid; /* Unique transaction id. */
char *name; /* Transaction name. */
DB_LOCKER *locker; /* Locker for this txn. */
db_threadid_t tid; /* Thread id for use in MT XA. */
void *td; /* Detail structure within region. */
db_timeout_t lock_timeout; /* Timeout for locks for this txn. */
db_timeout_t expire; /* Time transaction expires. */
void *txn_list; /* Undo information for parent. */
/*
* !!!
* Explicit representations of structures from queue.h.
* TAILQ_ENTRY(__db_txn) links;
* TAILQ_ENTRY(__db_txn) xalinks;
*/
struct {
struct __db_txn *tqe_next;
struct __db_txn **tqe_prev;
} links; /* Links transactions off manager. */
struct {
struct __db_txn *tqe_next;
struct __db_txn **tqe_prev;
} xalinks; /* Links active XA transactions. */
/*
* !!!
* Explicit representations of structures from queue.h.
* TAILQ_HEAD(__kids, __db_txn) kids;
*/
struct __kids {
struct __db_txn *tqh_first;