Skip to content

Conversation

sveniu
Copy link

@sveniu sveniu commented Sep 7, 2025

What does this PR do?

Upgrade Couchbase Server and Sync Gateway to current versions; add a few more metrics.

Motivation

  • Couchbase Server 6.6 was EOL Oct 2023: Remove.
  • Couchbase Server 7.0 and 7.1 were EOL in July 2025: Keep for some backwards compatibility.
  • Couchbase Server 7.2 is EOL July 2026: Add.
  • Couchbase Server 7.6 is EOL March 2027: Add.

This upgrade paves the way for transitioning to Prometheus metrics, which are far more comprehensive than the legacy metrics. I intend to file another PR for that once this one has been accepted, because it's easier to work on that transition without having to deal with the ancient Server version 6.6.

Question: Do I modify the integration's version myself?

Additional implementation details in the commit messages.

CC @tbavelier @FlorentClarret

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

Remove Couchbase version 6.6, which was EOL in Oct 2023.

Add version 7.2 and 7.6, EOL in Jul 2026 and Mar 2027, respectively.

Keep version 7.0 and 7.1, even though they were EOL in July 2025. This
keeps some backwards compatibility, and also reflects Couchbase's own
documentation pages, where 7.0 and 7.1 are still available to browse.

Discontinue the cbdocloader, which is not available in version 7.6.
Instead, use the REST endpoint /sampleBuckets/install.

Remove the expected index stat tag "bucket:cb_bucket", as it is not
present in the index stats for either version. It's not clear how that
ever worked. Instead, rely on the "bucket:gamesim-sample" tag.

Add two index metrics:

```
couchbase.index.avg_array_length
couchbase.index.docid_count
```

These have been around for years since upstream commit 055dff4 [1], and
seem to only conditionally show up if array indexes are used, so they
probably went unnoticed.

[1]: MB-32633: Add new index stats for array index
couchbase/indexing@055dff4
Version 2.8 was EOL in Aug 2023; update to 3.3 with EOL Jul 2028.

A database now has to be created explicitly, so do that in the tests.

Modify the bootstrap parameters to be explicit about disabling TLS in
tests.

Use the recommended metrics port, 4986.

Note the removal of the following metrics, which don't seem to be
present in Sync Gateway 3.3.0, even though the documentation mentions
them:

```
couchbase.sync_gateway.cbl_replication_push.sync_function_count
couchbase.sync_gateway.cbl_replication_push.sync_function_time
couchbase.sync_gateway.database.abandoned_seqs
couchbase.sync_gateway.database.cache_feed.dcp_backfill_completed
couchbase.sync_gateway.database.cache_feed.dcp_backfill_expected
couchbase.sync_gateway.database.cache_feed.dcp_rollback_count
couchbase.sync_gateway.database.import_feed.dcp_backfill_completed
couchbase.sync_gateway.database.import_feed.dcp_backfill_expected
couchbase.sync_gateway.database.import_feed.dcp_rollback_count
```

These were cross-referenced and confirmed to be missing in the actual
code [1], meaning the documentation is quite certainly wrong.

[1]: https://github.com/couchbase/sync_gateway/blob/release/3.3.0/base/stats.go
Copy link

codecov bot commented Sep 7, 2025

Codecov Report

❌ Patch coverage is 81.57895% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.00%. Comparing base (9edf24e) to head (34aaf2b).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Address PR check issues:

```
$ ddev validate metadata couchbase --sync
couchbase: metadata.csv is not sorted by metric name.
Sorting couchbase/metadata.csv by metric names
```

Truncate a description:

```
couchbase:360 `couchbase.sync_gateway.database.sync_function_time`
description exceeds the max length: 400 for descriptions.
```

The sync also updates the CSV schema.
@FlorentClarret
Copy link
Member

👋 thanks for the PR. I asked the team owning this part of the code to have a look

Copy link
Contributor

@AAraKKe AAraKKe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 🥳 !

Just have a small comment about the changelog and a non-blocking question. We can get it out as soon as they are addressed.

@@ -7,10 +7,21 @@ services:
container_name: ${CB_CONTAINER_NAME}
couchbase-sync-gateway:
container_name: couchbase-sync-gateway
image: couchbase/sync-gateway:2.8.3-enterprise
image: couchbase/sync-gateway:3.3.0-enterprise
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking: Is this image valid for all cauchbase versions? Should we have this variable setup in hatch.toml as well? If yes, we might want to have custom commands per gateway version and load them as volumes. I am not sure about this since I am lacking context on Couchbase at the moment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted! I had missed the compatibility matrix. A fix has been pushed that uses Sync Gateway 3.1.0 for Couchbase 7.0, plus conditional handling of the different metrics it exposes.

@@ -0,0 +1 @@
[Couchbase] Upgrade Server and Sync Gateway versions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocking: can we remove the [Couchbase] prefix? This is the changelog for Couchbase which seems to provide all the context we need.

Can we mention in the changelog that we are adding new metrics with som context about what these metrics are?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix pushed. Prefix removed, and additional metrics explained.

As raised in the PR, the version compatibility [1] between Sync Gateway
and Server should be taken into account. Couchbase Server 7.0 needs Sync
Gateway 3.1.0.

There's around 35 more metrics in 3.3.0 vs 3.1.0, so make the testing
for those dependent on version.

Also deal with a version difference for database creation, where 3.1.0's
payload should use num_index_replicas, while 3.3.0 requires
index.num_replicas.

[1]: Couchbase Sync Gateway / Product Notes / Compatibility Matrix:
https://docs.couchbase.com/sync-gateway/current/product-notes/compatibility.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants