summaryrefslogtreecommitdiffstats
path: root/src/util/db2/hash/hash.c.patch
blob: b72cc0d26d44a9e181a5a37612bde2ea27a54856 (plain)
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
*** /tmp/,RCSt1a21714	Wed Apr  3 11:49:15 1996
--- hash.c	Wed Apr  3 08:43:04 1996
***************
*** 399,405
  	/* Create pages for these buckets */
  	/*
  	for (i = 0; i <= hashp->hdr.max_bucket; i++) {
! 		if (__new_page(hashp, i, A_BUCKET) != 0)
  			return (-1);
  	}
  	*/

--- 399,405 -----
  	/* Create pages for these buckets */
  	/*
  	for (i = 0; i <= hashp->hdr.max_bucket; i++) {
! 		if (__new_page(hashp, (u_int32_t)i, A_BUCKET) != 0)
  			return (-1);
  	}
  	*/
***************
*** 560,567
  	 * XXX
  	 * Check success/failure conditions.
  	 */
! 	mpool_sync(hashp->mp);
! 	return (0);
  }
  
  /*

--- 560,566 -----
  	 * XXX
  	 * Check success/failure conditions.
  	 */
! 	return (flush_meta(hashp) || mpool_sync(hashp->mp));
  }
  
  /*
***************
*** 585,591
  	hput_header(hashp);
  
  	for (i = 0; i < NCACHED; i++)
! 		if (hashp->mapp[i])
  			if (__put_page(hashp,
  			    (PAGE16 *)hashp->mapp[i], A_BITMAP, 1))
  				return (-1);

--- 584,590 -----
  	hput_header(hashp);
  
  	for (i = 0; i < NCACHED; i++)
! 		if (hashp->mapp[i]) {
  			if (__put_page(hashp,
  			    (PAGE16 *)hashp->mapp[i], A_BITMAP, 1))
  				return (-1);
***************
*** 589,594
  			if (__put_page(hashp,
  			    (PAGE16 *)hashp->mapp[i], A_BITMAP, 1))
  				return (-1);
  	return (0);
  }
  

--- 588,595 -----
  			if (__put_page(hashp,
  			    (PAGE16 *)hashp->mapp[i], A_BITMAP, 1))
  				return (-1);
+ 			hashp->mapp[i] = NULL;
+ 		}
  	return (0);
  }
  
***************
*** 726,732
  #ifdef HASH_STATISTICS
  	hash_collisions++;
  #endif
- 
  	__get_item_done(hashp, &cursor);
  
  	/*

--- 727,732 -----
  #ifdef HASH_STATISTICS
  	hash_collisions++;
  #endif
  	__get_item_done(hashp, &cursor);
  
  	/*
***************
*** 773,778
  		if (__delpair(hashp, &cursor, &item_info) ||
  		    __addel(hashp, &item_info, key, val, UNKNOWN, 0))
  			return (ERROR);
  		if (item_info.caused_expand)
  			__expand_table(hashp);
  		break;

--- 773,779 -----
  		if (__delpair(hashp, &cursor, &item_info) ||
  		    __addel(hashp, &item_info, key, val, UNKNOWN, 0))
  			return (ERROR);
+ 		__get_item_done(hashp, &cursor);
  		if (item_info.caused_expand)
  			__expand_table(hashp);
  		break;