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

cbbackupmgr backup range arguments accept invalid values

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.0.0
    • 6.5.1, 6.6.0, 6.5.0
    • tools
    • Untriaged
    • 1
    • Unknown

    Description

      What's the issue?
      The code which parses the users given backup, date range or backup indices doesn't detect if:
      1) The request backup doesn't exist
      2) Whether the pair range is invalid (broad terms). It doesn't assert that it's length is 2 and doesn't contain any empty strings e.g. '2020,' would produce '["2020", ""]' which is invalid.
      3) The 'end' keyword (which translates to the final backup) is using the wrong index in the existing backups list ('end'/'start' were both missed in the unit testing)
      4) Indexes accepted are zero indexed, they should be non-zero indexed (to match the rest of cbbackupmgr).

      What does this affect?
      1) Merge when using the '--date-range' flag, the '--start' and '--end' flags remain unaffected
      2) Remove when using the '--backups' flag
      3) Examine when using the '--backups' flag (6.6.0 Only)

      What's the fix?
      We should fix, and add any missing unit testing to the backup range (filtering) functions so check all the above cases and any others which might be invalid. We should then ensure that all the backups use a common function to filter/select a range of backups to avoid duplication and diverging behavior across sub-commands. To highlight why this is an issue:
      1) Restore accepts 'start' and 'end' flag where you may supply the keyword 'start' or 'end'
      2) Merge requires a 'start' and 'end' flag to be supplied where you may supply the keyword 'oldest' or 'latest'. It also accepts a '--datarange' flag.
      3) These keywords are not interchangeable e.g. you can't supply 'start' or 'end' for merge or vice versa
      4) restore, merge, remove and examine all accept indexes, however, examine and remove are zero indexed; restore, merge are not
      5) merge, remove and examine both accept short dates in the format 'day-month-year' but restore does not

      Why should this be release tagged?
      Part of this fix is to unify cbbackupmgrs backup range arguments, this includes how it accepts indexes. This means that:
      1) Examines '--backups' flag will now be non-zero indexed
      2) Removes '--backups' flag will now be non-zero indexed
      3) Merges '--date-range' flag will now be non-zero indexed

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  PagerDuty