|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.104 1999/05/25 16:08:27 momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.105 1999/05/29 10:25:30 vadim Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -93,7 +93,6 @@ static void vc_attrstats(Relation onerel, VRelStats *vacrelstats, HeapTuple tupl
|
93 | 93 | static void vc_bucketcpy(Form_pg_attribute attr, Datum value, Datum *bucket, int16 *bucket_len);
|
94 | 94 | static void vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *vacrelstats);
|
95 | 95 | static void vc_delhilowstats(Oid relid, int attcnt, int *attnums);
|
96 |
| -static void vc_setpagelock(Relation rel, BlockNumber blkno); |
97 | 96 | static VPageDescr vc_tidreapped(ItemPointer itemptr, VPageList vpl);
|
98 | 97 | static void vc_reappage(VPageList vpl, VPageDescr vpc);
|
99 | 98 | static void vc_vpinsert(VPageList vpl, VPageDescr vpnew);
|
@@ -2221,7 +2220,8 @@ vc_bucketcpy(Form_pg_attribute attr, Datum value, Datum *bucket, int16 *bucket_l
|
2221 | 2220 | * tuple that's already on the page. The reason for this is that if
|
2222 | 2221 | * we updated these tuples in the usual way, then every tuple in pg_class
|
2223 | 2222 | * would be replaced every day. This would make planning and executing
|
2224 |
| - * historical queries very expensive. |
| 2223 | + * historical queries very expensive. Note that we also don't use |
| 2224 | + * any locking while doing updation. |
2225 | 2225 | */
|
2226 | 2226 | static void
|
2227 | 2227 | vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *vacrelstats)
|
@@ -2257,7 +2257,6 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
|
2257 | 2257 | pfree(ctup);
|
2258 | 2258 |
|
2259 | 2259 | /* overwrite the existing statistics in the tuple */
|
2260 |
| - vc_setpagelock(rd, ItemPointerGetBlockNumber(&(rtup.t_self))); |
2261 | 2260 | pgcform = (Form_pg_class) GETSTRUCT(&rtup);
|
2262 | 2261 | pgcform->reltuples = num_tuples;
|
2263 | 2262 | pgcform->relpages = num_pages;
|
@@ -2301,11 +2300,6 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
|
2301 | 2300 | /* overwrite the existing statistics in the tuple */
|
2302 | 2301 | if (VacAttrStatsEqValid(stats))
|
2303 | 2302 | {
|
2304 |
| - Buffer abuffer = scan->rs_cbuf; |
2305 |
| - |
2306 |
| - vc_setpagelock(ad, ItemPointerGetBlockNumber(&atup->t_self)); |
2307 |
| - attp = (Form_pg_attribute) GETSTRUCT(atup); |
2308 |
| - |
2309 | 2303 | if (stats->nonnull_cnt + stats->null_cnt == 0 ||
|
2310 | 2304 | (stats->null_cnt <= 1 && stats->best_cnt == 1))
|
2311 | 2305 | selratio = 0;
|
@@ -2338,7 +2332,7 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
|
2338 | 2332 | * Invalidate the cache for the tuple and write the buffer
|
2339 | 2333 | */
|
2340 | 2334 | RelationInvalidateHeapTuple(ad, atup);
|
2341 |
| - WriteNoReleaseBuffer(abuffer); |
| 2335 | + WriteNoReleaseBuffer(scan->rs_cbuf); |
2342 | 2336 |
|
2343 | 2337 | /* DO PG_STATISTIC INSERTS */
|
2344 | 2338 |
|
@@ -2396,9 +2390,7 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
|
2396 | 2390 | */
|
2397 | 2391 | RelationInvalidateHeapTuple(rd, &rtup);
|
2398 | 2392 |
|
2399 |
| - WriteNoReleaseBuffer(buffer); |
2400 |
| - |
2401 |
| - ReleaseBuffer(buffer); |
| 2393 | + WriteBuffer(buffer); |
2402 | 2394 |
|
2403 | 2395 | heap_close(rd);
|
2404 | 2396 | }
|
@@ -2449,12 +2441,6 @@ vc_delhilowstats(Oid relid, int attcnt, int *attnums)
|
2449 | 2441 | heap_close(pgstatistic);
|
2450 | 2442 | }
|
2451 | 2443 |
|
2452 |
| -static void |
2453 |
| -vc_setpagelock(Relation rel, BlockNumber blkno) |
2454 |
| -{ |
2455 |
| - LockPage(rel, blkno, ExclusiveLock); |
2456 |
| -} |
2457 |
| - |
2458 | 2444 | /*
|
2459 | 2445 | * vc_reappage() -- save a page on the array of reapped pages.
|
2460 | 2446 | *
|
|
0 commit comments