Electron100 / butane

An ORM for Rust with a focus on simplicity and on writing Rust, not SQL
Apache License 2.0
94 stars 13 forks source link

Long current directory causes pg create_tmp_server to fail #191

Closed jayvdb closed 6 months ago

jayvdb commented 7 months ago

create_tmp_server fails with:

Unix-domain socket path \"/home/jayvdb/<really-log-path>/tmp_pg/21d255d0-2bf9-492e-b07a-7e4ccc1598c1/socket/.s.PGSQL.5432\" is too long (maximum 107 bytes)

Simple solution is to replace uuid in the path with https://docs.rs/block-id/latest/block_id/ , which is sufficiently unique for the purpose.

I've got a fix that I'll test a bit more before submitting.

Electron100 commented 7 months ago

Hmm, I wonder if a more complete fix would be to place the socket in the system tempdir (or a short path under that). block_id buys a few bytes but doesn't ultimately change the nature of the problem

jayvdb commented 7 months ago

If we;re going to use "temp" dir, we should have CI for platform specific locations. Hence https://github.com/Electron100/butane/pull/193

jayvdb commented 7 months ago

Also if we're not needing block-id, I recommend we replace uuid with ulid for these tmp directories (c.f. https://github.com/Electron100/butane/issues/133) , so that their names are ordered chronologically, which makes it a bit easier to reap old ones.

jayvdb commented 6 months ago

I went with using tempfile only for the socket dir, and still using block-id for the tmp_pg subdirs,, as keeping the pgdata can be useful when debugging test failures.