mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Pre-beta mechanical code beautification.
Run pgindent, pgperltidy, and reformat-dat-files. I manually fixed a couple of comments that pgindent uglified.
This commit is contained in:
@ -40,8 +40,8 @@
|
||||
|
||||
PG_MODULE_MAGIC;
|
||||
|
||||
void _PG_init(void);
|
||||
void _PG_archive_module_init(ArchiveModuleCallbacks *cb);
|
||||
void _PG_init(void);
|
||||
void _PG_archive_module_init(ArchiveModuleCallbacks *cb);
|
||||
|
||||
static char *archive_directory = NULL;
|
||||
static MemoryContext basic_archive_context;
|
||||
@ -102,8 +102,8 @@ check_archive_directory(char **newval, void **extra, GucSource source)
|
||||
|
||||
/*
|
||||
* The default value is an empty string, so we have to accept that value.
|
||||
* Our check_configured callback also checks for this and prevents archiving
|
||||
* from proceeding if it is still empty.
|
||||
* Our check_configured callback also checks for this and prevents
|
||||
* archiving from proceeding if it is still empty.
|
||||
*/
|
||||
if (*newval == NULL || *newval[0] == '\0')
|
||||
return true;
|
||||
@ -119,7 +119,7 @@ check_archive_directory(char **newval, void **extra, GucSource source)
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a basic sanity check that the specified archive directory exists. It
|
||||
* Do a basic sanity check that the specified archive directory exists. It
|
||||
* could be removed at some point in the future, so we still need to be
|
||||
* prepared for it not to exist in the actual archiving logic.
|
||||
*/
|
||||
@ -155,18 +155,19 @@ basic_archive_file(const char *file, const char *path)
|
||||
MemoryContext oldcontext;
|
||||
|
||||
/*
|
||||
* We run basic_archive_file_internal() in our own memory context so that we
|
||||
* can easily reset it during error recovery (thus avoiding memory leaks).
|
||||
* We run basic_archive_file_internal() in our own memory context so that
|
||||
* we can easily reset it during error recovery (thus avoiding memory
|
||||
* leaks).
|
||||
*/
|
||||
oldcontext = MemoryContextSwitchTo(basic_archive_context);
|
||||
|
||||
/*
|
||||
* Since the archiver operates at the bottom of the exception stack, ERRORs
|
||||
* turn into FATALs and cause the archiver process to restart. However,
|
||||
* using ereport(ERROR, ...) when there are problems is easy to code and
|
||||
* maintain. Therefore, we create our own exception handler to catch ERRORs
|
||||
* and return false instead of restarting the archiver whenever there is a
|
||||
* failure.
|
||||
* Since the archiver operates at the bottom of the exception stack,
|
||||
* ERRORs turn into FATALs and cause the archiver process to restart.
|
||||
* However, using ereport(ERROR, ...) when there are problems is easy to
|
||||
* code and maintain. Therefore, we create our own exception handler to
|
||||
* catch ERRORs and return false instead of restarting the archiver
|
||||
* whenever there is a failure.
|
||||
*/
|
||||
if (sigsetjmp(local_sigjmp_buf, 1) != 0)
|
||||
{
|
||||
@ -228,14 +229,14 @@ basic_archive_file_internal(const char *file, const char *path)
|
||||
snprintf(destination, MAXPGPATH, "%s/%s", archive_directory, file);
|
||||
|
||||
/*
|
||||
* First, check if the file has already been archived. If it already exists
|
||||
* and has the same contents as the file we're trying to archive, we can
|
||||
* return success (after ensuring the file is persisted to disk). This
|
||||
* scenario is possible if the server crashed after archiving the file but
|
||||
* before renaming its .ready file to .done.
|
||||
* First, check if the file has already been archived. If it already
|
||||
* exists and has the same contents as the file we're trying to archive,
|
||||
* we can return success (after ensuring the file is persisted to disk).
|
||||
* This scenario is possible if the server crashed after archiving the
|
||||
* file but before renaming its .ready file to .done.
|
||||
*
|
||||
* If the archive file already exists but has different contents, something
|
||||
* might be wrong, so we just fail.
|
||||
* If the archive file already exists but has different contents,
|
||||
* something might be wrong, so we just fail.
|
||||
*/
|
||||
if (stat(destination, &st) == 0)
|
||||
{
|
||||
@ -274,8 +275,8 @@ basic_archive_file_internal(const char *file, const char *path)
|
||||
archive_directory, "archtemp", file, MyProcPid, epoch);
|
||||
|
||||
/*
|
||||
* Copy the file to its temporary destination. Note that this will fail if
|
||||
* temp already exists.
|
||||
* Copy the file to its temporary destination. Note that this will fail
|
||||
* if temp already exists.
|
||||
*/
|
||||
copy_file(unconstify(char *, path), temp);
|
||||
|
||||
@ -318,9 +319,9 @@ compare_files(const char *file1, const char *file2)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int nbytes = 0;
|
||||
int buf1_len = 0;
|
||||
int buf2_len = 0;
|
||||
int nbytes = 0;
|
||||
int buf1_len = 0;
|
||||
int buf2_len = 0;
|
||||
|
||||
while (buf1_len < CMP_BUF_SIZE)
|
||||
{
|
||||
|
Reference in New Issue
Block a user