mirror of https://github.com/citusdata/citus.git
Add PG_WAIT_EXTENSION to Read/WriteFile calls
Read/WriteFile adds the same "wait_event_info" argument, so I've added a PG_WAIT_EXTENSION to all these calls as well.pull/1439/head
parent
4610978c10
commit
0b4b9aa5a9
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
|
#include "pgstat.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -54,7 +55,13 @@ RedirectCopyDataToRegularFile(const char *filename)
|
||||||
/* if received data has contents, append to regular file */
|
/* if received data has contents, append to regular file */
|
||||||
if (copyData->len > 0)
|
if (copyData->len > 0)
|
||||||
{
|
{
|
||||||
|
#if (PG_VERSION_NUM >= 100000)
|
||||||
|
int appended = FileWrite(fileDesc, copyData->data, copyData->len,
|
||||||
|
PG_WAIT_EXTENSION);
|
||||||
|
#else
|
||||||
int appended = FileWrite(fileDesc, copyData->data, copyData->len);
|
int appended = FileWrite(fileDesc, copyData->data, copyData->len);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (appended != copyData->len)
|
if (appended != copyData->len)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errcode_for_file_access(),
|
ereport(ERROR, (errcode_for_file_access(),
|
||||||
|
@ -98,7 +105,12 @@ SendRegularFile(const char *filename)
|
||||||
|
|
||||||
SendCopyOutStart();
|
SendCopyOutStart();
|
||||||
|
|
||||||
|
#if (PG_VERSION_NUM >= 100000)
|
||||||
|
readBytes = FileRead(fileDesc, fileBuffer->data, fileBufferSize, PG_WAIT_EXTENSION);
|
||||||
|
#else
|
||||||
readBytes = FileRead(fileDesc, fileBuffer->data, fileBufferSize);
|
readBytes = FileRead(fileDesc, fileBuffer->data, fileBufferSize);
|
||||||
|
#endif
|
||||||
|
|
||||||
while (readBytes > 0)
|
while (readBytes > 0)
|
||||||
{
|
{
|
||||||
fileBuffer->len = readBytes;
|
fileBuffer->len = readBytes;
|
||||||
|
@ -106,7 +118,12 @@ SendRegularFile(const char *filename)
|
||||||
SendCopyData(fileBuffer);
|
SendCopyData(fileBuffer);
|
||||||
|
|
||||||
resetStringInfo(fileBuffer);
|
resetStringInfo(fileBuffer);
|
||||||
|
#if (PG_VERSION_NUM >= 100000)
|
||||||
|
readBytes = FileRead(fileDesc, fileBuffer->data, fileBufferSize,
|
||||||
|
PG_WAIT_EXTENSION);
|
||||||
|
#else
|
||||||
readBytes = FileRead(fileDesc, fileBuffer->data, fileBufferSize);
|
readBytes = FileRead(fileDesc, fileBuffer->data, fileBufferSize);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCopyDone();
|
SendCopyDone();
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#include "funcapi.h"
|
#include "funcapi.h"
|
||||||
|
#include "pgstat.h"
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -742,7 +743,12 @@ FileOutputStreamFlush(FileOutputStream file)
|
||||||
int written = 0;
|
int written = 0;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
#if (PG_VERSION_NUM >= 100000)
|
||||||
|
written = FileWrite(file.fileDescriptor, fileBuffer->data, fileBuffer->len,
|
||||||
|
PG_WAIT_EXTENSION);
|
||||||
|
#else
|
||||||
written = FileWrite(file.fileDescriptor, fileBuffer->data, fileBuffer->len);
|
written = FileWrite(file.fileDescriptor, fileBuffer->data, fileBuffer->len);
|
||||||
|
#endif
|
||||||
if (written != fileBuffer->len)
|
if (written != fileBuffer->len)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errcode_for_file_access(),
|
ereport(ERROR, (errcode_for_file_access(),
|
||||||
|
|
Loading…
Reference in New Issue