pgbackrest.git / summary / log / commit / refs
commit e5bcc0c47e9db98ff99366a1e5806c1dcd6ebadd
Author: David Steele <david@pgmasters.net>
Date: Thu Mar 19 16:34:27 2020 +0000
Clarifications of what limit == NULL or UINT64_MAX means.
doc/xml/release.xml | 8 ++++++++
src/storage/posix/read.c | 6 ++++--
src/storage/read.h | 2 +-
src/storage/read.intern.h | 2 +-
src/storage/storage.h | 4 +++-
src/storage/storage.intern.h | 2 +-
6 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/doc/xml/release.xml b/doc/xml/release.xml
index cedae7e64..a3cf1045f 100644
--- a/doc/xml/release.xml
+++ b/doc/xml/release.xml
@@ -83,6 +83,14 @@
<p>Improve performance of <code>MEM_CONTEXT*()</code> macros.</p>
</release-item>
+
+ <release-item>
+ <release-item-contributor-list>
+ <release-item-reviewer id="cynthia.shang"/>
+ </release-item-contributor-list>
+
+ <p>Allow storage reads to be limited by bytes.</p>
+ </release-item>
</release-development-list>
</release-core-list>
</release>
diff --git a/src/storage/posix/read.c b/src/storage/posix/read.c
index fe16e5212..6e21abb8a 100644
--- a/src/storage/posix/read.c
+++ b/src/storage/posix/read.c
@@ -29,7 +29,7 @@ typedef struct StorageReadPosix
int handle;
uint64_t current; // Current bytes read from file
- uint64_t limit; // Limit bytes to be read from file
+ uint64_t limit; // Limit bytes to be read from file (UINT64_MAX for no limit)
bool eof;
} StorageReadPosix;
@@ -221,7 +221,9 @@ storageReadPosixNew(StoragePosix *storage, const String *name, bool ignoreMissin
.storage = storage,
.handle = -1,
- // Rather than enable/disable limit checking just always use a limit
+ // Rather than enable/disable limit checking just use a big number when there is no limit. We can feel pretty confident
+ // that no files will be > UINT64_MAX in size. This is a copy of the interface limit but it simplifies the code during
+ // read so it seems worthwhile.
.limit = limit == NULL ? UINT64_MAX : varUInt64(limit),
.interface = (StorageReadInterface)
diff --git a/src/storage/read.h b/src/storage/read.h
index 15316c875..8475c689c 100644
--- a/src/storage/read.h
+++ b/src/storage/read.h
@@ -24,7 +24,7 @@ Getters
***********************************************************************************************************************************/
IoRead *storageReadIo(const StorageRead *this);
-// Is there a read limit?
+// Is there a read limit? NULL for no limit.
const Variant *storageReadLimit(const StorageRead *this);
bool storageReadIgnoreMissing(const StorageRead *this);
diff --git a/src/storage/read.intern.h b/src/storage/read.intern.h
index 14bc99d52..1a00c7a3f 100644
--- a/src/storage/read.intern.h
+++ b/src/storage/read.intern.h
@@ -17,7 +17,7 @@ typedef struct StorageReadInterface
bool compressible; // Is this file compressible?
unsigned int compressLevel; // Level to use for compression
bool ignoreMissing;
- const Variant *limit; // Limit how many bytes are read
+ const Variant *limit; // Limit how many bytes are read (NULL for no limit)
IoReadInterface ioInterface;
} StorageReadInterface;
diff --git a/src/storage/storage.h b/src/storage/storage.h
index d8e495140..53f7a37f0 100644
--- a/src/storage/storage.h
+++ b/src/storage/storage.h
@@ -156,7 +156,9 @@ typedef struct StorageNewReadParam
VAR_PARAM_HEADER;
bool ignoreMissing;
bool compressible;
- const Variant *limit; // Limit bytes to read from the file (must be varTypeUInt64)
+
+ // Limit bytes to read from the file (must be varTypeUInt64). NULL for no limit.
+ const Variant *limit;
} StorageNewReadParam;
#define storageNewReadP(this, pathExp, ...) \
diff --git a/src/storage/storage.intern.h b/src/storage/storage.intern.h
index ea1e94328..53f6a4585 100644
--- a/src/storage/storage.intern.h
+++ b/src/storage/storage.intern.h
@@ -105,7 +105,7 @@ typedef struct StorageInterfaceNewReadParam
// helpful.
bool compressible;
- // Limit bytes read from the file
+ // Limit bytes read from the file. NULL for no limit.
const Variant *limit;
} StorageInterfaceNewReadParam;
[parent: 73315268fd9d]