Re: [GENERAL] How to get transaction started always in WRITE mode.

Поиск
Список
Период
Сортировка
От Jerry Sievers
Тема Re: [GENERAL] How to get transaction started always in WRITE mode.
Дата
Msg-id 87eft4o23k.fsf@jsievers.enova.com
обсуждение исходный текст
Ответ на Re: [GENERAL] How to get transaction started always in WRITE mode.  (Adam Šlachta <adam.slachta@xitee.com>)
Список pgsql-general
Adam Šlachta <adam.slachta@xitee.com> writes:

> Hello Scott and other potential readers/writers,
>
>
>
>> Login to the database with psql as the same user that your java app
> connects with try:
>
>>
>
>> show default_transaction_read_only;
>
>>  This can be set per-user, it's possible you're getting tripped up
> there.
>
>
>
> show default_transaction_read_only;
>
> OFF -> this was run under the same user as our application while the
> application was running;
>
>
>
>> Also, what happens if you run:
>
>>
>
>> select pg_is_in_recovery();
>
>> This can happen if you connect to a postgres slave instead of a
> master.  Make sure you're always connecting to a master node for
> executing writes.
>
>
>
> select pg_is_in_recovery() returns “F”, however we have not
> configured master/slave (I guess this is mostly used for replication
> right?).
>
>
>
>> Is it possible that your code / connect layer is setting
> default_transaction_read_only to TRUE when the app connects?
>
>
>
> Well, this might be hard to tell, since we would have to be sure all
> those layers (hibernate/spring) does not “somehow” set read-only to
> true. We have tried to set it up correctly, but most probably that’s
> where the problem root cause is.
>
> Do you know how to find it out eg. in PostgreSQL logs how the
> read-only flag is setup for current transaction? We have tried to
> enable full logging (postgresql.conf) however reading it is quite
> tough and we did not get any closer to the solution.

Also make sure there's no DB or role specific override.  psql \drds may
reveal something.

Full statement logging via log_statement=all or
log_min_duration_statement=0 should certainly have shown you something
if it's being set explicitly by client and/or pooler.

>
>
>
> Thank you for your help so far,
>
> Adam
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> -------------------------------------------
> This e-mail message including any attachments is for the sole use of
> the intended recipient(s) and may contain privileged or confidential
> information. Any unauthorized review, use, disclosure or distribution
> is prohibited. If you are not the intended recipient, please
> immediately contact the sender by reply e-mail and delete the
> original message and destroy all copies thereof.
>
> Tato zpráva včetně veškerých příloh je důvěrná a mohou ji využít
> pouze osoby, jimž je adresována. Nejste-li adresátem zprávy, obsah i
> s přílohami a kopiemi bezodkladně odstraňte ze svého systému a dále
> ji nijak nevyužívejte. Upozorňujeme Vás, že využívání zpráv, které
> Vám nejsou určeny, je zakázáno, včetně jejich přímého či nepřímého
> zveřejňování, kopírování, tištění, rozšiřování anebo jakéhokoli
> právního jednání učiněného při spoléhání se na jejich obsah. Pokud
> jste zprávu obdrželi omylem, postupujte stejně a neprodleně
> informujte odesílatele.
>
> Der Inhalt dieser E-Mail ist vertraulich und ausschließlich für den
> bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene
> Adressat dieser E-Mail oder dessen Vertreter sein sollten, so
> beachten Sie bitte, dass jede Form der Kenntnisnahme,
> Veröffentlichung, Vervielfältigung oder Weitergabe des Inhalts dieser
> E-Mail unzulässig ist. Wir bitten Sie, sich in diesem Fall mit dem
> Absender der E-Mail in Verbindung zu setzen.
>
>
>
>

--
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 312.241.7800


В списке pgsql-general по дате отправления:

Предыдущее
От: PAWAN SHARMA
Дата:
Сообщение: [GENERAL] getting error while parsing log file using pgbadger
Следующее
От: rob stone
Дата:
Сообщение: Re: [GENERAL] How to get transaction started always in WRITE mode.