Skip to content

Commit

Permalink
Track file trailer only in debug builds
Browse files Browse the repository at this point in the history
The PR timescale#5410 changes the handling of the file_trailer_received flag. It
is now only used in asserts and not in any other kind of logic. This
patch encapsulates the file_trailer_received in a USE_ASSERT_CHECKING
macro.
  • Loading branch information
jnidzwetzki committed Mar 9, 2023
1 parent 7b8177a commit bfa8fea
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tsl/src/remote/copy_fetcher.c
Expand Up @@ -19,8 +19,10 @@ typedef struct CopyFetcher
/* Data for virtual tuples of the current retrieved batch. */
Datum *batch_values;
bool *batch_nulls;
bool file_trailer_received;
AsyncRequest *req;
#ifdef USE_ASSERT_CHECKING
bool file_trailer_received;
#endif
} CopyFetcher;

static void copy_fetcher_send_fetch_request(DataFetcher *df);
Expand Down Expand Up @@ -61,7 +63,10 @@ static void
copy_fetcher_reset(CopyFetcher *fetcher)
{
fetcher->state.open = false;

#ifdef USE_ASSERT_CHECKING
fetcher->file_trailer_received = false;
#endif

if (fetcher->req != NULL)
{
Expand Down Expand Up @@ -449,7 +454,9 @@ copy_fetcher_complete(CopyFetcher *fetcher)
* nor the expected number of columns. This provides an extra
* check against somehow getting out of sync with the data.
*/
#ifdef USE_ASSERT_CHECKING
fetcher->file_trailer_received = true;
#endif

/* Next PQgetCopyData() should return -1, indicating EOF and
* that the remote side ended the copy. The final result
Expand Down

0 comments on commit bfa8fea

Please sign in to comment.