Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-46878

Where possible 'cbbackupmgr' should avoid the truncate/overwrite pattern

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Done
    • 7.1.0
    • 7.1.0
    • tools
    • None
    • 1

    Description

      What's the issue?
      When updating files, we quite often use utilities such as `os.WriteFile`, internally this will open the file with the 'O_TRUNC' flag, then write the given data. This opens ourselves to issues where truncation succeeds, but the write fails (meaning it's possible to end up with partial/empty files).

      What's the fix?
      For "mission critical" files, we should use atomic operations, for example when updating the plan.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            james.lee James Lee added a comment -

            Whilst working on 'Neo', I made changes to avoid using the truncate overwrite pattern when:

            1) Writing archive metadata (including the plan)
            2) When populating the staging directory (multiple readers, one writer)

            I think this is most of the important cases that we needed considering, if we find any more, we should open up specific MBs.

            james.lee James Lee added a comment - Whilst working on 'Neo', I made changes to avoid using the truncate overwrite pattern when: 1) Writing archive metadata (including the plan) 2) When populating the staging directory (multiple readers, one writer) I think this is most of the important cases that we needed considering, if we find any more, we should open up specific MBs.

            People

              james.lee James Lee
              james.lee James Lee
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty