Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgres: Document socket length limitation and workaround #139

Closed
srid opened this issue Mar 11, 2024 · 11 comments · Fixed by #160
Closed

postgres: Document socket length limitation and workaround #139

srid opened this issue Mar 11, 2024 · 11 comments · Fixed by #160
Labels
documentation Improvements or additions to documentation

Comments

@srid
Copy link
Member

srid commented Mar 11, 2024

image

#77

@srid srid added the documentation Improvements or additions to documentation label Mar 11, 2024
@srid
Copy link
Member Author

srid commented Mar 11, 2024

We may want to have a separate page, guide/datadir.md, first and then talk about this. Then we can link to it from postgresql.md.

@srid
Copy link
Member Author

srid commented Mar 11, 2024

Also, is $HOME the best place? Why not $TMPDIR (falling back to /tmp)?

@shivaraj-bh
Copy link
Member

shivaraj-bh commented Mar 11, 2024

on darwin TMPDIR seems to be set, but that’s not the case in my NixOS. Not sure how it is in other linux distros. Perhaps if this is not set, we can fallback to /tmp.

@shivaraj-bh
Copy link
Member

We may want to have a separate page, guide/datadir.md, first and then talk about this. Then we can link to it from postgresql.md.

#144

@shivaraj-bh
Copy link
Member

postgres doc mentioning the socket length limitation: #147

@shivaraj-bh
Copy link
Member

Also, is $HOME the best place? Why not $TMPDIR (falling back to /tmp)?

This might not be as straight forward as it seems. Let’s assume that the socketDir option is set to “$TMPDIR/”, we can check for the presence of $TMPDIR in the shell script, but how do we then propagate the final socketDir path (after fallback to /tmp), to the settings option?

@srid
Copy link
Member Author

srid commented Mar 13, 2024

What happens if we don't set this option in the first place? What is postgres' default -- and is that sufficient?

unix_socket_directories = lib.mkDefault config.socketDir;

@shivaraj-bh
Copy link
Member

What happens if we don't set this option in the first place? What is postgres' default -- and is that sufficient?

unix_socket_directories = lib.mkDefault config.socketDir;

It will use dataDir by default

@srid
Copy link
Member Author

srid commented Mar 14, 2024

The default value is normally /tmp, but that can be changed at build time.

https://www.postgresql.org/docs/current/runtime-config-connection.html

So, the nixpkgs package uses something else as default?

Also, it looks like we can disable this entirely:

An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server.

(Will that break anything in CI though?)

@shivaraj-bh
Copy link
Member

I was looking to disable, let me try it out.

@srid
Copy link
Member Author

srid commented Mar 20, 2024

Due to socket path limits, the DEVENV_RUNTIME environment variable has been introduced: pointing to $XDG_RUNTIME_DIR by default and falling back to /tmp.

https://devenv.sh/blog/2023/03/20/devenv-10-rewrite-in-rust/#devenv_runtime

shivaraj-bh added a commit that referenced this issue Mar 26, 2024
resolves #139 

> empty `unix_socket_directories` means not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server.

see: https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES

* use TCP/IP by default for health check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants