Re: Should we represent temp files as unsigned long int instead of signed long int type? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Should we represent temp files as unsigned long int instead of signed long int type?
Date
Msg-id 1013454.1698260859@sss.pgh.pa.us
Whole thread Raw
In response to Should we represent temp files as unsigned long int instead of signed long int type?  (Ashutosh Sharma <ashu.coek88@gmail.com>)
Responses Re: Should we represent temp files as unsigned long int instead of signed long int type?
List pgsql-hackers
Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> At present, we represent temp files as a signed long int number. And
> depending on the system architecture (32 bit or 64 bit), the range of
> signed long int varies, for example on a 32-bit system it will range
> from -2,147,483,648 to 2,147,483,647. AFAIU, this will not allow a
> session to create more than 2 billion temporary files and that is not
> a small number at all, but still what if we make it an unsigned long
> int which will allow a session to create 4 billion temporary files if
> needed.

AFAIK, nothing particularly awful will happen if that counter wraps
around.  Perhaps if you gamed the system really hard, you could cause
a collision with a still-extant temp file from the previous cycle,
but I seriously doubt that could happen by accident.  So I don't
think there's anything to worry about here.  Maybe we could make
that filename pattern %lu not %ld, but minus sign is a perfectly
acceptable filename character, so such a change would be cosmetic.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Custom tstzrange with importance factored in
Next
From: Robert Haas
Date:
Subject: Re: Should we represent temp files as unsigned long int instead of signed long int type?