Re: formula about the number of WAL files
От | Fujii Masao |
---|---|
Тема | Re: formula about the number of WAL files |
Дата | |
Msg-id | AANLkTi=e=oR54OuxAw88=dtV4wt0e5edMiGaeZtBVcKO@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: formula about the number of WAL files (Simon Riggs <simon@2ndQuadrant.com>) |
Ответы |
Re: formula about the number of WAL files
|
Список | pgsql-docs |
On Fri, Oct 15, 2010 at 6:19 PM, Simon Riggs <simon@2ndquadrant.com> wrote: > On Thu, 2010-10-14 at 12:00 +0900, Fujii Masao wrote: >> ---------------- >> 29.4. WAL Configuration >> >> There will always be at least one WAL segment file, and will normally not >> be more than (2 + checkpoint_completion_target) * checkpoint_segments + 1 >> or checkpoint_segments + wal_keep_segments + 1 files. >> ---------------- >> >> The above formula is wrong. The correct is >> >> (2 + checkpoint_completion_target) * checkpoint_segments + >> wal_keep_segments + 1 >> >> The attached patch fixes this fault. > > The current docs are wrong, but your re-definition doesn't match the > actual code in CreateCheckPoint(). > > I've updated the docs to reflect how the code behaves. Hmm.. I seem to be very mixed up. Let me consider the formula again. Basically checkpoint deletes the WAL files which are older than the prior checkpoint's redo location. So at least WAL files which were generated from the prior ckpt start to current ckpt end can exist in pg_xlog directory. The number of those WAL files is (1 + checkpoint_completion_target) * checkpoint_segments But if this number is smaller than wal_keep_segments, checkpoint leaves wal_keep_segments WAL files in pg_xlog instead. So, from this aspect, the maximum number of WAL files in pg_xlog is (1 + checkpoint_completion_target) * checkpoint_segments or wal_keep_segments After checkpoint deletes old WAL files, the number of WAL files in pg_xlog continues to increase until subsequent checkpoint will have deleted WAL files. The increased number is checkpoint_segments Furthermore, one WAL file might be preallocated aside from the above. As the result of the above, the maximum number of WAL files in pg_xlog is (2 + checkpoint_completion_target) * checkpoint_segments + 1 or wal_keep_segments + checkpoint_segments + 1 So the original description seems to be correct. Am I missing something? # My previous proposal is definitely wrong. Sorry for noise. Regards, -- Fujii Masao NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center
В списке pgsql-docs по дате отправления: