Skip to content

Commit 54a3615

Browse files
Remove misleading read stream asserts in a few users
Several read stream users asserted that the read stream was exhausted after looping on that very condition. It was pointed out in an a review of an as-of-yet uncommitted read stream user [1] that this was confusing and could lead the reader to think there was a possibility of some kind of race condition. Remove these asserts. [1] https://postgr.es/m/F9ACE8D0-B807-4A17-B6BD-87EF0717983D%40yesql.se
1 parent dbd437e commit 54a3615

File tree

4 files changed

+0
-8
lines changed

4 files changed

+0
-8
lines changed

contrib/amcheck/verify_heapam.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,6 @@ verify_heapam(PG_FUNCTION_ARGS)
853853
break;
854854
}
855855

856-
/* Ensure that the stream is completely read */
857-
Assert(read_stream_next_buffer(stream, NULL) == InvalidBuffer);
858856
read_stream_end(stream);
859857

860858
if (vmbuffer != InvalidBuffer)

src/backend/access/gist/gistvacuum.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,6 @@ gistvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
254254
gistvacuumpage(&vstate, buf);
255255
}
256256

257-
Assert(read_stream_next_buffer(stream, NULL) == InvalidBuffer);
258-
259257
/*
260258
* We have to reset the read stream to use it again. After returning
261259
* InvalidBuffer, the read stream API won't invoke our callback again

src/backend/access/nbtree/nbtree.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,8 +1117,6 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
11171117
current_block);
11181118
}
11191119

1120-
Assert(read_stream_next_buffer(stream, NULL) == InvalidBuffer);
1121-
11221120
/*
11231121
* We have to reset the read stream to use it again. After returning
11241122
* InvalidBuffer, the read stream API won't invoke our callback again

src/backend/access/spgist/spgvacuum.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,6 @@ spgvacuumscan(spgBulkDeleteState *bds)
879879
spgprocesspending(bds);
880880
}
881881

882-
Assert(read_stream_next_buffer(stream, NULL) == InvalidBuffer);
883-
884882
/*
885883
* We have to reset the read stream to use it again. After returning
886884
* InvalidBuffer, the read stream API won't invoke our callback again

0 commit comments

Comments
 (0)