Subject: Re: Query on Postgres SQL transaction

From: Adrian Klaver <[email-masked]>
Date: Tue, 19 Mar 2024 09:03:15 -0700

On 3/19/24 02:18, Bandi, Venkataramana - Dell Team wrote:
> Hi Greg,
> 
> We are using hibernate framework to persist the data into Postgres SQL 
> DB and data is persisting and committing for all the clients but one of 
> the client data is not inserted into DB.

What is different about that client?

Are all the clients passing data through the same instance of the framework?

Are you sure that the client is pointed at the correct database?

Is the log entry below from that client?

> 
> Not getting any error/exception for this case. Could you please let us 
> know how we can trace out this scenario on transaction level whether 
> transaction is committing or not?
> 
> We have enabled below properties in postgresql.conf file and verified 
> but didn't get any findings about the transaction and below log 
> statements are writing in our data store logs.
> 
> log_statement = 'all'
> 
> logging_collector = on
> 
> log_min_messages = debug5
> 
> log_min_error_statement = debug5
> 
> 2024-02-19 15:21:54.850 +08 [1876] LOG:  execute S_48: insert into 
> xxxxxxx 
> (f_schedule_name,f_id,f_totaldataredtn,f_invalidationtime,f_statuscode,f_module,f_app_type,f_dbbackuptype,f_is_compressed,f_proxy,f_size,f_sizeprotected,f_groupjobid,f_status,f_bytesmodifiednotsent,f_sizetransferredboffset,f_bytesmodifiedsent,f_errcode,f_jobid2,f_media_server,f_starttime,f_storageid,f_pool,f_queuestart,f_sizescannedboffset,f_errorcodesummary,f_ncopies,f_sizeprotectedboffset,f_snap_target_platform,f_backup_servername,f_nfiles,f_expiry,f_owner,f_policy_id,f_parentjobid,f_sub_name,f_completion_status,f_endtime,f_filesscanned,f_idle_wait,f_storage_unit,f_group_id,f_backup_set,f_ntries,f_job_name,f_level,f_agent_name,f_failed_copies,f_restarted_job,f_success_copies,f_domain_id,f_snap_target,f_jobid,f_request_id,f_pluginname,f_sizetransferred,f_is_snap,f_node_id,f_workflow_id,f_action_name,f_agent_id,f_instancename,f_session,f_totalobjdedup,f_changedbytes,f_sizeboffset,f_dedupredtn,f_statuscodesummary,f_workflow_jobid,f_snap_policy,f_size_copies,f_sizescanned,f_sub_id,f_archive_flag,f_nfilesnot,f_media_wait,f_snap_creation,f_effective_path) values ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78)
> 
> 2024-02-19 15:21:54.851 +08 [10928] DEBUG:  bind <unnamed> to <unnamed>
> 
> 2024-02-19 15:21:54.852 +08 [10928] DEBUG:  CommitTransaction(1) name: 
> unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: 0/1/0
> 
> Regards,
> 
> Venkat
> 
> *
> *
> 
> *
> 
> Internal Use - Confidential
> 
> From:*Greg Sabino Mullane <[email-masked]>
> *Sent:* Saturday, March 16, 2024 12:07 AM
> *To:* Bandi, Venkataramana - Dell Team <[email-masked]>
> *Cc:* [email-masked]; Kishore, Nanda - Dell Team 
> <[email-masked]>; Alampalli, Kishore 
> <[email-masked]>
> *Subject:* Re: Query on Postgres SQL transaction
> 
> [EXTERNAL EMAIL]
> 
> That's a very vague question, but you can trace exactly what is 
> happening by issuing
> 
> SET log_statement = 'all';
> 
> Ideally at the session level by your application, but can also set it at 
> the database and user level. If all else fails, set it globally (i.e. 
> postgresql.conf). Turn it off again as soon as possible, it will make 
> your logs extremely verbose. But you can track exactly what your 
> application is doing.
> 
> Cheers,
> 
> Greg
> 

