2014-10-17 14:55 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/hbrddcdx.h
  * src/rdd/dbfcdx/dbfcdx1.c
    + added support for large index files over 4GB length.
      These are slightly modified CDX indexes which stores index page numbers
      instead of index page offsets inside index file. This trick increase
      maximum index files size from 2^32 (4GB) to 2^41 (2TB). This index
      format is enabled automatically when DB_DBFLOCK_HB64 is used. This is
      the same behavior as in DBFNTX and DBFNSX for which I added support
      for large indexes (up to 4TB) few years ago.
      Warning: new CDX indexes are not backward compatible and cannot be
               read by other systems or older [x]Harbour versions.
               If you try to open new indexes using older [x]Harbour RDDs
               then RTE "DBFCDX/1012 Corruption detected" is generated.
               When current Harbour *DBFCDX/SIXCDX RDD open index file
               then it automatically recognize type of index file so it
               will work correctly with both versions without any problem.
               In short words: People using DB_DBFLOCK_HB64 should remember
               that after reindexing with new Harbour applications old ones
               cannot read new CDX indexes.
    ; In next step I plan to add support for user defined page size in CDX
      index files.

  * doc/xhb-diff.txt
    * added information about extended CDX format to section "NATIVE RDDs"

  * src/rdd/dbfcdx/dbfcdx1.c
  * src/rdd/dbfnsx/dbfnsx1.c
  * src/rdd/dbfntx/dbfntx1.c
    * disable record readahead buffer used during indexing when only
      one record can be stored inside
    ! generate RTE when data cannot be read into record readahead buffer
      during indexing
This commit is contained in:
Przemysław Czerpak
2014-10-17 14:55:16 +02:00
parent bbc4258011
commit dfc2f42e79
6 changed files with 196 additions and 92 deletions

View File

@@ -58,7 +58,8 @@ HB_EXTERN_BEGIN
#define CDX_MAXKEY 240
#define CDX_MAXEXP 255
#define CDX_MAXTAGNAMELEN 10
#define CDX_PAGELEN 512
#define CDX_PAGELEN_BITS 9
#define CDX_PAGELEN (1<<CDX_PAGELEN_BITS)
#define CDX_HEADERLEN 1024
#define CDX_HEADEREXPLEN (CDX_HEADERLEN - 512)
#define CDX_HEADERPAGES ((CDX_HEADERLEN+CDX_PAGELEN-1)/CDX_PAGELEN)
@@ -66,6 +67,9 @@ HB_EXTERN_BEGIN
#define CDX_EXT_FREESPACE (CDX_PAGELEN-24) /* 488 */
#define CDX_DUMMYNODE 0xFFFFFFFFL
#define CDX_HARBOUR_SIGNATURE 0x52434842L /* Harbour index signature: RCHB */
/* #define CDX_LOCKOFFSET 0x7FFFFFFEL */
/* #define CDX_LOCKSIZE 1L */
#define CDX_STACKSIZE 64
@@ -223,8 +227,6 @@ typedef struct _CDXINTNODE
HB_BYTE keyPool [ CDX_INT_FREESPACE ];
} CDXINTNODE;
typedef CDXINTNODE * LPCDXINTNODE;
typedef CDXINTNODE CDXNODE;
typedef CDXNODE * LPCDXNODE;
/* Compact Index Exterior Node Record */
typedef struct _CDXEXTNODE
@@ -313,7 +315,7 @@ typedef CDXSTACK * LPCDXSTACK;
typedef struct _CDXLIST
{
HB_ULONG ulAddr;
HB_ULONG nextPage;
HB_BOOL fStat;
struct _CDXLIST * pNext;
} CDXLIST;
@@ -390,6 +392,7 @@ typedef struct _CDXINDEX
HB_BOOL fShared; /* Shared file */
HB_BOOL fReadonly; /* Read only file */
HB_BOOL fDelete; /* delete on close flag */
HB_BOOL fLargeFile; /* page numbers instead of page offsets in index file */
HB_ULONG nextAvail; /* offset to next free page in the end of index file */
HB_ULONG freePage; /* offset to next free page inside index file */
LPCDXLIST freeLst; /* list of free pages in index file */
@@ -401,8 +404,8 @@ typedef struct _CDXINDEX
HB_BOOL WrLck;
#endif
HB_BOOL fChanged; /* changes written to index, need upadte ulVersion */
HB_ULONG ulVersion; /* network version/update flag */
HB_BOOL fFlush; /* changes written to index, need upadte ulVersion */
HB_ULONG ulVersion; /* network version/update flag */
} CDXINDEX;
typedef CDXINDEX * LPCDXINDEX;