Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-1161

DefaultPurgeInterval specified in days and used as though in hours

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 3.0
    • 2.7.0, 2.8.0, 2.7.1, 2.7.2, 2.7.3
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 61
    • 2

    Description

      When starting up, we try to retrieve the purge interval for the bucket (either set at a bucket or cluster level), and if we can't get this due to access we assume a default of 30 days:

      https://github.com/couchbase/sync_gateway/blob/master/db/database.go#L55
      https://github.com/couchbase/sync_gateway/blob/master/db/database.go#L466-L478

      The problem is we define the constant in days (which matches how you define the value in Couchbase Server), however everywhere we use it we treat it as hours:

      https://github.com/couchbase/sync_gateway/blob/master/db/database.go#L919-L922

      This is because when we get the value from Couchbase Server (if we're successful) we immediately munge it to be in hours, and then use this value in everything "Sync Gateway related":

      https://github.com/couchbase/sync_gateway/blob/master/base/bucket_gocb.go#L251-L253

      This should be as simple as adding a * 24 to the constant definition, but I wonder if it makes sense to pass around a time.Duration for all of this instead?

      Marking as critical, as in cases where this happens (which, reasonably will be the default - interval set at 3 days at the cluster level, and no user admin access to see it) we'll see documents prematurely purged from indexes based on this.

      Attachments

        Activity

          People

            sarath.kumarsivan Sarath Kumar Sivan (Inactive)
            James Flather James Flather (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty