]> granicus.if.org Git - postgresql/commitdiff
Rename walmethod fsync method to sync
authorMagnus Hagander <magnus@hagander.net>
Sun, 23 Oct 2016 16:04:34 +0000 (18:04 +0200)
committerMagnus Hagander <magnus@hagander.net>
Sun, 23 Oct 2016 16:04:34 +0000 (18:04 +0200)
Using the name fsync clashed with the #define we have on Windows that
redefines it to _commit. Naming it sync should remove that conflict.

Per all the Windows buildfarm members

src/bin/pg_basebackup/receivelog.c
src/bin/pg_basebackup/walmethods.c
src/bin/pg_basebackup/walmethods.h

index fcd026947333b87b8a97efc201f0670903e49a9a..4382e5d76a1a6d1ec9a8e08f85bdc94787ec1c33 100644 (file)
@@ -132,7 +132,7 @@ open_walfile(StreamCtl *stream, XLogRecPtr startpoint)
                        }
 
                        /* fsync file in case of a previous crash */
-                       if (!stream->walmethod->fsync(f))
+                       if (!stream->walmethod->sync(f))
                        {
                                stream->walmethod->close(f, CLOSE_UNLINK);
                                return false;
@@ -768,7 +768,7 @@ HandleCopyStream(PGconn *conn, StreamCtl *stream,
                 */
                if (stream->synchronous && lastFlushPosition < blockpos && walfile != NULL)
                {
-                       if (stream->walmethod->fsync(walfile) != 0)
+                       if (stream->walmethod->sync(walfile) != 0)
                        {
                                fprintf(stderr, _("%s: could not fsync file \"%s\": %s\n"),
                                                progname, current_walfile_name, stream->walmethod->getlasterror());
@@ -1011,7 +1011,7 @@ ProcessKeepaliveMsg(PGconn *conn, StreamCtl *stream, char *copybuf, int len,
                         * data has been successfully replicated or not, at the normal
                         * shutdown of the server.
                         */
-                       if (stream->walmethod->fsync(walfile) != 0)
+                       if (stream->walmethod->sync(walfile) != 0)
                        {
                                fprintf(stderr, _("%s: could not fsync file \"%s\": %s\n"),
                                                progname, current_walfile_name, stream->walmethod->getlasterror());
index fe6569dff3245cd1e14d48b6d66fa01c1f1ad25b..d1dc046c97ce75cd30bd5c200f352a3396bc321b 100644 (file)
@@ -219,7 +219,7 @@ dir_close(Walfile f, WalCloseMethod method)
 }
 
 static int
-dir_fsync(Walfile f)
+dir_sync(Walfile f)
 {
        Assert(f != NULL);
 
@@ -287,7 +287,7 @@ CreateWalDirectoryMethod(const char *basedir, bool sync)
        method->get_current_pos = dir_get_current_pos;
        method->get_file_size = dir_get_file_size;
        method->close = dir_close;
-       method->fsync = dir_fsync;
+       method->sync = dir_sync;
        method->existsfile = dir_existsfile;
        method->finish = dir_finish;
        method->getlasterror = dir_getlasterror;
@@ -606,7 +606,7 @@ tar_get_current_pos(Walfile f)
 }
 
 static int
-tar_fsync(Walfile f)
+tar_sync(Walfile f)
 {
        Assert(f != NULL);
        tar_clear_error();
@@ -764,7 +764,7 @@ tar_close(Walfile f, WalCloseMethod method)
                return -1;
 
        /* Always fsync on close, so the padding gets fsynced */
-       tar_fsync(f);
+       tar_sync(f);
 
        /* Clean up and done */
        pg_free(tf->pathname);
@@ -872,7 +872,7 @@ CreateWalTarMethod(const char *tarbase, int compression, bool sync)
        method->get_current_pos = tar_get_current_pos;
        method->get_file_size = tar_get_file_size;
        method->close = tar_close;
-       method->fsync = tar_fsync;
+       method->sync = tar_sync;
        method->existsfile = tar_existsfile;
        method->finish = tar_finish;
        method->getlasterror = tar_getlasterror;
index 8a006fda7fd1cf5548f2a6b9b69344f9d2fac021..0c8eac7c619b83db75c0122b4d3d3f3c1464cc0e 100644 (file)
@@ -29,7 +29,7 @@ struct WalWriteMethod
 
        ssize_t         (*write) (Walfile f, const void *buf, size_t count);
        off_t           (*get_current_pos) (Walfile f);
-       int                     (*fsync) (Walfile f);
+       int                     (*sync) (Walfile f);
        bool            (*finish) (void);
        char       *(*getlasterror) (void);
 };