questions about snapshot building logic

2022-08-29 Thread Вадим Самохин
I've read some posts about how snapshots are built (here
, here
, and here
) and I thought that I
understood what's going on -- until I tried that in practice. My postgres
version is 11.6.

So, I start a first session:
*session 1*:
begin isolation level repeatable read;
update restaurant set address = '1' where id = 1;
select txid_current(); -- it is 1402
select txid_current_snapshot(); -- 1402:1402:

*Question 1*: why is xmax equal to xmin? Isn't xmax the id of a
not-yet-started transaction, that is 1402 + 1 = 1403?

after that, I start a second session:

*session 2*:
begin isolation level repeatable read;
update restaurant set address = '2' where id = 2;
select txid_current(); -- 1403
select txid_current_snapshot(); -- 1402:1402:

*Question 2*: how is it possible that xmax is less than a current
transaction id? One can assume from session 1 that xmax = current
transaction id, so why xmax != 1403? And why is 1402 absent from a xip list?

*session 3:*
begin isolation level repeatable read;
update restaurant set address = '3' where id = 3;
select txid_current(); -- 1404
select txid_current_snapshot(); -- 1402:1402: -- all the same
rollback;

After then I commit the second transaction:

*session 2:*
commit;

... and start the fourth transaction:

*session 4:*
begin isolation level repeatable read;
update restaurant set address = '4' where id = 4;
select txid_current(); -- 1405
select txid_current_snapshot(); -- 1402:1405:1402

*Question 3*: why did a snapshot change so much? xmax is now 1405, and the
first transaction is finally in a xip list!


Re: Corrupted Postgresql Microsoft Binaries

2022-08-29 Thread Hillary Masha
After further investigation, it was determined that the issue was with the
length of the path of some subdirectories in the zip file for the new
binaries. Windows has a max path length of 260 characters, hence the issue
with unzipping.
Postgres V 14.3 had a max file path length of 226
[image: image.png]
Postgres V 14.5 has a max file path length of 321
[image: image.png]

My team uses powershell v5 in our code to unzip these files, we needed to
enable 'Long Path' for the files to be successfully unzipped. This was
added as an opt-in by Microsoft for Windows 10 (
https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell
).
Note that the files were successfully unzipped in Powershell v7 without
making any changes.

On Wed, Aug 24, 2022 at 5:36 PM Adrian Klaver 
wrote:

> On 8/24/22 2:23 PM, Thomas Kellerer wrote:
> > Hillary Masha schrieb am 23.08.2022 um 20:58:
> >> I downloaded the microsoft postgresql binaries for versions 14.5,
> >> 13.8, 12.12, 11.17, 10.22 from
> >> https://www.enterprisedb.com/download-postgresql-binaries and found
> >> that there was an error with opening the zip files. Does anyone else
> >> use these files and found that they ran into the same issue? If so,
> >> where else can I get the files?
> >
> > I have no problems unzipping them on Windows 10 using TotalCommander
> > or the Info-ZIP "unzip" tool
> >
>
> I did some searching to see if there was a fix and the results where:
>
>  From MS the usual:
> a) It's your problem
> b) Upgrade
> c) Reboot.
>
>  From others:
>
> a) The builtin unzip program is buggy don't use.
> b) Use just about any other program.
>
> --
> Adrian Klaver
> adrian.kla...@aklaver.com
>
>
>


Re: Corrupted Postgresql Microsoft Binaries

2022-08-29 Thread Adrian Klaver

On 8/29/22 07:50, Hillary Masha wrote:
After further investigation, it was determined that the issue was with 
the length of the path of some subdirectories in the zip file for the 
new binaries. Windows has a max path length of 260 characters, hence the 
issue with unzipping.

Postgres V 14.3 had a max file path length of 226
image.png
Postgres V 14.5 has a max file path length of 321
image.png

My team uses powershell v5 in our code to unzip these files, we needed 
to enable 'Long Path' for the files to be successfully unzipped. This 


Hmm, this must be a MS client software fix as non-MS products don't have 
this issue when unzipping. I see the long directory in the archive 
unzipped by 7-zip.


was added as an opt-in by Microsoft for Windows 10 
(https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell 
).
Note that the files were successfully unzipped in Powershell v7 without 
making any changes.


On Wed, Aug 24, 2022 at 5:36 PM Adrian Klaver 



--
Adrian Klaver
adrian.kla...@aklaver.com