Skip to content

Commit

Permalink
Remove support for range scan
Browse files Browse the repository at this point in the history
Motivation
----------
The specification for the implementation of range scan has changed
since we implemented it as a part of 2.6.x release. The 2.7.0
release will contain the updated version of range scan. As it has
been marked as volatile in the 2.6 release line we should remove
it from the API.

Changes
-------
Remove range scan from the API.

Change-Id: Id4a63931434261e191bc5f2e47d209b905813806
Reviewed-on: https://review.couchbase.org/c/gocb/+/193088
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Charles Dixon <chvckd@gmail.com>
  • Loading branch information
chvck committed Jun 28, 2023
1 parent da582ed commit 3447d1f
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 1,770 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
devsetup:
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.39.0
go get github.com/vektra/mockery/.../
go get github.com/vektra/mockery/
git submodule update --remote --init --recursive

test:
Expand Down
22 changes: 3 additions & 19 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ type IoConfig struct {

// TimeoutsConfig specifies options for various operation timeouts.
type TimeoutsConfig struct {
ConnectTimeout time.Duration
KVTimeout time.Duration
KVDurableTimeout time.Duration
// Volatile: This option is subject to change at any time.
KVScanTimeout time.Duration
ConnectTimeout time.Duration
KVTimeout time.Duration
KVDurableTimeout time.Duration
ViewTimeout time.Duration
QueryTimeout time.Duration
AnalyticsTimeout time.Duration
Expand Down Expand Up @@ -167,7 +165,6 @@ func clusterFromOptions(opts ClusterOptions) *Cluster {
connectTimeout := 10000 * time.Millisecond
kvTimeout := 2500 * time.Millisecond
kvDurableTimeout := 10000 * time.Millisecond
kvScanTimeout := 10000 * time.Millisecond
viewTimeout := 75000 * time.Millisecond
queryTimeout := 75000 * time.Millisecond
analyticsTimeout := 75000 * time.Millisecond
Expand All @@ -182,9 +179,6 @@ func clusterFromOptions(opts ClusterOptions) *Cluster {
if opts.TimeoutsConfig.KVDurableTimeout > 0 {
kvDurableTimeout = opts.TimeoutsConfig.KVDurableTimeout
}
if opts.TimeoutsConfig.KVScanTimeout > 0 {
kvScanTimeout = opts.TimeoutsConfig.KVScanTimeout
}
if opts.TimeoutsConfig.ViewTimeout > 0 {
viewTimeout = opts.TimeoutsConfig.ViewTimeout
}
Expand Down Expand Up @@ -240,7 +234,6 @@ func clusterFromOptions(opts ClusterOptions) *Cluster {
ViewTimeout: viewTimeout,
KVTimeout: kvTimeout,
KVDurableTimeout: kvDurableTimeout,
KVScanTimeout: kvScanTimeout,
ManagementTimeout: managementTimeout,
},
transcoder: opts.Transcoder,
Expand Down Expand Up @@ -325,15 +318,6 @@ func (c *Cluster) parseExtraConnStrOptions(spec gocbconnstr.ConnSpec) error {
c.timeoutsConfig.KVDurableTimeout = time.Duration(val) * time.Millisecond
}

// Volatile: This option is subject to change at any time.
if valStr, ok := fetchOption("kv_scan_timeout"); ok {
val, err := strconv.ParseInt(valStr, 10, 64)
if err != nil {
return fmt.Errorf("query_timeout option must be a number")
}
c.timeoutsConfig.KVScanTimeout = time.Duration(val) * time.Millisecond
}

if valStr, ok := fetchOption("query_timeout"); ok {
val, err := strconv.ParseInt(valStr, 10, 64)
if err != nil {
Expand Down
27 changes: 23 additions & 4 deletions collection_crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ type kvProvider interface {
Append(opts gocbcore.AdjoinOptions, cb gocbcore.AdjoinCallback) (gocbcore.PendingOp, error)
Prepend(opts gocbcore.AdjoinOptions, cb gocbcore.AdjoinCallback) (gocbcore.PendingOp, error)
WaitForConfigSnapshot(deadline time.Time, opts gocbcore.WaitForConfigSnapshotOptions, cb gocbcore.WaitForConfigSnapshotCallback) (gocbcore.PendingOp, error)
RangeScanCreate(vbID uint16, opts gocbcore.RangeScanCreateOptions, cb gocbcore.RangeScanCreateCallback) (gocbcore.PendingOp, error)
RangeScanContinue(scanUUID []byte, vbID uint16, opts gocbcore.RangeScanContinueOptions, dataCb gocbcore.RangeScanContinueDataCallback,
actionCb gocbcore.RangeScanContinueActionCallback) (gocbcore.PendingOp, error)
RangeScanCancel(scanUUID []byte, vbID uint16, opts gocbcore.RangeScanCancelOptions, cb gocbcore.RangeScanCancelCallback) (gocbcore.PendingOp, error)
}

// Cas represents the specific state of a document on the cluster.
Expand Down Expand Up @@ -1327,3 +1323,26 @@ func (c *Collection) Touch(id string, expiry time.Duration, opts *TouchOptions)
func (c *Collection) Binary() *BinaryCollection {
return &BinaryCollection{collection: c}
}

func (c *Collection) waitForConfigSnapshot(ctx context.Context, deadline time.Time, agent kvProvider) (snapOut *gocbcore.ConfigSnapshot, errOut error) {
if ctx == nil {
ctx = context.Background()
}

opm := newAsyncOpManager(ctx)
err := opm.Wait(agent.WaitForConfigSnapshot(deadline, gocbcore.WaitForConfigSnapshotOptions{}, func(result *gocbcore.WaitForConfigSnapshotResult, err error) {
if err != nil {
errOut = err
opm.Reject()
return
}

snapOut = result.Snapshot
opm.Resolve()
}))
if err != nil {
errOut = err
}

return
}
207 changes: 0 additions & 207 deletions collection_rangescan.go

This file was deleted.

Loading

0 comments on commit 3447d1f

Please sign in to comment.