Ticket #536: block_capacity.diff

File block_capacity.diff, 4.7 KB (added by Dan, 13 years ago)
  • xapian-core/backends/brass/brass_table.cc

    diff --git a/xapian-core/backends/brass/brass_table.cc b/xapian-core/backends/brass/brass_table.cc
    index 235bd31..5c4c1f6 100644
    a b static inline byte *zeroed_new(size_t size)  
    186186 *  sequential additions (in negated form). */
    187187#define SEQ_START_POINT (-10)
    188188
    189 /** Even for items of at maximum size, it must be possible to get this number of
    190  *  items in a block */
    191 #define BLOCK_CAPACITY 4
    192 
    193 
    194189/* There are two bit maps in bit_map0 and bit_map. The nth bit of bitmap is 0
    195190   if the nth block is free, otherwise 1. bit_map0 is the initial state of
    196191   bitmap at the start of the current transaction.
  • xapian-core/backends/brass/brass_table.h

    diff --git a/xapian-core/backends/brass/brass_table.h b/xapian-core/backends/brass/brass_table.h
    index 6f09381..58cae52 100644
    a b  
    4343
    4444#define DONT_COMPRESS -1
    4545
     46/** Even for items of at maximum size, it must be possible to get this number of
     47 *  items in a block */
     48#define BLOCK_CAPACITY 4
     49
    4650/** The largest possible value of a key_len.
    4751 *
    4852 *  This gives the upper limit of the size of a key that may be stored in the
    class XAPIAN_VISIBILITY_DEFAULT BrassTable {  
    598602         *  The default is BLOCK_CAPACITY (which is currently 4).
    599603         */
    600604        void set_max_item_size(size_t block_capacity) {
    601             if (block_capacity > 4) block_capacity = 4;
     605            if (block_capacity > BLOCK_CAPACITY) block_capacity = BLOCK_CAPACITY;
    602606            max_item_size = (block_size - DIR_START - block_capacity * D2)
    603607                / block_capacity;
    604608        }
  • xapian-core/backends/chert/chert_table.cc

    diff --git a/xapian-core/backends/chert/chert_table.cc b/xapian-core/backends/chert/chert_table.cc
    index 32406d3..fb7e728 100644
    a b static inline byte *zeroed_new(size_t size)  
    186186 *  sequential additions (in negated form). */
    187187#define SEQ_START_POINT (-10)
    188188
    189 /** Even for items of at maximum size, it must be possible to get this number of
    190  *  items in a block */
    191 #define BLOCK_CAPACITY 4
    192 
    193189
    194190/* There are two bit maps in bit_map0 and bit_map. The nth bit of bitmap is 0
    195191   if the nth block is free, otherwise 1. bit_map0 is the initial state of
  • xapian-core/backends/chert/chert_table.h

    diff --git a/xapian-core/backends/chert/chert_table.h b/xapian-core/backends/chert/chert_table.h
    index 2f7caf0..cfead79 100644
    a b  
    5050 */
    5151#define CHERT_BTREE_MAX_KEY_LEN 252
    5252
     53/** Even for items of at maximum size, it must be possible to get this number of
     54 *  items in a block */
     55#define BLOCK_CAPACITY 4
     56
    5357// FIXME: This named constant probably isn't used everywhere it should be...
    5458#define BYTES_PER_BLOCK_NUMBER 4
    5559
    class XAPIAN_VISIBILITY_DEFAULT ChertTable {  
    594598         *  The default is BLOCK_CAPACITY (which is currently 4).
    595599         */
    596600        void set_max_item_size(size_t block_capacity) {
    597             if (block_capacity > 4) block_capacity = 4;
     601            if (block_capacity > BLOCK_CAPACITY) block_capacity = BLOCK_CAPACITY;
    598602            max_item_size = (block_size - DIR_START - block_capacity * D2)
    599603                / block_capacity;
    600604        }
  • xapian-core/backends/flint/flint_table.cc

    diff --git a/xapian-core/backends/flint/flint_table.cc b/xapian-core/backends/flint/flint_table.cc
    index 1628d03..715c3fd 100644
    a b static inline byte *zeroed_new(size_t size)  
    199199 *  sequential additions (in negated form). */
    200200#define SEQ_START_POINT (-10)
    201201
    202 /** Even for items of at maximum size, it must be possible to get this number of
    203  *  items in a block */
    204 #define BLOCK_CAPACITY 4
    205 
    206202
    207203
    208204/* There are two bit maps in bit_map0 and bit_map. The nth bit of bitmap is 0
  • xapian-core/backends/flint/flint_table.h

    diff --git a/xapian-core/backends/flint/flint_table.h b/xapian-core/backends/flint/flint_table.h
    index d37b046..3050107 100644
    a b  
    4949 */
    5050#define FLINT_BTREE_MAX_KEY_LEN 252
    5151
     52/** Even for items of at maximum size, it must be possible to get this number of
     53 *  items in a block */
     54#define BLOCK_CAPACITY 4
     55
    5256// FIXME: This named constant probably isn't used everywhere it should be...
    5357#define BYTES_PER_BLOCK_NUMBER 4
    5458
    class XAPIAN_VISIBILITY_DEFAULT FlintTable {  
    562566         *  The default is BLOCK_CAPACITY (which is currently 4).
    563567         */
    564568        void set_max_item_size(size_t block_capacity) {
    565             if (block_capacity > 4) block_capacity = 4;
     569            if (block_capacity > BLOCK_CAPACITY) block_capacity = BLOCK_CAPACITY;
    566570            max_item_size = (block_size - 11 /*DIR_START*/ - block_capacity * D2)
    567571                / block_capacity;
    568572        }