1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Vagrant+VirtualBox上のPostgreSQLでデータファイルをsynced_folderしたらハマった時の考察

Posted at

Vagrant+VirtualBoxな仮想マシン上で動くPostgreSQLのデータファイル類を訳あってsynced_folderでホストOS側と共有した状態でUPDATE文を大量に発行したらこんなエラーが出た。

Vagrantfile
 :
config.vm.synced_folder "./pgsql/data", "/var/lib/pgsql/data", owner: "postgres", group: "postgres", mount_options: ["dmode=700", "fmode=600"]
 :
[Native message: PANIC:  ファイル"pg_xlog/00000001000000030000009C"(ログファイル3、セグメント156)をオープンできませんでした: そのようなファイルやディレクトリはありません
PANIC:  ファイル"pg_xlog/00000001000000030000009C"(ログファイル3、セグメント156)をオープンできませんでした: そのようなファイルやディレクトリはありません]

再起動してもPostgreSQLは同じエラーで起動しなくて検索しても答えが出なかったんだけど恐らくsynced_folderが遅いのが原因。

PostgreSQLはWALファイルにロギングしていくけどデフォルトのサイズが16MBもある。
このサイズのファイルを作成し終わる時間を追い越してトランザクションログを書き込もうとして上記のエラーになっているのと、カレントのWALファイルを指すポインタが先に進んでしまっているけど実態がないために再起動してもエラーとなるようだ。

synced_folderやめたら起きなかった。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?