DB 1.85 Patches

  1. Problem: DB 1.85 compiles on IRIX, but fails to pass the tests.
  2. A UNIX mailbox with the patches to make DB version 1.85 (or 1.86) run on current IRIX systems.  

  3. Problem: DB 1.85 core dumps on certain data sets when using the B+tree access method.
  4. Apply the following patch to the db-1.85/btree/bt_split.c file.  
    *** btree/bt_split.c	Tue Jul 26 14:22:02 1994
    --- btree/bt_split.c	Sat Jan  4 14:38:55 1997
    ***************
    *** 673,679 ****
      		 * where we decide to try and copy too much onto the left page.
      		 * Make sure that doesn't happen.
      		 */
    ! 		if (skip <= off && used + nbytes >= full) {
      			--off;
      			break;
      		}
    --- 673,679 ----
      		 * where we decide to try and copy too much onto the left page.
      		 * Make sure that doesn't happen.
      		 */
    ! 		if (skip <= off && used + nbytes >= full || nxt == top - 1) {
      			--off;
      			break;
      		}
    

  5. Problem: DB 1.85 compiles on Linux but fails to load, displaying an error message that there's no lorder command.
  6. Apply the following patch to the Linux Makefile.  
    *** Makefile.orig	Wed Jul 13 21:43:16 1994
    --- Makefile	Wed Dec 31 19:00:00 1969
    ***************
    *** 15,22 ****
      
      ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
      	rm -f $@
    ! 	ar cq $@ \
    ! 	    `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort`
      	ranlib $@
      
      clean:
    --- 15,21 ----
      
      ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
      	rm -f $@
    ! 	ar cq $@ ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
      	ranlib $@
      
      clean:
    

  7. Problem: DB 1.85 core dumps on certain data sets when using the B+tree access method. (Patch #2 MUST be applied before this patch.)
  8. Apply the following patch to the db-1.85/btree/bt_split.c file.  
    *** btree/bt_split.c.orig	Sat Feb  8 10:14:10 1997
    --- btree/bt_split.c	Sat Feb  8 10:14:51 1997
    ***************
    *** 673,679 ****
      		 * where we decide to try and copy too much onto the left page.
      		 * Make sure that doesn't happen.
      		 */
    ! 		if (skip <= off && used + nbytes >= full || nxt == top - 1) {
      			--off;
      			break;
      		}
    --- 673,680 ----
      		 * where we decide to try and copy too much onto the left page.
      		 * Make sure that doesn't happen.
      		 */
    ! 		if (skip <= off &&
    ! 		    used + nbytes + sizeof(indx_t) >= full || nxt == top - 1) {
      			--off;
      			break;
      		}
    ***************
    *** 686,692 ****
      			memmove((char *)l + l->upper, src, nbytes);
      		}
      
    ! 		used += nbytes;
      		if (used >= half) {
      			if (!isbigkey || bigkeycnt == 3)
      				break;
    --- 687,693 ----
      			memmove((char *)l + l->upper, src, nbytes);
      		}
      
    ! 		used += nbytes + sizeof(indx_t);
      		if (used >= half) {
      			if (!isbigkey || bigkeycnt == 3)
      				break;
    

  9. Problem: The metadata page for DB 1.85 B+tree databases is not correctly maintained in some circumstances.
  10. Apply the following patch to the db-1.85/btree/bt_page.c file.  
    *** btree/bt_page.c.orig	Wed Jul 13 21:29:02 1994
    --- btree/bt_page.c	Wed Jun 11 20:14:43 1997
    ***************
    *** 65,70 ****
    --- 65,71 ----
      	h->prevpg = P_INVALID;
      	h->nextpg = t->bt_free;
      	t->bt_free = h->pgno;
    + 	F_SET(t, B_METADIRTY);
      
      	/* Make sure the page gets written back. */
      	return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
    ***************
    *** 92,97 ****
    --- 93,99 ----
      	    (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
      		*npg = t->bt_free;
      		t->bt_free = h->nextpg;
    + 		F_SET(t, B_METADIRTY);
      		return (h);
      	}
      	return (mpool_new(t->bt_mp, npg));