Closed seantanly closed 6 years ago
fsync
should not return errors on prl_fs. Can you please help me with investigation by providing strace
output of postgresql process when issue is reproduced?
I'm not sure how to do a strace
, but here's the steps to reproduce the errors.
HOST_DATA_PATH=~/docker/postgres/data
# Run instance to initialize DB
docker run \
-d \
--rm \
-p 5432:5432 \
--name postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e PGDATA=/var/lib/postgresql/data/pgdata \
postgres:10.1
# Wait for DB to initialize
sleep 15
# Copy out initialized DB data
mkdir -p $HOST_DATA_PATH
docker cp postgres:/var/lib/postgresql/data/pgdata $HOST_DATA_PATH/pgdata
# verify DB data is copied
ls -al $HOST_DATA_PATH/pgdata
# Stop 1st instance which is no longer needed
docker stop postgres
# Run actual workhorse instance and see the error
docker run \
--rm \
--name postgres \
-p 5432:5432 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v $HOST_DATA_PATH:/var/lib/postgresql/data \
postgres:10.1
Found it. This issue is caused by the absence of fsync
operation support for directories in prl_fs.
Cool, will the fsync
operation support be added soon? Does that need upgrading of Parallels to next patch version or a simple update of docker-machine-parallels
?
Neither docker-machine-parallels nor Parallels Desktop. Issue should be fixed in boot2docker image really. Will try to prepare pull request with workaround.
Thanks, can you ref the boot2docker
PR with this issue? Makes it easier to follow.
Hoping to see this issue resolved soon. :)
Issues is fixed in boot2docker 17.12.0-ce-rc4.
Thank you, this issue is resolved with the release of boot2docker 17.12.0-ce a day ago.
@romankulikov I'm running into what might be the same issue with:
docker run -d --name postgres -e POSTGRES_PASSWORD=postgres -v /Users/ianbytchek/Documents/postgres:/var/lib/postgresql/data -p 5432:5432 postgres
docker log postgres
returns:
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
2020-02-29 18:03:53.948 UTC [35] LOG: could not link file "pg_wal/xlogtemp.35" to "pg_wal/000000010000000000000001": Operation not permitted
2020-02-29 18:03:53.950 UTC [35] FATAL: could not open file "pg_wal/000000010000000000000001": No such file or directory
child process exited with exit code 1
initdb: removing contents of data directory "/var/lib/postgresql/data"
running bootstrap script ...
I followed the notes from the #28, I can see the local data directory in boot2docker image when I open it through parallels, Docker changes the directory group (or user) to 999. I'm 99% confident this is the same setup I used on another machine last year and it worked fine.
P.S. Or is this related to #45 as the error refers to failing to create a file link? Apparently, this isn't an issue with other drivers.
@romankulikov I'm running into what might be the same issue with:
docker run -d --name postgres -e POSTGRES_PASSWORD=postgres -v /Users/ianbytchek/Documents/postgres:/var/lib/postgresql/data -p 5432:5432 postgres
docker log postgres
returns:The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory /var/lib/postgresql/data ... ok creating subdirectories ... ok selecting dynamic shared memory implementation ... posix selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default time zone ... Etc/UTC creating configuration files ... ok 2020-02-29 18:03:53.948 UTC [35] LOG: could not link file "pg_wal/xlogtemp.35" to "pg_wal/000000010000000000000001": Operation not permitted 2020-02-29 18:03:53.950 UTC [35] FATAL: could not open file "pg_wal/000000010000000000000001": No such file or directory child process exited with exit code 1 initdb: removing contents of data directory "/var/lib/postgresql/data" running bootstrap script ...
I followed the notes from the #28, I can see the local data directory in boot2docker image when I open it through parallels, Docker changes the directory group (or user) to 999. I'm 99% confident this is the same setup I used on another machine last year and it worked fine.
P.S. Or is this related to #45 as the error refers to failing to create a file link? Apparently, this isn't an issue with other drivers.
The thing is that Parallels Shared Folders don't support creating hard links. That's why you get such error. Here it is: https://github.com/Parallels/docker-machine-parallels/issues/45.
But this could be workarounded by the algorithm described by the topic-starter https://github.com/Parallels/docker-machine-parallels/issues/71#issuecomment-348153883.
Solution is
services:
postgres:
# ...
volumes:
# parallels on mac os does not support hard links, that's why we have to do it
- postgres-data:/data/postgres
environment:
- PGDATA=/data/postgres
# ...
volumes:
postgres-data:
name: postgres_volume_name
Hi guys I have similar error as @romankulikov. I am trying to use docker-compose(I am new to docker) for my API and postgres database. Her is how my docker compose file looks:
version: '3.9'
services:
web:
container_name: sourceryapi
build: .
ports:
- "8000:80"
depends_on:
database:
condition: service_healthy
database:
container_name: postgres
image: postgres:latest
ports:
- "5433:5432"
environment:
- POSTGRES_PASSWORD=admin
volumes:
- dbdata:/var/lib/postgresql/data
#- ./init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 25s
retries: 5
volumes:
dbdata:
And I am getting these output after docker-compose up:
Creating volume "postgres_volume_name" with default driver
Creating postgres ...
Creating postgres ... done
Creating sourceryapi ...
Creating sourceryapi ... done
Attaching to postgres, sourceryapi
[36mpostgres |[0m The files belonging to this database system will be owned by user "postgres".
[36mpostgres |[0m This user must also own the server process.
[36mpostgres |[0m
[36mpostgres |[0m The database cluster will be initialized with locale "en_US.utf8".
[36mpostgres |[0m The default database encoding has accordingly been set to "UTF8".
[36mpostgres |[0m The default text search configuration will be set to "english".
[36mpostgres |[0m
[36mpostgres |[0m Data page checksums are disabled.
[36mpostgres |[0m
[36mpostgres |[0m fixing permissions on existing directory /var/lib/postgresql/data ... ok
[36mpostgres |[0m creating subdirectories ... ok
[36mpostgres |[0m selecting dynamic shared memory implementation ... posix
[36mpostgres |[0m selecting default max_connections ... 100
[36mpostgres |[0m selecting default shared_buffers ... 128MB
[36mpostgres |[0m selecting default time zone ... Etc/UTC
[36mpostgres |[0m creating configuration files ... ok
[36mpostgres **|[0m running bootstrap script ... 2022-04-29 08:25:58.163 UTC [43] LOG: could not link file "pg_wal/xlogtemp.43" to "pg_wal/000000010000000000000001": Permission denied
[36mpostgres |[0m 2022-04-29 08:25:58.167 UTC [43] FATAL: could not open file "pg_wal/000000010000000000000001": No such file or directory**
[36mpostgres |[0m child process exited with exit code 1
[36mpostgres |[0m initdb: removing contents of data directory "/var/lib/postgresql/data"
[36mpostgres exited with code 4294967295
[0m[33msourceryapi |[0m Unhandled exception. System.IO.FileNotFoundException: Error reading the C:\app\ directory.
[33msourceryapi |[0m at System.IO.FileSystemWatcher.StartRaisingEvents()
[33msourceryapi |[0m at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()
[33msourceryapi |[0m at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
[33msourceryapi |[0m at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
[33msourceryapi |[0m at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
[33msourceryapi |[0m at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
[33msourceryapi |[0m at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()
[33msourceryapi |[0m at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
[33msourceryapi |[0m at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
[33msourceryapi |[0m at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
[33msourceryapi |[0m at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource source)
[33msourceryapi |[0m at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensions.Configuration.IConfigurationBuilder.Add(IConfigurationSource source)
[33msourceryapi |[0m at Microsoft.Extensions.Configuration.ConfigurationExtensions.Add[TSource](IConfigurationBuilder builder, Action`1 configureSource)
[33msourceryapi |[0m at Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(IConfigurationBuilder builder, IFileProvider provider, String path, Boolean optional, Boolean reloadOnChange)
[33msourceryapi |[0m at Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(IConfigurationBuilder builder, String path, Boolean optional, Boolean reloadOnChange)
[33msourceryapi |[0m at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.<>c__DisplayClass11_0.<ConfigureDefaults>b__1(HostBuilderContext hostingContext, IConfigurationBuilder config)
[33msourceryapi |[0m at Microsoft.AspNetCore.Hosting.BootstrapHostBuilder.RunDefaultCallbacks(ConfigurationManager configuration, HostBuilder innerBuilder)
[33msourceryapi |[0m at Microsoft.AspNetCore.Builder.WebApplicationBuilder..ctor(WebApplicationOptions options, Action`1 configureDefaults)
[33msourceryapi |[0m at Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder(String[] args)
[33msourceryapi |[0m at Program.<Main>$(String[] args) in C:\source\Program.cs:line 8
[33msourceryapi exited with code 3762504530
[0m
Seriously it is frustrating, I cannot find any solution to this...maybe you can help?
I believe this is the same problem with https://github.com/Parallels/docker-machine-parallels/issues/28 and it works on Docker for Mac (Hyperkit) but not via docker-machine-parallels.
I have just purchased Parallels Pro for the reasons it has much better IO performance vs (free) Docker for Mac.
prl_fs
being unable tofsync
looks like a big showstopper. Isfsync
forprl_fs
going to be worked on?