Re: [GENERAL] Deleting unwanted wal files
On Fri, Aug 18, 2017 at 12:43 AM, krishna chaitanya wrote: > Thanks for your reply, Please do not top-post, this is not the style of this mailing list. > but will pg_basebackup generate a .backup file when > scheduled in cron job so that i can give that as input to pg_archivecleanup. Yes. > Also if i give archive_cleanup_command in recovery.conf will it check the > presence of recovery.conf file automatically and execute the command from > that file ? You can feed a backup history file name to pg_archivecleanup, it will then reuse the prefix of this file name. archive_cleanup_command is part of recovery.conf, which gets loaded by the server at the beginning of recovery by the startup process, so the command will get executed continuously on a standby. -- Michael -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Deleting unwanted wal files
Thanks for your reply, but will pg_basebackup generate a .backup file when scheduled in cron job so that i can give that as input to pg_archivecleanup. Also if i give archive_cleanup_command in recovery.conf will it check the presence of recovery.conf file automatically and execute the command from that file ? On 17 Aug 2017 8:01 p.m., "Michael Paquier" wrote: > On Thu, Aug 17, 2017 at 8:06 PM, krish050591 > wrote: > > Hi, if i'm using pg_basebackup utility for taking my database backup and > also > > enabled wal level archiving, how will i detect the unwanted wal files and > > how will it delete them ? > > Have you heard of pg_archivecleanup? Documentation is here: > https://www.postgresql.org/docs/devel/static/pgarchivecleanup.html > If a single archive is not cross-used among multiple standbys, you > could use it with archive_cleanup_command is recovery.conf to remove > unneeded WAL segments. > -- > Michael >
Re: [GENERAL] Deleting unwanted wal files
On Thu, Aug 17, 2017 at 8:06 PM, krish050591 wrote: > Hi, if i'm using pg_basebackup utility for taking my database backup and also > enabled wal level archiving, how will i detect the unwanted wal files and > how will it delete them ? Have you heard of pg_archivecleanup? Documentation is here: https://www.postgresql.org/docs/devel/static/pgarchivecleanup.html If a single archive is not cross-used among multiple standbys, you could use it with archive_cleanup_command is recovery.conf to remove unneeded WAL segments. -- Michael -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Deleting unwanted wal files
Hi, if i'm using pg_basebackup utility for taking my database backup and also enabled wal level archiving, how will i detect the unwanted wal files and how will it delete them ? -- View this message in context: http://www.postgresql-archive.org/Deleting-unwanted-wal-files-tp5978815.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Development of an extension for PostgreSQL and PostGIS
So far the code is like this(In addition to the input and output functions): struct trajectory_elem { int32 id; Timestamp time_obj; GSERIALIZED *geom_elem; /* Geometry Object */ }; PG_FUNCTION_INFO_V1(trajectory_elem); Datum trajectory_elem(PG_FUNCTION_ARGS) { int32 id = PG_GETARG_INT32(0); Timestamp timestamp = PG_GETARG_TIMESTAMP(1); GSERIALIZED *geom = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(2)); LWGEOM *lwgeom = lwgeom_from_gserialized(geom); struct trajectory_elem *trje = (struct trajectory_elem *) palloc(sizeof(struct trajectory_elem)); GSERIALIZED *result; size_t size; /*elog(NOTICE, "trajectory_elem called");*/ if (lwgeom_is_empty(lwgeom) || lwgeom->type != POINTTYPE) { elog(NOTICE, "trajectory_elem is NULL, or type is not correct"); PG_RETURN_NULL(); } /* Serialize the result back down from LWGEOM, but don't return right away */ // result = geometry_serialize(lwgeom); result = gserialized_from_lwgeom(lwgeom, &size); trje->id = id; trje->time_obj = timestamp; trje->geom_elem = result; elog(NOTICE, "trajectory_elem finish"); /* Then call free_if_copy on the *varlena* structures you originally get as arguments */ // lwgeom_free(lwgeom); PG_FREE_IF_COPY(lwgeom, 0); elog(NOTICE, "trajectory_elem finish2"); // PG_RETURN_TRAJECTELEM_TYPE_P(trje); PG_RETURN_POINTER(trje); } But the Postgres server crashes. Values are entering correctly, but I can not return the structure pointer.. It is wrong the way I'm programming the extension with the PostGIS? Thanks in advance De: Paul Ramsey Enviado: segunda-feira, 14 de agosto de 2017 15:36 Para: Fabiana Zioti Cc: pgsql-general@postgresql.org Assunto: Re: [GENERAL] Development of an extension for PostgreSQL and PostGIS In order to get an LWGEOM from PostGIS you'll need to convert from the serialized form (GSERIALIZED) which you can read all about in the liblwgeom.h header. You'll be adding a hard dependency of course, but hopefully you're OK with that. If you're just hoping to build a compound type, as your example shows, you can do that without a C extension, just read up on CREATE TYPE. For an alternate example of an extension with a lighter dependency on PostGIS, check out pgpointcloud, which has it's own structure for spatial data (a point patch) and exchanges data with PostGIS via well-known-binary. This removes the liblwgeom dependency, which means it's possible to compile and use pgpointcloud without PostGIS installed, which is not entirely uncommon. P On Mon, Aug 14, 2017 at 11:18 AM, Fabiana Zioti mailto:fabi_zi...@hotmail.com>> wrote: Hello. I will start developing an extension to PostgreSQL next to PostGIS using the C language. If my new type were: CREATE TYPE mytype (.., .., .., geom geometry); The creation of the structure in c, would be something like? #include "liblwgeom.h" Struct mytype { Int32 id; LWGEOM lwgeom; }; In the extension I will create new data types for PostgreSQL, but I would like to use the geometric objects that the PostGIS extension offers, such as POINT, LINE, POLYGON, etc. In addition to their input functions (wkt- ST_GeomFromText ()), operators, index, etc. In this case just importing the liblwgeom library would be enough to develop an extension to PostgreSQL / PostGIS? Would you have any examples of such a project? Thanks in advance!!
Re: [GENERAL] Begginers question
On 16 August 2017 at 20:55, Achilleas Mantzios wrote: > On 16/08/2017 13:46, Alex Samad wrote: > > > > On 16 August 2017 at 16:16, Michael Paquier > wrote: > >> On Wed, Aug 16, 2017 at 2:32 PM, Alex Samad wrote: >> > 1) why did it fill up this time and not previously >> > I add this >> > archive_command = '/bin/true' >> > wal_keep_segments = 1000 # <<< I'm guessing its this >> > >> > 2) how do I fix up, can I just remove the files from the pg_xlog >> directory >> > How can I work out how much space this is going to use, I see in the comments a segment is 16M, so 1000 would have been 16G, So I thought I would set it at 100 so 1.6G. but it ended up using about 4.5G. So now I am confused > >> Don't do that. those files are managed by Postgres so you may finish >> with a corrupted cluster. Instead you should lower the value of >> > > Too late, its okay its a learning experience. > > >> wal_keep_segments, reload the server parameters, and then enforce two >> checkpoints to force WAL segments to be recycled. Note that this >> > > how do I force check points > > checkpoint ; > (the ; is not meant as a smiley or whatever ) > > > >> depends also on the values of checkpoint_segments >> (max_wal_size/min_wal_size in Postgres 9.5 and onwards). >> -- >> Michael >> > > thanks > > > -- > Achilleas Mantzios > IT DEV Lead > IT DEPT > Dynacom Tankers Mgmt > >