What's the relationship between checksum and full page image?












1















Recently, I learned some about PostgreSQL data checksum and feel confused about the relationship between checksum and full page image.



As the following comment said at:




If we need to protect hint bit updates from torn writes, WAL-log a
full page image of the page. This full page image is only necessary
if the hint bit update is the first change to the page since the
last checkpoint.



We don't check full_page_writes here because that logic is included
when we call XLogInsert() since the value changes dynamically.




As I known, if we need to protect pages from torn writes including hint bit updates, we should enable full_page_writes. Why do I need to write full page images at the WAL if the checksum is able to detect torn pages even if full_page_writes is off?










share|improve this question





























    1















    Recently, I learned some about PostgreSQL data checksum and feel confused about the relationship between checksum and full page image.



    As the following comment said at:




    If we need to protect hint bit updates from torn writes, WAL-log a
    full page image of the page. This full page image is only necessary
    if the hint bit update is the first change to the page since the
    last checkpoint.



    We don't check full_page_writes here because that logic is included
    when we call XLogInsert() since the value changes dynamically.




    As I known, if we need to protect pages from torn writes including hint bit updates, we should enable full_page_writes. Why do I need to write full page images at the WAL if the checksum is able to detect torn pages even if full_page_writes is off?










    share|improve this question



























      1












      1








      1








      Recently, I learned some about PostgreSQL data checksum and feel confused about the relationship between checksum and full page image.



      As the following comment said at:




      If we need to protect hint bit updates from torn writes, WAL-log a
      full page image of the page. This full page image is only necessary
      if the hint bit update is the first change to the page since the
      last checkpoint.



      We don't check full_page_writes here because that logic is included
      when we call XLogInsert() since the value changes dynamically.




      As I known, if we need to protect pages from torn writes including hint bit updates, we should enable full_page_writes. Why do I need to write full page images at the WAL if the checksum is able to detect torn pages even if full_page_writes is off?










      share|improve this question
















      Recently, I learned some about PostgreSQL data checksum and feel confused about the relationship between checksum and full page image.



      As the following comment said at:




      If we need to protect hint bit updates from torn writes, WAL-log a
      full page image of the page. This full page image is only necessary
      if the hint bit update is the first change to the page since the
      last checkpoint.



      We don't check full_page_writes here because that logic is included
      when we call XLogInsert() since the value changes dynamically.




      As I known, if we need to protect pages from torn writes including hint bit updates, we should enable full_page_writes. Why do I need to write full page images at the WAL if the checksum is able to detect torn pages even if full_page_writes is off?







      postgresql postgresql-9.3 transaction-log






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 4:14









      Laurenz Albe

      49.5k102849




      49.5k102849










      asked Nov 26 '18 at 2:21









      infernoinferno

      178113




      178113
























          1 Answer
          1






          active

          oldest

          votes


















          1














          The checksum will produce an error if you have a torn page, but it won't correct the error. All it tells you is that it is time to restore from backup.



          If you want to avoid the problem alogether, leave full_page_writes set to on.






          share|improve this answer
























          • So I think the whole work of checksum is to produce an error if I have a torn page, no matter what it is caused. Use full_page_writes to correct the error. Is it not a good idea to decouple checksum and what the full_page_writes do?

            – inferno
            Nov 26 '18 at 8:26











          • I think you understood. Checksums and full_page_write are not coupled, are they?

            – Laurenz Albe
            Nov 26 '18 at 8:43











          • I just think checksum does a little bit of what full_page_writes should do.

            – inferno
            Nov 26 '18 at 9:04











          • Checksums tell you that something went wrong, full_page_writes makes sure it won't happen.

            – Laurenz Albe
            Nov 26 '18 at 16:08











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53473999%2fwhats-the-relationship-between-checksum-and-full-page-image%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          The checksum will produce an error if you have a torn page, but it won't correct the error. All it tells you is that it is time to restore from backup.



          If you want to avoid the problem alogether, leave full_page_writes set to on.






          share|improve this answer
























          • So I think the whole work of checksum is to produce an error if I have a torn page, no matter what it is caused. Use full_page_writes to correct the error. Is it not a good idea to decouple checksum and what the full_page_writes do?

            – inferno
            Nov 26 '18 at 8:26











          • I think you understood. Checksums and full_page_write are not coupled, are they?

            – Laurenz Albe
            Nov 26 '18 at 8:43











          • I just think checksum does a little bit of what full_page_writes should do.

            – inferno
            Nov 26 '18 at 9:04











          • Checksums tell you that something went wrong, full_page_writes makes sure it won't happen.

            – Laurenz Albe
            Nov 26 '18 at 16:08
















          1














          The checksum will produce an error if you have a torn page, but it won't correct the error. All it tells you is that it is time to restore from backup.



          If you want to avoid the problem alogether, leave full_page_writes set to on.






          share|improve this answer
























          • So I think the whole work of checksum is to produce an error if I have a torn page, no matter what it is caused. Use full_page_writes to correct the error. Is it not a good idea to decouple checksum and what the full_page_writes do?

            – inferno
            Nov 26 '18 at 8:26











          • I think you understood. Checksums and full_page_write are not coupled, are they?

            – Laurenz Albe
            Nov 26 '18 at 8:43











          • I just think checksum does a little bit of what full_page_writes should do.

            – inferno
            Nov 26 '18 at 9:04











          • Checksums tell you that something went wrong, full_page_writes makes sure it won't happen.

            – Laurenz Albe
            Nov 26 '18 at 16:08














          1












          1








          1







          The checksum will produce an error if you have a torn page, but it won't correct the error. All it tells you is that it is time to restore from backup.



          If you want to avoid the problem alogether, leave full_page_writes set to on.






          share|improve this answer













          The checksum will produce an error if you have a torn page, but it won't correct the error. All it tells you is that it is time to restore from backup.



          If you want to avoid the problem alogether, leave full_page_writes set to on.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 4:09









          Laurenz AlbeLaurenz Albe

          49.5k102849




          49.5k102849













          • So I think the whole work of checksum is to produce an error if I have a torn page, no matter what it is caused. Use full_page_writes to correct the error. Is it not a good idea to decouple checksum and what the full_page_writes do?

            – inferno
            Nov 26 '18 at 8:26











          • I think you understood. Checksums and full_page_write are not coupled, are they?

            – Laurenz Albe
            Nov 26 '18 at 8:43











          • I just think checksum does a little bit of what full_page_writes should do.

            – inferno
            Nov 26 '18 at 9:04











          • Checksums tell you that something went wrong, full_page_writes makes sure it won't happen.

            – Laurenz Albe
            Nov 26 '18 at 16:08



















          • So I think the whole work of checksum is to produce an error if I have a torn page, no matter what it is caused. Use full_page_writes to correct the error. Is it not a good idea to decouple checksum and what the full_page_writes do?

            – inferno
            Nov 26 '18 at 8:26











          • I think you understood. Checksums and full_page_write are not coupled, are they?

            – Laurenz Albe
            Nov 26 '18 at 8:43











          • I just think checksum does a little bit of what full_page_writes should do.

            – inferno
            Nov 26 '18 at 9:04











          • Checksums tell you that something went wrong, full_page_writes makes sure it won't happen.

            – Laurenz Albe
            Nov 26 '18 at 16:08

















          So I think the whole work of checksum is to produce an error if I have a torn page, no matter what it is caused. Use full_page_writes to correct the error. Is it not a good idea to decouple checksum and what the full_page_writes do?

          – inferno
          Nov 26 '18 at 8:26





          So I think the whole work of checksum is to produce an error if I have a torn page, no matter what it is caused. Use full_page_writes to correct the error. Is it not a good idea to decouple checksum and what the full_page_writes do?

          – inferno
          Nov 26 '18 at 8:26













          I think you understood. Checksums and full_page_write are not coupled, are they?

          – Laurenz Albe
          Nov 26 '18 at 8:43





          I think you understood. Checksums and full_page_write are not coupled, are they?

          – Laurenz Albe
          Nov 26 '18 at 8:43













          I just think checksum does a little bit of what full_page_writes should do.

          – inferno
          Nov 26 '18 at 9:04





          I just think checksum does a little bit of what full_page_writes should do.

          – inferno
          Nov 26 '18 at 9:04













          Checksums tell you that something went wrong, full_page_writes makes sure it won't happen.

          – Laurenz Albe
          Nov 26 '18 at 16:08





          Checksums tell you that something went wrong, full_page_writes makes sure it won't happen.

          – Laurenz Albe
          Nov 26 '18 at 16:08




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53473999%2fwhats-the-relationship-between-checksum-and-full-page-image%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Futebolista

          Feedback on college project

          Albești (Vaslui)