Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine MutationStore2, Collection, DataStoreName into DataStore #6752

Merged
merged 3 commits into from
Apr 4, 2024

Conversation

torcolvin
Copy link
Collaborator

@torcolvin torcolvin commented Apr 1, 2024

This is cleanup from the introduction to rosmar.

  • rosmar.Collection and Collection already satisified the DataStoreName interface, so putting it as part of DataStore removes need for AsDataStoreName checks.

  • remove GetFeedType() checks since it will always return DCP

  • Remove StartTapFeed from leaky bucket because it was not being used. TestStopChangeCache was only running with xattrs disabled, but the test would pass even if the events arrived out of order, so the leaky bucket tap code was not being executed.

  • Reflect in documentation that DCP feed is always used.

I could leave the code from the leaky bucket tap feed to resurrect it when we need it, it did "work" in rosmar but it wasn't testing anything. I think knowing that it exists to look back at the implementation when it is needed is important, especially since it does not necessarily do what it claims to do.

couchbaselabs/rosmar#30
couchbase/sg-bucket#119

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Dependencies (if applicable)

  • Link upstream PRs
  • Update Go module dependencies when merged

Integration Tests

Copy link

github-actions bot commented Apr 1, 2024

Redocly previews

This is cleanup from the introduction to rosmar.

- rosmar.Collection and Collection already satisified the DataStoreName
interface, so putting it as part of DataStore removes need for
AsDataStoreName checks.
- remove GetFeedType() checks since it will always return DCP

- Remove StartTapFeed from leaky bucket because it was not being used.
  TestStopChangeCache was only running with xattrs disabled, but the
  test would pass even if the events arrived out of order, so the leaky
  bucket tap code was not being executed.
- Reflect in documentation that DCP feed is always used.
Copy link
Collaborator

@adamcfraser adamcfraser left a comment

Choose a reason for hiding this comment

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

A few questions about the tap-specific functionality being removed.

// will be filtered such that only the _latest_ mutation will make it through.
TapFeedDeDuplication bool
TapFeedVbuckets bool // Emulate vbucket numbers on feed
TapFeedMissingDocs []string // Emulate entry not appearing on tap feed
Copy link
Collaborator

Choose a reason for hiding this comment

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

TapFeedMissingDocs doesn't seem like tap vs. DCP functionality, it's more about tests having the ability to simulate a document not arriving over the feed. I understand we don't have any real test usage of this today - are you thinking we'd just rebuild if/when it's needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking we'd rebuild it when we needed it. I'm OK leaving this code in, and I think that it could be used to build artificial DCP feeds.

@@ -1299,44 +1299,6 @@ func TestChannelRace(t *testing.T) {
changesCtxCancel()
}

// Test that housekeeping goroutines get terminated when change cache is stopped
func TestStopChangeCache(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a valid test case - do you think this scenario has coverage elsewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that the test code can be left in, but it wasn't using the leaky tap feed. I am happy to do that.

@@ -278,15 +244,6 @@ func (listener *changeListener) NotifyCheckForTermination(ctx context.Context, k
listener.tapNotifier.L.Unlock()
}

func (listener *changeListener) notifyStopping(ctx context.Context) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't seem like it should be tap-specific. Are we sure it's not an oversight that we don't handle this in the DCP case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I also wondered about this if there is a latent bug here (this code is unused). I think can affect things like the change feed not exiting because nothing goes to wake up the sync.Cond - so in changes.go changeWaiter.Wait() may not get woken up.

This code is not used today though.

@@ -1273,7 +1273,7 @@ Database:
db_state_changed:
$ref: '#/Event-config'
feed_type:
description: The type of feed to use to communicate with Couchbase Server.
description: The type of feed to use to communicate with Couchbase Server. This will use DCP regardless of specification.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we required to keep TAP in the enum for backward compatibility, or could it be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can definitely just remove this.

@torcolvin torcolvin assigned adamcfraser and unassigned torcolvin Apr 4, 2024
@adamcfraser adamcfraser merged commit a9811cd into master Apr 4, 2024
20 checks passed
@adamcfraser adamcfraser deleted the simplify_interfaces branch April 4, 2024 23:39
bbrks pushed a commit that referenced this pull request Apr 5, 2024
* Combine MutationStore2, Collection, DataStoreName into DataStore

This is cleanup from the introduction to rosmar.

- rosmar.Collection and Collection already satisified the DataStoreName
interface, so putting it as part of DataStore removes need for
AsDataStoreName checks.
- remove GetFeedType() checks since it will always return DCP

- Remove StartTapFeed from leaky bucket because it was not being used.
  TestStopChangeCache was only running with xattrs disabled, but the
  test would pass even if the events arrived out of order, so the leaky
  bucket tap code was not being executed.
- Reflect in documentation that DCP feed is always used.

* Replace leaky bucket code for DCPMissingDocs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants