const char *gid, TimestampTz prepared_at, Oid owner,
Oid databaseid);
static void RemoveTwoPhaseFile(FullTransactionId fxid, bool giveWarning);
-static void RecreateTwoPhaseFile(FullTransactionId fxid, void *content, int len);
+static void RecreateTwoPhaseFile(FullTransactionId fxid, const void *content, int len);
/*
* Register shared memory for two-phase state.
* Note: content and len don't include CRC.
*/
static void
-RecreateTwoPhaseFile(FullTransactionId fxid, void *content, int len)
+RecreateTwoPhaseFile(FullTransactionId fxid, const void *content, int len)
{
char path[MAXPGPATH];
pg_crc32c statefile_crc;
static void debug_reconstruction(int n_source,
rfile **sources,
bool dry_run);
-static unsigned find_reconstructed_block_length(rfile *s);
-static rfile *make_incremental_rfile(char *filename);
-static rfile *make_rfile(char *filename, bool missing_ok);
-static void write_reconstructed_file(char *input_filename,
- char *output_filename,
+static unsigned find_reconstructed_block_length(const rfile *s);
+static rfile *make_incremental_rfile(const char *filename);
+static rfile *make_rfile(const char *filename, bool missing_ok);
+static void write_reconstructed_file(const char *input_filename,
+ const char *output_filename,
unsigned block_length,
rfile **sourcemap,
- off_t *offsetmap,
+ const off_t *offsetmap,
pg_checksum_context *checksum_ctx,
CopyMethod copy_method,
bool debug,
bool dry_run);
-static void read_bytes(rfile *rf, void *buffer, unsigned length);
-static void write_block(int fd, char *output_filename,
- uint8 *buffer,
+static void read_bytes(const rfile *rf, void *buffer, unsigned length);
+static void write_block(int fd, const char *output_filename,
+ const uint8 *buffer,
pg_checksum_context *checksum_ctx);
-static void read_block(rfile *s, off_t off, uint8 *buffer);
+static void read_block(const rfile *s, off_t off, uint8 *buffer);
/*
* Reconstruct a full file from an incremental file and a chain of prior
* necessary to include those blocks.
*/
static unsigned
-find_reconstructed_block_length(rfile *s)
+find_reconstructed_block_length(const rfile *s)
{
unsigned block_length = s->truncation_block_length;
unsigned i;
* blocks it contains.
*/
static rfile *
-make_incremental_rfile(char *filename)
+make_incremental_rfile(const char *filename)
{
rfile *rf;
unsigned magic;
* Allocate and perform basic initialization of an rfile.
*/
static rfile *
-make_rfile(char *filename, bool missing_ok)
+make_rfile(const char *filename, bool missing_ok)
{
rfile *rf;
* Read the indicated number of bytes from an rfile into the buffer.
*/
static void
-read_bytes(rfile *rf, void *buffer, unsigned length)
+read_bytes(const rfile *rf, void *buffer, unsigned length)
{
int rb = read(rf->fd, buffer, length);
* Write out a reconstructed file.
*/
static void
-write_reconstructed_file(char *input_filename,
- char *output_filename,
+write_reconstructed_file(const char *input_filename,
+ const char *output_filename,
unsigned block_length,
rfile **sourcemap,
- off_t *offsetmap,
+ const off_t *offsetmap,
pg_checksum_context *checksum_ctx,
CopyMethod copy_method,
bool debug,
* provided only for the error message.
*/
static void
-write_block(int fd, char *output_filename,
- uint8 *buffer, pg_checksum_context *checksum_ctx)
+write_block(int fd, const char *output_filename,
+ const uint8 *buffer, pg_checksum_context *checksum_ctx)
{
int wb;
* Read a block of data (BLCKSZ bytes) into the buffer.
*/
static void
-read_block(rfile *s, off_t off, uint8 *buffer)
+read_block(const rfile *s, off_t off, uint8 *buffer)
{
int rb;
extern bool existsTimeLineHistory(TimeLineID probeTLI);
extern TimeLineID findNewestTimeLine(TimeLineID startTLI);
extern void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
- XLogRecPtr switchpoint, char *reason);
-extern void writeTimeLineHistoryFile(TimeLineID tli, char *content, int size);
+ XLogRecPtr switchpoint, const char *reason);
+extern void writeTimeLineHistoryFile(TimeLineID tli, const char *content, int size);
extern void restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end);
extern bool tliInHistory(TimeLineID tli, List *expectedTLEs);
extern TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history);