mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r9939] Purpose:
New feature Description: Expand v2 B-tree code to support splitting the root node when enough records are inserted and move metadata cache callbacks into their own source file. Platforms tested: FreeBSD 4.11 (sleipnir) w/parallel Too minor for h5committest
This commit is contained in:
parent
8ffba3474e
commit
24770bf218
1
MANIFEST
1
MANIFEST
@ -775,6 +775,7 @@
|
||||
./src/H5Bprivate.h
|
||||
./src/H5Bpublic.h
|
||||
./src/H5B2.c
|
||||
./src/H5B2cache.c
|
||||
./src/H5B2dbg.c
|
||||
./src/H5B2pkg.h
|
||||
./src/H5B2private.h
|
||||
|
@ -345,6 +345,7 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] =
|
||||
"global heaps",
|
||||
"object headers",
|
||||
"v2 B-tree headers",
|
||||
"v2 B-tree internal nodes",
|
||||
"v2 B-tree leaf nodes"
|
||||
};
|
||||
|
||||
|
@ -45,8 +45,9 @@
|
||||
#define H5AC_GHEAP_ID 3 /*global heap */
|
||||
#define H5AC_OHDR_ID 4 /*object header */
|
||||
#define H5AC_BT2_HDR_ID 5 /*v2 B-tree header */
|
||||
#define H5AC_BT2_LEAF_ID 6 /*v2 B-tree leaf */
|
||||
#define H5AC_NTYPES 7
|
||||
#define H5AC_BT2_INT_ID 6 /*v2 B-tree internal node */
|
||||
#define H5AC_BT2_LEAF_ID 7 /*v2 B-tree leaf node */
|
||||
#define H5AC_NTYPES 8
|
||||
|
||||
/* H5AC_DUMP_STATS_ON_CLOSE should always be FALSE when
|
||||
* H5C_COLLECT_CACHE_STATS is FALSE.
|
||||
|
1019
src/H5B2.c
1019
src/H5B2.c
File diff suppressed because it is too large
Load Diff
1003
src/H5B2cache.c
Normal file
1003
src/H5B2cache.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -31,9 +31,6 @@
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
|
||||
/* H5B2 inherits cache-like properties from H5AC */
|
||||
extern const H5AC_class_t H5AC_BT2_HDR[1];
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B2_hdr_debug
|
||||
|
@ -44,8 +44,27 @@
|
||||
|
||||
/* B-tree signatures */
|
||||
#define H5B2_HDR_MAGIC "BTHD" /* Header */
|
||||
#define H5B2_INT_MAGIC "BTND" /* Internal node */
|
||||
#define H5B2_LEAF_MAGIC "BTLF" /* Leaf node */
|
||||
|
||||
/* Size of storage for number of records per node (on disk) */
|
||||
#define H5B2_SIZEOF_RECORDS_PER_NODE 2
|
||||
|
||||
/* Size of a "node pointer" (on disk) */
|
||||
#define H5B2_NODE_POINTER_SIZE(f) (H5F_SIZEOF_ADDR(f)+H5B2_SIZEOF_RECORDS_PER_NODE+H5F_SIZEOF_SIZE(f))
|
||||
|
||||
/* Size of the B-tree header on disk */
|
||||
#define H5B2_HEADER_SIZE(f) ( \
|
||||
4 + /* Signature */ \
|
||||
1 + /* Version */ \
|
||||
1 + /* Tree type */ \
|
||||
4 + /* Node size, in bytes */ \
|
||||
2 + /* Key size, in bytes */ \
|
||||
2 + /* Depth of tree */ \
|
||||
2 + /* Split % of full (as integer, ie. "98" means 98%) */ \
|
||||
2 + /* Merge % of full (as integer, ie. "98" means 98%) */ \
|
||||
H5B2_NODE_POINTER_SIZE(f)) /* Node pointer to root node in tree */
|
||||
|
||||
/****************************/
|
||||
/* Package Private Typedefs */
|
||||
/****************************/
|
||||
@ -67,9 +86,7 @@ typedef struct H5B2_shared_t {
|
||||
H5FL_fac_head_t *int_fac; /* Factory for internal node native key blocks */
|
||||
H5FL_fac_head_t *leaf_fac; /* Factory for leaf node native key blocks */
|
||||
H5FL_fac_head_t *node_ptr_fac; /* Factory for internal node node pointer blocks */
|
||||
size_t *int_nat_off; /* Array of offsets of native keys in internal node block */
|
||||
size_t *leaf_nat_off; /* Array of offsets of native keys in leaf node block */
|
||||
size_t *node_ptr_off; /* Array of offsets of node pointers in internal node block */
|
||||
size_t *nat_off; /* Array of offsets of native keys */
|
||||
|
||||
/* Information set by user */
|
||||
unsigned split_percent; /* Percent full at which to split the node, when inserting */
|
||||
@ -97,7 +114,7 @@ typedef struct H5B2_t {
|
||||
H5RC_t *shared; /* Ref-counted shared info */
|
||||
} H5B2_t;
|
||||
|
||||
/* B-tree leaf information */
|
||||
/* B-tree leaf node information */
|
||||
typedef struct H5B2_leaf_t {
|
||||
/* Information for H5AC cache functions, _must_ be first field in structure */
|
||||
H5AC_info_t cache_info;
|
||||
@ -105,12 +122,54 @@ typedef struct H5B2_leaf_t {
|
||||
/* Internal B-tree information */
|
||||
H5RC_t *shared; /* Ref-counted shared info */
|
||||
uint8_t *leaf_native; /* Pointer to native keys */
|
||||
unsigned nrec; /* Number of records in leaf node */
|
||||
unsigned nrec; /* Number of records in node */
|
||||
} H5B2_leaf_t;
|
||||
|
||||
/* B-tree internal node information */
|
||||
typedef struct H5B2_internal_t {
|
||||
/* Information for H5AC cache functions, _must_ be first field in structure */
|
||||
H5AC_info_t cache_info;
|
||||
|
||||
/* Internal B-tree information */
|
||||
H5RC_t *shared; /* Ref-counted shared info */
|
||||
uint8_t *int_native; /* Pointer to native keys */
|
||||
H5B2_node_ptr_t *node_ptrs; /* Pointer to node pointers */
|
||||
unsigned nrec; /* Number of records in node */
|
||||
} H5B2_internal_t;
|
||||
|
||||
|
||||
/*****************************/
|
||||
/* Package Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/* H5B2 header inherits cache-like properties from H5AC */
|
||||
H5_DLLVAR const H5AC_class_t H5AC_BT2_HDR[1];
|
||||
|
||||
/* H5B2 internal node inherits cache-like properties from H5AC */
|
||||
H5_DLLVAR const H5AC_class_t H5AC_BT2_INT[1];
|
||||
|
||||
/* H5B2 leaf node inherits cache-like properties from H5AC */
|
||||
H5_DLLVAR const H5AC_class_t H5AC_BT2_LEAF[1];
|
||||
|
||||
/* Declare a free list to manage the H5B2_t struct */
|
||||
H5FL_EXTERN(H5B2_t);
|
||||
|
||||
/* Declare a free list to manage the H5B2_internal_t struct */
|
||||
H5FL_EXTERN(H5B2_internal_t);
|
||||
|
||||
/* Declare a free list to manage the H5B2_leaf_t struct */
|
||||
H5FL_EXTERN(H5B2_leaf_t);
|
||||
|
||||
|
||||
/******************************/
|
||||
/* Package Private Prototypes */
|
||||
/******************************/
|
||||
H5_DLL herr_t H5B2_shared_free (void *_shared);
|
||||
H5_DLL herr_t H5B2_shared_init (H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type,
|
||||
size_t node_size, size_t rkey_size, unsigned split_percent, unsigned merge_percent);
|
||||
H5_DLL herr_t H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *b);
|
||||
H5_DLL herr_t H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *l);
|
||||
H5_DLL herr_t H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *i);
|
||||
H5_DLL herr_t H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
|
||||
FILE *stream, int indent, int fwidth, const H5B2_class_t *type);
|
||||
|
||||
|
@ -72,8 +72,11 @@ typedef struct H5B2_class_t {
|
||||
/* Compare records, according to a key */
|
||||
herr_t (*compare)(const H5F_t *f, hid_t dxpl_id, const void *rec1, const void *rec2); /* Compare two native records */
|
||||
|
||||
/* Encode, decode, debug record values */
|
||||
herr_t (*encode)(const H5F_t *f, uint8_t *raw, const void *record); /* Store record in native key table */
|
||||
/* Encode & decode record values */
|
||||
herr_t (*encode)(const H5F_t *f, uint8_t *raw, const void *record); /* Encode record from native form to disk storage form */
|
||||
herr_t (*decode)(const H5F_t *f, const uint8_t *raw, void *record); /* Decode record from disk storage form to native form */
|
||||
|
||||
/* Debug record values */
|
||||
|
||||
} H5B2_class_t;
|
||||
|
||||
|
@ -73,10 +73,10 @@ typedef struct H5FL_reg_head_t {
|
||||
#define H5FL_DEFINE_COMMON(t) H5FL_reg_head_t H5FL_REG_NAME(t)={0,0,0,0,#t,sizeof(t),NULL}
|
||||
|
||||
/* Declare a free list to manage objects of type 't' */
|
||||
#define H5FL_DEFINE(t) H5_DLL H5FL_DEFINE_COMMON(t)
|
||||
#define H5FL_DEFINE(t) H5FL_DEFINE_COMMON(t)
|
||||
|
||||
/* Reference a free list for type 't' defined in another file */
|
||||
#define H5FL_EXTERN(t) extern H5_DLL H5FL_reg_head_t H5FL_REG_NAME(t)
|
||||
#define H5FL_EXTERN(t) H5_DLLVAR H5FL_reg_head_t H5FL_REG_NAME(t)
|
||||
|
||||
/* Declare a static free list to manage objects of type 't' */
|
||||
#define H5FL_DEFINE_STATIC(t) static H5FL_DEFINE_COMMON(t)
|
||||
@ -99,8 +99,8 @@ typedef struct H5FL_reg_head_t {
|
||||
/* Common macro for H5FL_DEFINE & H5FL_DEFINE_STATIC */
|
||||
#define H5FL_DEFINE_COMMON(t) int H5FL_REG_NAME(t)
|
||||
|
||||
#define H5FL_DEFINE(t) H5_DLL H5FL_DEFINE_COMMON(t)
|
||||
#define H5FL_EXTERN(t) extern H5_DLL int H5FL_REG_NAME(t)
|
||||
#define H5FL_DEFINE(t) H5FL_DEFINE_COMMON(t)
|
||||
#define H5FL_EXTERN(t) H5_DLLVAR int H5FL_REG_NAME(t)
|
||||
#define H5FL_DEFINE_STATIC(t) static H5FL_DEFINE_COMMON(t)
|
||||
#define H5FL_MALLOC(t) H5MM_malloc(sizeof(t))
|
||||
#define H5FL_CALLOC(t) H5MM_calloc(sizeof(t))
|
||||
@ -142,10 +142,10 @@ typedef struct H5FL_blk_head_t {
|
||||
#define H5FL_BLK_DEFINE_COMMON(t) H5FL_blk_head_t H5FL_BLK_NAME(t)={0,0,0,0,#t"_blk",NULL}
|
||||
|
||||
/* Declare a free list to manage objects of type 't' */
|
||||
#define H5FL_BLK_DEFINE(t) H5_DLL H5FL_BLK_DEFINE_COMMON(t)
|
||||
#define H5FL_BLK_DEFINE(t) H5FL_BLK_DEFINE_COMMON(t)
|
||||
|
||||
/* Reference a free list for type 't' defined in another file */
|
||||
#define H5FL_BLK_EXTERN(t) extern H5_DLL H5FL_blk_head_t H5FL_BLK_NAME(t)
|
||||
#define H5FL_BLK_EXTERN(t) H5_DLLVAR H5FL_blk_head_t H5FL_BLK_NAME(t)
|
||||
|
||||
/* Declare a static free list to manage objects of type 't' */
|
||||
#define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t)
|
||||
@ -169,8 +169,8 @@ typedef struct H5FL_blk_head_t {
|
||||
/* Common macro for H5FL_BLK_DEFINE & H5FL_BLK_DEFINE_STATIC */
|
||||
#define H5FL_BLK_DEFINE_COMMON(t) int H5FL_BLK_NAME(t)
|
||||
|
||||
#define H5FL_BLK_DEFINE(t) H5_DLL H5FL_BLK_DEFINE_COMMON(t)
|
||||
#define H5FL_BLK_EXTERN(t) extern H5_DLL int H5FL_BLK_NAME(t)
|
||||
#define H5FL_BLK_DEFINE(t) H5FL_BLK_DEFINE_COMMON(t)
|
||||
#define H5FL_BLK_EXTERN(t) H5_DLLVAR int H5FL_BLK_NAME(t)
|
||||
#define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t)
|
||||
#define H5FL_BLK_MALLOC(t,size) H5MM_malloc(size)
|
||||
#define H5FL_BLK_CALLOC(t,size) H5MM_calloc(size)
|
||||
@ -214,10 +214,10 @@ typedef struct H5FL_arr_head_t {
|
||||
#define H5FL_ARR_DEFINE_COMMON(t,m) H5FL_arr_head_t H5FL_ARR_NAME(t)={0,0,0,#t"_arr",m+1,sizeof(t),NULL}
|
||||
|
||||
/* Declare a free list to manage arrays of type 't' */
|
||||
#define H5FL_ARR_DEFINE(t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(t,m)
|
||||
#define H5FL_ARR_DEFINE(t,m) H5FL_ARR_DEFINE_COMMON(t,m)
|
||||
|
||||
/* Reference a free list for arrays of type 't' defined in another file */
|
||||
#define H5FL_ARR_EXTERN(t) extern H5_DLL H5FL_arr_head_t H5FL_ARR_NAME(t)
|
||||
#define H5FL_ARR_EXTERN(t) H5_DLLVAR H5FL_arr_head_t H5FL_ARR_NAME(t)
|
||||
|
||||
/* Declare a static free list to manage arrays of type 't' */
|
||||
#define H5FL_ARR_DEFINE_STATIC(t,m) static H5FL_ARR_DEFINE_COMMON(t,m)
|
||||
@ -238,8 +238,8 @@ typedef struct H5FL_arr_head_t {
|
||||
/* Common macro for H5FL_ARR_DEFINE & H5FL_ARR_DEFINE_STATIC */
|
||||
#define H5FL_ARR_DEFINE_COMMON(t,m) int H5FL_ARR_NAME(t)
|
||||
|
||||
#define H5FL_ARR_DEFINE(t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(t,m)
|
||||
#define H5FL_ARR_EXTERN(t) extern H5_DLL int H5FL_ARR_NAME(t)
|
||||
#define H5FL_ARR_DEFINE(t,m) H5FL_ARR_DEFINE_COMMON(t,m)
|
||||
#define H5FL_ARR_EXTERN(t) H5_DLLVAR int H5FL_ARR_NAME(t)
|
||||
#define H5FL_ARR_DEFINE_STATIC(t,m) static H5FL_ARR_DEFINE_COMMON(t,m)
|
||||
#define H5FL_ARR_MALLOC(t,elem) H5MM_malloc((elem)*sizeof(t))
|
||||
#define H5FL_ARR_CALLOC(t,elem) H5MM_calloc((elem)*sizeof(t))
|
||||
@ -265,10 +265,10 @@ typedef struct H5FL_seq_head_t {
|
||||
#define H5FL_SEQ_DEFINE_COMMON(t) H5FL_seq_head_t H5FL_SEQ_NAME(t)={{0,0,0,0,#t"_seq",NULL},sizeof(t)}
|
||||
|
||||
/* Declare a free list to manage sequences of type 't' */
|
||||
#define H5FL_SEQ_DEFINE(t) H5_DLL H5FL_SEQ_DEFINE_COMMON(t)
|
||||
#define H5FL_SEQ_DEFINE(t) H5FL_SEQ_DEFINE_COMMON(t)
|
||||
|
||||
/* Reference a free list for sequences of type 't' defined in another file */
|
||||
#define H5FL_SEQ_EXTERN(t) extern H5_DLL H5FL_seq_head_t H5FL_SEQ_NAME(t)
|
||||
#define H5FL_SEQ_EXTERN(t) H5_DLLVAR H5FL_seq_head_t H5FL_SEQ_NAME(t)
|
||||
|
||||
/* Declare a static free list to manage sequences of type 't' */
|
||||
#define H5FL_SEQ_DEFINE_STATIC(t) static H5FL_SEQ_DEFINE_COMMON(t)
|
||||
@ -289,8 +289,8 @@ typedef struct H5FL_seq_head_t {
|
||||
/* Common macro for H5FL_BLK_DEFINE & H5FL_BLK_DEFINE_STATIC */
|
||||
#define H5FL_SEQ_DEFINE_COMMON(t) int H5FL_SEQ_NAME(t)
|
||||
|
||||
#define H5FL_SEQ_DEFINE(t) H5_DLL H5FL_SEQ_DEFINE_COMMON(t)
|
||||
#define H5FL_SEQ_EXTERN(t) extern H5_DLL int H5FL_SEQ_NAME(t)
|
||||
#define H5FL_SEQ_DEFINE(t) H5FL_SEQ_DEFINE_COMMON(t)
|
||||
#define H5FL_SEQ_EXTERN(t) H5_DLLVAR int H5FL_SEQ_NAME(t)
|
||||
#define H5FL_SEQ_DEFINE_STATIC(t) static H5FL_SEQ_DEFINE_COMMON(t)
|
||||
#define H5FL_SEQ_MALLOC(t,elem) H5MM_malloc((elem)*sizeof(t))
|
||||
#define H5FL_SEQ_CALLOC(t,elem) H5MM_calloc((elem)*sizeof(t))
|
||||
|
@ -39,12 +39,13 @@ MOSTLYCLEANFILES=H5detect.o H5detect.lo H5detect H5Tinit.o H5Tinit.lo H5Tinit.c
|
||||
DISTCLEAN=libhdf5.settings
|
||||
|
||||
# library sources
|
||||
libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2dbg.c H5C.c H5D.c \
|
||||
libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c H5C.c \
|
||||
H5D.c \
|
||||
H5Dcontig.c \
|
||||
H5Dcompact.c \
|
||||
H5Defl.c H5Dio.c H5Distore.c H5Dmpio.c H5Dselect.c H5Dtest.c H5E.c H5F.c \
|
||||
H5Fdbg.c H5FD.c H5FDcore.c \
|
||||
H5FDfamily.c H5FDfphdf5.c H5FDgass.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
|
||||
H5FDfamily.c H5FDfphdf5.c H5FDgass.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
|
||||
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDsrb.c H5FDstdio.c \
|
||||
H5FDstream.c H5FL.c H5FO.c H5FP.c H5FPclient.c H5FPserver.c H5FS.c \
|
||||
H5G.c H5Gent.c H5Gnode.c H5Gstab.c \
|
||||
@ -54,7 +55,7 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2dbg.c H5C.c H5D.c \
|
||||
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
|
||||
H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Ptest.c H5R.c H5RC.c \
|
||||
H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \
|
||||
H5Sselect.c H5Stest.c H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
|
||||
H5Sselect.c H5Stest.c H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
|
||||
H5Tcompound.c H5Tconv.c H5Tcset.c H5Tenum.c H5Tfields.c H5Tfixed.c \
|
||||
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Topaque.c H5Torder.c \
|
||||
H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TS.c H5V.c H5Z.c \
|
||||
|
@ -219,12 +219,13 @@ MOSTLYCLEANFILES = H5detect.o H5detect.lo H5detect H5Tinit.o H5Tinit.lo H5Tinit.
|
||||
DISTCLEAN = libhdf5.settings
|
||||
|
||||
# library sources
|
||||
libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2dbg.c H5C.c H5D.c \
|
||||
libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c H5C.c \
|
||||
H5D.c \
|
||||
H5Dcontig.c \
|
||||
H5Dcompact.c \
|
||||
H5Defl.c H5Dio.c H5Distore.c H5Dmpio.c H5Dselect.c H5Dtest.c H5E.c H5F.c \
|
||||
H5Fdbg.c H5FD.c H5FDcore.c \
|
||||
H5FDfamily.c H5FDfphdf5.c H5FDgass.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
|
||||
H5FDfamily.c H5FDfphdf5.c H5FDgass.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
|
||||
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDsrb.c H5FDstdio.c \
|
||||
H5FDstream.c H5FL.c H5FO.c H5FP.c H5FPclient.c H5FPserver.c H5FS.c \
|
||||
H5G.c H5Gent.c H5Gnode.c H5Gstab.c \
|
||||
@ -234,7 +235,7 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2dbg.c H5C.c H5D.c \
|
||||
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
|
||||
H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Ptest.c H5R.c H5RC.c \
|
||||
H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \
|
||||
H5Sselect.c H5Stest.c H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
|
||||
H5Sselect.c H5Stest.c H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
|
||||
H5Tcompound.c H5Tconv.c H5Tcset.c H5Tenum.c H5Tfields.c H5Tfixed.c \
|
||||
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Topaque.c H5Torder.c \
|
||||
H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TS.c H5V.c H5Z.c \
|
||||
@ -288,27 +289,27 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
libhdf5_la_LDFLAGS =
|
||||
libhdf5_la_LIBADD =
|
||||
am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo H5B2dbg.lo \
|
||||
H5C.lo H5D.lo H5Dcontig.lo H5Dcompact.lo H5Defl.lo H5Dio.lo \
|
||||
H5Distore.lo H5Dmpio.lo H5Dselect.lo H5Dtest.lo H5E.lo H5F.lo \
|
||||
H5Fdbg.lo H5FD.lo H5FDcore.lo H5FDfamily.lo H5FDfphdf5.lo \
|
||||
H5FDgass.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo \
|
||||
H5FDmulti.lo H5FDsec2.lo H5FDsrb.lo H5FDstdio.lo H5FDstream.lo \
|
||||
H5FL.lo H5FO.lo H5FP.lo H5FPclient.lo H5FPserver.lo H5FS.lo \
|
||||
H5G.lo H5Gent.lo H5Gnode.lo H5Gstab.lo H5HG.lo H5HGdbg.lo \
|
||||
H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo H5MF.lo H5MM.lo H5O.lo \
|
||||
H5Oattr.lo H5Obogus.lo H5Ocont.lo H5Odtype.lo H5Oefl.lo \
|
||||
H5Ofill.lo H5Olayout.lo H5Omtime.lo H5Oname.lo H5Onull.lo \
|
||||
H5Opline.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo H5P.lo \
|
||||
H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Ptest.lo H5R.lo \
|
||||
H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo H5Smpio.lo \
|
||||
H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5ST.lo \
|
||||
H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo \
|
||||
H5Tconv.lo H5Tcset.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo \
|
||||
H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Topaque.lo \
|
||||
H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvlen.lo \
|
||||
H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo \
|
||||
H5Zshuffle.lo H5Zszip.lo H5Ztrans.lo
|
||||
am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo H5B2cache.lo \
|
||||
H5B2dbg.lo H5C.lo H5D.lo H5Dcontig.lo H5Dcompact.lo H5Defl.lo \
|
||||
H5Dio.lo H5Distore.lo H5Dmpio.lo H5Dselect.lo H5Dtest.lo H5E.lo \
|
||||
H5F.lo H5Fdbg.lo H5FD.lo H5FDcore.lo H5FDfamily.lo \
|
||||
H5FDfphdf5.lo H5FDgass.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo \
|
||||
H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo H5FDsrb.lo \
|
||||
H5FDstdio.lo H5FDstream.lo H5FL.lo H5FO.lo H5FP.lo \
|
||||
H5FPclient.lo H5FPserver.lo H5FS.lo H5G.lo H5Gent.lo H5Gnode.lo \
|
||||
H5Gstab.lo H5HG.lo H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo \
|
||||
H5MF.lo H5MM.lo H5O.lo H5Oattr.lo H5Obogus.lo H5Ocont.lo \
|
||||
H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Olayout.lo H5Omtime.lo \
|
||||
H5Oname.lo H5Onull.lo H5Opline.lo H5Osdspace.lo H5Oshared.lo \
|
||||
H5Ostab.lo H5P.lo H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo \
|
||||
H5Ptest.lo H5R.lo H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo \
|
||||
H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo \
|
||||
H5SL.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo \
|
||||
H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tenum.lo H5Tfields.lo \
|
||||
H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo \
|
||||
H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo \
|
||||
H5Tvlen.lo H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \
|
||||
H5Znbit.lo H5Zshuffle.lo H5Zszip.lo H5Ztrans.lo
|
||||
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
|
||||
noinst_PROGRAMS = H5detect$(EXEEXT)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
@ -327,9 +328,9 @@ depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/H5.Plo ./$(DEPDIR)/H5A.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5AC.Plo ./$(DEPDIR)/H5B.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5B2.Plo ./$(DEPDIR)/H5B2dbg.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5C.Plo ./$(DEPDIR)/H5D.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5Dcompact.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5B2.Plo ./$(DEPDIR)/H5B2cache.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5B2dbg.Plo ./$(DEPDIR)/H5C.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5D.Plo ./$(DEPDIR)/H5Dcompact.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5Dcontig.Plo ./$(DEPDIR)/H5Defl.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5Dio.Plo ./$(DEPDIR)/H5Distore.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/H5Dmpio.Plo ./$(DEPDIR)/H5Dselect.Plo \
|
||||
@ -484,6 +485,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5AC.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2cache.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2dbg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5C.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5D.Plo@am__quote@
|
||||
|
155
test/btree2.c
155
test/btree2.c
@ -31,6 +31,8 @@ const char *FILENAME[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
#define INSERT_SPLIT_ROOT_NREC 80
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: store
|
||||
@ -115,7 +117,44 @@ HDfprintf(stderr,"encode: data=%Hu\n",*(const hsize_t *)nrecord);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_basic
|
||||
* Function: decode
|
||||
*
|
||||
* Purpose: Decode raw disk form of record into native form
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, February 4, 2005
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
decode(const H5F_t *f, const uint8_t *raw, void *nrecord)
|
||||
{
|
||||
H5F_DECODE_LENGTH(f, raw, *(hsize_t *)nrecord);
|
||||
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr,"encode: data=%Hu\n",*(const hsize_t *)nrecord);
|
||||
#endif /* QAK */
|
||||
return(SUCCEED);
|
||||
}
|
||||
|
||||
H5B2_class_t type={ /* B-tree class information */
|
||||
0, /* Type of B-tree */
|
||||
sizeof(hsize_t), /* Size of native key */
|
||||
store, /* Record storage callback */
|
||||
compare, /* Record comparison callback */
|
||||
encode, /* Record encoding callback */
|
||||
decode /* Record decoding callback */
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_insert_basic
|
||||
*
|
||||
* Purpose: Basic tests for the B-tree v2 code
|
||||
*
|
||||
@ -131,18 +170,11 @@ HDfprintf(stderr,"encode: data=%Hu\n",*(const hsize_t *)nrecord);
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_basic_insert(hid_t fapl)
|
||||
test_insert_basic(hid_t fapl)
|
||||
{
|
||||
hid_t file=-1;
|
||||
char filename[1024];
|
||||
H5F_t *f=NULL;
|
||||
H5B2_class_t type={ /* B-tree class information */
|
||||
0, /* Type of B-tree */
|
||||
sizeof(hsize_t), /* Size of native key */
|
||||
store, /* Record storage callback */
|
||||
compare, /* Record comparison callback */
|
||||
encode /* Record encoding callback */
|
||||
};
|
||||
hsize_t record; /* Record to insert into tree */
|
||||
haddr_t bt2_addr; /* Address of B-tree created */
|
||||
|
||||
@ -164,7 +196,7 @@ test_basic_insert(hid_t fapl)
|
||||
if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &type, 512, 8, 100, 40, &bt2_addr/*out*/)<0) {
|
||||
H5_FAILED();
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
TEST_ERROR;
|
||||
goto error;
|
||||
}
|
||||
PASSED();
|
||||
|
||||
@ -176,7 +208,7 @@ test_basic_insert(hid_t fapl)
|
||||
if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
|
||||
H5_FAILED();
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
TEST_ERROR;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -186,7 +218,7 @@ test_basic_insert(hid_t fapl)
|
||||
if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
|
||||
H5_FAILED();
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
TEST_ERROR;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -196,7 +228,7 @@ test_basic_insert(hid_t fapl)
|
||||
if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
|
||||
H5_FAILED();
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
TEST_ERROR;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -206,7 +238,7 @@ test_basic_insert(hid_t fapl)
|
||||
if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
|
||||
H5_FAILED();
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
TEST_ERROR;
|
||||
goto error;
|
||||
}
|
||||
PASSED();
|
||||
|
||||
@ -219,7 +251,96 @@ error:
|
||||
H5Fclose(file);
|
||||
} H5E_END_TRY;
|
||||
return 1;
|
||||
}
|
||||
} /* test_insert_basic() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_insert_split_root
|
||||
*
|
||||
* Purpose: Basic tests for the B-tree v2 code. This test inserts enough
|
||||
* records to split the root node and force the tree to depth 1.
|
||||
* It also continues to add a few more records to each of the
|
||||
* left and right leaf nodes after the split
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: 1
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Thursday, February 3, 2005
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_insert_split_root(hid_t fapl)
|
||||
{
|
||||
hid_t file=-1;
|
||||
char filename[1024];
|
||||
H5F_t *f=NULL;
|
||||
hsize_t record; /* Record to insert into tree */
|
||||
haddr_t bt2_addr; /* Address of B-tree created */
|
||||
unsigned u; /* Local index variable */
|
||||
|
||||
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
|
||||
|
||||
/* Create the file to work on */
|
||||
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
|
||||
|
||||
/* Get a pointer to the internal file object */
|
||||
if (NULL==(f=H5I_object(file))) {
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test v2 B-tree creation
|
||||
*/
|
||||
if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &type, 512, 8, 100, 40, &bt2_addr/*out*/)<0) {
|
||||
H5_FAILED();
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test inserting many records into v2 B-tree
|
||||
*/
|
||||
TESTING("B-tree many - split root");
|
||||
|
||||
for(u=0; u<INSERT_SPLIT_ROOT_NREC; u++) {
|
||||
record=u+10;
|
||||
if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
|
||||
H5_FAILED();
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
record=0;
|
||||
if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
|
||||
H5_FAILED();
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
goto error;
|
||||
}
|
||||
record=1;
|
||||
if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
|
||||
H5_FAILED();
|
||||
H5Eprint_stack(H5E_DEFAULT, stdout);
|
||||
goto error;
|
||||
}
|
||||
|
||||
PASSED();
|
||||
|
||||
if (H5Fclose(file)<0) TEST_ERROR;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Fclose(file);
|
||||
} H5E_END_TRY;
|
||||
return 1;
|
||||
} /* test_insert_split_root() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -249,8 +370,8 @@ main(void)
|
||||
fapl = h5_fileaccess();
|
||||
|
||||
/* Test basic B-tree insertion */
|
||||
nerrors += test_basic_insert(fapl);
|
||||
/* nerrors += test_many_insert(fapl); */
|
||||
nerrors += test_insert_basic(fapl);
|
||||
nerrors += test_insert_split_root(fapl);
|
||||
|
||||
if (nerrors) goto error;
|
||||
puts("All v2 B-tree tests passed.");
|
||||
|
Loading…
Reference in New Issue
Block a user