mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Free walmethods before exiting
Not strictly necessary since we quite after, but could become important in the future if we do restarts etc. Michael Paquier with nitpicking from me
This commit is contained in:
@ -495,6 +495,13 @@ LogStreamerMain(logstreamer_param *param)
|
||||
}
|
||||
|
||||
PQfinish(param->bgconn);
|
||||
|
||||
if (format == 'p')
|
||||
FreeWalDirectoryMethod();
|
||||
else
|
||||
FreeWalTarMethod();
|
||||
pg_free(stream.walmethod);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -352,6 +352,10 @@ StreamLog(void)
|
||||
}
|
||||
|
||||
PQfinish(conn);
|
||||
|
||||
FreeWalDirectoryMethod();
|
||||
pg_free(stream.walmethod);
|
||||
|
||||
conn = NULL;
|
||||
}
|
||||
|
||||
|
@ -299,6 +299,13 @@ CreateWalDirectoryMethod(const char *basedir, bool sync)
|
||||
return method;
|
||||
}
|
||||
|
||||
void
|
||||
FreeWalDirectoryMethod(void)
|
||||
{
|
||||
pg_free(dir_data->basedir);
|
||||
pg_free(dir_data);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* WalTarMethod - write wal to a tar file containing pg_xlog contents
|
||||
@ -894,3 +901,14 @@ CreateWalTarMethod(const char *tarbase, int compression, bool sync)
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
void
|
||||
FreeWalTarMethod(void)
|
||||
{
|
||||
pg_free(tar_data->tarfilename);
|
||||
#ifdef HAVE_LIBZ
|
||||
if (tar_data->compression)
|
||||
pg_free(tar_data->zlibOut);
|
||||
#endif
|
||||
pg_free(tar_data);
|
||||
}
|
||||
|
@ -43,3 +43,7 @@ struct WalWriteMethod
|
||||
*/
|
||||
WalWriteMethod *CreateWalDirectoryMethod(const char *basedir, bool sync);
|
||||
WalWriteMethod *CreateWalTarMethod(const char *tarbase, int compression, bool sync);
|
||||
|
||||
/* Cleanup routines for previously-created methods */
|
||||
void FreeWalDirectoryMethod(void);
|
||||
void FreeWalTarMethod(void);
|
||||
|
Reference in New Issue
Block a user