-- 
Adrian Klaver
[email-masked]

---

From: "Bandi, Venkataramana - Dell Team" <[email-masked]>
Date: Mon, 25 Mar 2024 07:18:56 +0000

Hi,

Please find my inline comments for your questions.

Regards,
Venkat

-----Original Message-----
From: Adrian Klaver <[email-masked]>
Sent: Tuesday, March 19, 2024 9:33 PM
To: Bandi, Venkataramana - Dell Team <[email-masked]>; Greg Sabino Mullane <[email-masked]>
Cc: [email-masked]; Kishore, Nanda - Dell Team <[email-masked]>; Alampalli, Kishore <[email-masked]>
Subject: Re: Query on Postgres SQL transaction

[EXTERNAL EMAIL]

On 3/19/24 02:18, Bandi, Venkataramana - Dell Team wrote:
> DB and data is persisting and committing for all the clients but one
> of the client data is not inserted into DB.

What is different about that client?
Ans: In our application data is getting from different nodes(systems) and persisting into Postgres SQL DB but for one of the nodes(system) data is not persisting and sometimes data is persisting for this node also. We have to trace out the transaction why data is not persisting sometimes.
Are all the clients passing data through the same instance of the framework?
Ans: Since it is a monolithic architecture application, it is running on same instance.
Are you sure that the client is pointed at the correct database?
Ans: Yes, its pointed to correct database and with same database connection, data is persisting for other nodes.
Is the log entry below from that client?
Ans: Yes
> (f_schedule_name,f_id,f_totaldataredtn,f_invalidationtime,f_statuscode
> ,f_module,f_app_type,f_dbbackuptype,f_is_compressed,f_proxy,f_size,f_s
> izeprotected,f_groupjobid,f_status,f_bytesmodifiednotsent,f_sizetransf
> erredboffset,f_bytesmodifiedsent,f_errcode,f_jobid2,f_media_server,f_s
> tarttime,f_storageid,f_pool,f_queuestart,f_sizescannedboffset,f_errorc
> odesummary,f_ncopies,f_sizeprotectedboffset,f_snap_target_platform,f_b
> ackup_servername,f_nfiles,f_expiry,f_owner,f_policy_id,f_parentjobid,f
> _sub_name,f_completion_status,f_endtime,f_filesscanned,f_idle_wait,f_s
> torage_unit,f_group_id,f_backup_set,f_ntries,f_job_name,f_level,f_agen
> t_name,f_failed_copies,f_restarted_job,f_success_copies,f_domain_id,f_
> snap_target,f_jobid,f_request_id,f_pluginname,f_sizetransferred,f_is_s
> nap,f_node_id,f_workflow_id,f_action_name,f_agent_id,f_instancename,f_
> session,f_totalobjdedup,f_changedbytes,f_sizeboffset,f_dedupredtn,f_st
> atuscodesummary,f_workflow_jobid,f_snap_policy,f_size_copies,f_sizesca
> nned,f_sub_id,f_archive_flag,f_nfilesnot,f_media_wait,f_snap_creation,
> f_effective_path) values
> ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$2
> 0,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,
> $38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$5
> 5,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,
> $73,$74,$75,$76,$77,$78)
>
> Ideally at the session level by your application, but can also set it
> at the database and user level. If all else fails, set it globally (i.e.

---

From: Adrian Klaver <[email-masked]>
Date: Mon, 25 Mar 2024 08:09:35 -0700

> Ans: In our application data is getting from different nodes(systems) and persisting into Postgres SQL DB but for one of the nodes(system) data is not persisting and sometimes data is persisting fo…

That we knew already. What I was after was whether that particular 
node(system) is different in some important way from the others. For 
instance different OS or OS version, different encoding, different 
location on the network, different data it is working, etc.

Define what you have done to trace the path of the transaction.

---

From: "Bandi, Venkataramana - Dell Team" <[email-masked]>
Date: Wed, 27 Mar 2024 04:48:05 +0000

Hi Adrian,

I will check with the customer on below info for that node and will share you.

For instance different OS or OS version, different encoding, different location on the network, different data it is working, etc.

As I already mentioned we have enabled Postgres SQL debug logs to trace out this scenario, but it is not helping us.

Regards,
Venkat

-----Original Message-----
From: Adrian Klaver <[email-masked]>
Sent: Monday, March 25, 2024 8:40 PM
To: Bandi, Venkataramana - Dell Team <[email-masked]>; Greg Sabino Mullane <[email-masked]>
Cc: [email-masked]; Kishore, Nanda - Dell Team <[email-masked]>; Alampalli, Kishore <[email-masked]>
Subject: Re: Query on Postgres SQL transaction

[EXTERNAL EMAIL]

On 3/25/24 00:18, Bandi, Venkataramana - Dell Team wrote:
> To: Bandi, Venkataramana - Dell Team
> <[email-masked]>; Greg Sabino Mullane
> <[email-masked]>
> Cc: [email-masked]; Kishore, Nanda - Dell Team
>> We are using hibernate framework to persist the data into Postgres
>> SQL DB and data is persisting and committing for all the clients but
>> one of the client data is not inserted into DB.
>

That we knew already. What I was after was whether that particular
node(system) is different in some important way from the others. For instance different OS or OS version, different encoding, different location on the network, different data it is working, etc.

---

From: "Bandi, Venkataramana - Dell Team" <[email-masked]>
Date: Wed, 27 Mar 2024 11:29:54 +0000

Hi,

As l already mentioned, for this specific node also data is persisting but sometimes(randomly) data is not persisting.

As you mentioned our application doesn't have any restrictions on OS level and on network etc.

different OS or OS version, different encoding, different location on the network, different data it is working, etc.

Regards,
Venkat

-----Original Message-----
From: Bandi, Venkataramana - Dell Team
Sent: Wednesday, March 27, 2024 10:18 AM
To: Adrian Klaver <[email-masked]>; Greg Sabino Mullane <[email-masked]>
Cc: [email-masked]; Kishore, Nanda - Dell Team <[email-masked]>; Alampalli, Kishore <[email-masked]>
Subject: RE: Query on Postgres SQL transaction

Hi Adrian,

Regards,
Venkat

-----Original Message-----
From: Adrian Klaver <[email-masked]>
Sent: Monday, March 25, 2024 8:40 PM
To: Bandi, Venkataramana - Dell Team <[email-masked]>; Greg Sabino Mullane <[email-masked]>
Cc: [email-masked]; Kishore, Nanda - Dell Team <[email-masked]>; Alampalli, Kishore <[email-masked]>
Subject: Re: Query on Postgres SQL transaction

[EXTERNAL EMAIL]

---

From: Adrian Klaver <[email-masked]>
Date: Wed, 27 Mar 2024 09:01:34 -0700

> As l already mentioned, for this specific node also data is persisting but sometimes(randomly) data is not persisting.

How do you know which data is not persisting?

> different OS or OS version, different encoding, different location on the network, different data it is working, etc.

I don't understand what the above is saying. Do you mean there are 
differences in these attributes between the nodes or no differences?

Also please do not top post, use either bottom or inline posting per:

https://en.wikipedia.org/wiki/Posting_style

---

From: "Bandi, Venkataramana - Dell Team" <[email-masked]>
Date: Sat, 30 Mar 2024 10:14:29 +0000

Hi,

Clarifying the problem statement again, Multiple requests are getting to our application server and using hibernate framework to persist the data into Postgres SQL DB but for one of the request, it is also similar request like other requests and there are no differences b/w these requests in terms of different OS, different network etc. but data is not persisting few times.

We have enabled below properties in postgresql.conf file and verified but didn't get any findings about the transaction and below log statements are writing in our data store logs.

log_statement = 'all'
logging_collector = on

2024-02-19 15:21:54.850 +08 [1876] LOG:  execute S_48: insert into xxxxxxx (f_schedule_name,f_id,f_totaldataredtn,f_invalidationtime,f_statuscode,f_module,f_app_type,f_dbbackuptype,f_is_compressed,f_proxy,f_size,f_sizeprotected,f_groupjobid,f_status,f_bytesmodifiednotsent,f_sizetransferredboffset,f_bytesmodifiedsent,f_errcode,f_jobid2,f_media_server,f_starttime,f_storageid,f_pool,f_queuestart,f_sizescannedboffset,f_errorcodesummary,f_ncopies,f_sizeprotectedboffset,f_snap_target_platform,f_backup_servername,f_nfiles,f_expiry,f_owner,f_policy_id,f_parentjobid,f_sub_name,f_completion_status,f_endtime,f_filesscanned,f_idle_wait,f_storage_unit,f_group_id,f_backup_set,f_ntries,f_job_name,f_level,f_agent_name,f_failed_copies,f_restarted_job,f_success_copies,f_domain_id,f_snap_target,f_jobid,f_request_id,f_pluginname,f_sizetransferred,f_is_snap,f_node_id,f_workflow_id,f_action_name,f_agent_id,f_instancename,f_session,f_totalobjdedup,f_changedbytes,f_sizeboffset,f_dedupredtn,f_statuscodesummary,f_workflow_jobid,f_snap_policy,f_size_copies,f_sizescanned,f_sub_id,f_archive_flag,f_nfilesnot,f_media_wait,f_snap_creation,f_effective_path) values ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78)
2024-02-19 15:21:54.851 +08 [10928] DEBUG:  bind <unnamed> to <unnamed>
2024-02-19 15:21:54.852 +08 [10928] DEBUG:  CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: 0/1/0

Could you let us know any other way to trace out these kind of DB transactions?

Regards,
Venkat

-----Original Message-----
From: Adrian Klaver <[email-masked]>
Sent: Wednesday, March 27, 2024 9:32 PM
To: Bandi, Venkataramana - Dell Team <[email-masked]>; Greg Sabino Mullane <[email-masked]>
Cc: [email-masked]; Kishore, Nanda - Dell Team <[email-masked]>; Alampalli, Kishore <[email-masked]>
Subject: Re: Query on Postgres SQL transaction

[EXTERNAL EMAIL]

> different OS or OS version, different encoding, different location on the network, different data it is working, etc.

I don't understand what the above is saying. Do you mean there are differences in these attributes between the nodes or no differences?

https://urldefense.com/v3/__https://en.wikipedia.org/wiki/Posting_style__;!!LpKI!glyl28rP3t6cLe3s9tF3X5_4YU28-qPJsOaPHUjX9F01s4DCAXmZVedjlyKpvXlv-TgG-800u0Drq4lWC2f8CObdQX3ijBWevQ$ [en[.]wikipedia[.]org]

---

From: Greg Sabino Mullane <[email-masked]>
Date: Sat, 30 Mar 2024 06:44:22 -0400

That log snippet shows two different PIDs. Check the logs to see the
complete path that process 1876 took after it did the insert at  2024-02-19
15:21:54.850 +08

Make sure you are not using prepared transactions. This should return 0:

select current_setting('max_prepared_transactions');

Cheers,
Greg

---

From: Adrian Klaver <[email-masked]>
Date: Sat, 30 Mar 2024 08:35:36 -0700

> Clarifying the problem statement again, Multiple requests are getting to our application server and using hibernate framework to persist the data into Postgres SQL DB but for one of the request, it…

You have fallen into the trap of working the problem(repeating the 
problem definition) instead of working the solution, taking the steps to 
solve it. Start with acknowledging that this "...there are no 
differences b/w these requests ..." is not the case, otherwise we would 
not be having this discusion. This is going to involve working through 
the process from the front end to the database.

Start with:

Did the INSERT entry you show below persist?