* BufFilePledgeSequential * * Promise that the caller will only do sequential I/O on the given file. * This allows the BufFile to be compressed, if 'gp_workfile_compression=on'. * * A sequential file is used in two stages: * * 0. Create file with BufFileCreateTemp(). * 1. Write all data, using BufFileWrite() * 2. Rewind to beginning, with BufFileSeek(file, 0, 0, SEEK_SET). * 3. Read as m
| 1258 | * that use buffiles across processes pledge sequential access, though.) |
| 1259 | */ |
| 1260 | void |
| 1261 | BufFilePledgeSequential(BufFile *buffile) |
| 1262 | { |
| 1263 | if (BufFileSize(buffile) != 0) |
| 1264 | elog(ERROR, "cannot pledge sequential access to a temporary file after writing it"); |
| 1265 | |
| 1266 | if (gp_workfile_compression) |
| 1267 | BufFileStartCompression(buffile); |
| 1268 | } |
| 1269 | |
| 1270 | /* |
| 1271 | * The rest of the code is only needed when compression support is compiled in. |
no test coverage detected