/* * Try opening the next segment file to read. * * This routine is responsible for seeking to the proper read location given * the logical EOF. * * filePathName - name of the segment file to open * version - AO table format version the file is in. * logicalEof - snapshot version of the EOF value to use as the read end of * the segment file. */ bool AppendOnlyStorageRead_TryOpenFile(AppendOnlyStorageRead *storageRead, char *filePathName, int version, int64 logicalEof) { File file; Assert(storageRead != NULL); Assert(storageRead->isActive); Assert(filePathName != NULL); /* UNDONE: Range check logicalEof */ file = AppendOnlyStorageRead_DoOpenFile(storageRead, filePathName); if (file < 0) return false; AppendOnlyStorageRead_FinishOpenFile(storageRead, file, filePathName, version, logicalEof); return true; }
/* * Open the next segment file to read. * * This routine is responsible for seeking to the proper * read location given the logical EOF. */ void AppendOnlyStorageRead_OpenFile( AppendOnlyStorageRead *storageRead, char *filePathName, /* The name of the segment file to open. */ int64 logicalEof) /* * The snapshot version of the EOF * value to use as the read end of the segment * file. */ { File file; Assert(storageRead != NULL); Assert(storageRead->isActive); Assert(filePathName != NULL); /* * The EOF must be be greater than 0, otherwise we risk transactionally created * segment files from disappearing if a concurrent write transaction aborts. */ if (logicalEof == 0) ereport(ERROR, (errcode(ERRCODE_GP_INTERNAL_ERROR), errmsg("Append-only Storage Read segment file '%s' EOF must be > 0 for relation '%s'", filePathName, storageRead->relationName))); file = AppendOnlyStorageRead_DoOpenFile( storageRead, filePathName); if(file < 0) { ereport(ERROR, (errcode_for_file_access(), errmsg("Append-Only Storage Read could not open segment file '%s' for relation '%s'", filePathName, storageRead->relationName))); } AppendOnlyStorageRead_FinishOpenFile( storageRead, file, filePathName, logicalEof); }
/* * Try opening the next segment file to read. * * This routine is responsible for seeking to the proper * read location given the logical EOF. */ bool AppendOnlyStorageRead_TryOpenFile( AppendOnlyStorageRead *storageRead, char *filePathName, /* The name of the segment file to open. */ int64 logicalEof) /* * The snapshot version of the EOF * value to use as the read end of the segment * file. */ { File file; Assert(storageRead != NULL); Assert(storageRead->isActive); Assert(filePathName != NULL); // UNDONE: Range check logicalEof file = AppendOnlyStorageRead_DoOpenFile( storageRead, filePathName); if(file < 0) { return false; } AppendOnlyStorageRead_FinishOpenFile( storageRead, file, filePathName, logicalEof); return true; }