Re: [GENERAL] CORRUPTION on TOAST table

2016-04-02 Thread Soni M
Sorry, miss that info. Master 9.1.13, replica1 9.1.13, replica2 9.1.19.
Master Red Hat Enterprise Linux Server release 6.5 (Santiago),
replica1 Red Hat Enterprise Linux Server release 6.5 (Santiago),
replica2 Red Hat Enterprise Linux Server release 6.7 (Santiago).

On Sun, Apr 3, 2016 at 10:43 AM, Joshua D. Drake 
wrote:

>
> What version of PostgreSQL and which OS?
>
>
> On 04/02/2016 08:38 PM, Soni M wrote:
>
>
>> How can the corruption occurs ? and how can I resolve them ?
>>
>> Thank so much for the help.
>>
>> Cheers \o/
>>
>> --
>> Regards,
>>
>> Soni Maula Harriz
>>
>
>
> --
> Command Prompt, Inc.  http://the.postgres.company/
> +1-503-667-4564
> PostgreSQL Centered full stack support, consulting and development.
> Everyone appreciates your honesty, until you are honest with them.
>



-- 
Regards,

Soni Maula Harriz


Re: [GENERAL] CORRUPTION on TOAST table

2016-04-02 Thread Joshua D. Drake


What version of PostgreSQL and which OS?

On 04/02/2016 08:38 PM, Soni M wrote:



How can the corruption occurs ? and how can I resolve them ?

Thank so much for the help.

Cheers \o/

--
Regards,

Soni Maula Harriz



--
Command Prompt, Inc.  http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] CORRUPTION on TOAST table

2016-04-02 Thread Soni M
Hello Everyone,

We face TOAST table corruption.

One master and two streaming replicas. The corruption happen only on both
streaming replicas.

We did found the corrupted rows. Selecting on this row, return (on both
replica) : unexpected chunk number 0 (expected 1) for toast value
1100613112 in pg_toast_112517
selecting this row on master does not return corruption error, but return
correct result instead.

Previously, dump on a replica return : unexpected chunk number 0 (expected
1) for toast value 3234098599 in pg_toast_112517 (please note the toast
value is different)

This table size is 343 GB, contain around 206,179,697 live tuples. We found
that the corruption happen on the biggest column (this column and its pkey
sized around 299 GB total).

replica1 :
ESX 5.5, VM Version 8
Intel(R) Xeon(R) CPU E5649  @ 2.53GHz
8GB RAM
Storage – Raw Disk Mapping in ESX from 3PAR 7400 SAN using Fast Class (10k)
disk
Each volume (single disk as presented by SAN) on the VMs is its own LVM
volume.

replica2 :
ESX 5.5, VM Version 8
Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
8GB RAM
Raw Disk Mapping in ESX from 3PAR 7400 SAN using Fast Clkass (10k) disk
Each volume (single disk as presented by SAN) on the VMs is its own LVM
volume.

on both replica :
fsync NEVER turned off.
none unexpected power loss nor OS crash.

How can the corruption occurs ? and how can I resolve them ?

Thank so much for the help.

Cheers \o/

-- 
Regards,

Soni Maula Harriz


[GENERAL] plpgsql update row from record variable

2016-04-02 Thread Seamus Abshere
hi,

I want to write a function that updates arbitrary columns and here's my
pseudocode:

CREATE OR REPLACE FUNCTION update_pet(id int, raw_data jsonb) RETURNS
VOID AS $$
DECLARE
  data record;
BEGIN
  SELECT jsonb_populate_record(null::pets, raw_data) INTO data;
  UPDATE pets [... from data ...] WHERE id = id; -- probably impossible
END;
$$ LANGUAGE plpgsql;

e.g.

SELECT update_pets(1, '{ "name" : "Jerry", "age": 9 }'::jsonb);

Back in 2004, Tom showed how to insert from a plpgsql record:

http://www.postgresql.org/message-id/17840.1087670...@sss.pgh.pa.us

Is there any way to "update *" from a record?

Thanks!
Seamus

PS. Whether I **should** do this is another matter, I just want to know
if it's possible.

--
Seamus Abshere, SCEA
https://github.com/seamusabshere
http://linkedin.com/in/seamusabshere


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general