History log of /Couchbase_NET_Client_v3.0/src/Couchbase/Core/IO/Operations/OperationBase.cs (Results 1 - 25 of 156)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 09cfd8a7 18-Dec-2021 Brant Burnett <bburnett@centeredgesoftware.com>

NCBC-3057: Use correct db.couchbase.service tag values

Motivation
----------
Several outer request spans are not receiving the correct
"db.couchbase.service" tag values per the R

NCBC-3057: Use correct db.couchbase.service tag values

Motivation
----------
Several outer request spans are not receiving the correct
"db.couchbase.service" tag values per the RFC. Additionally, many of
them are inefficient with repeated lowercasing and calls to unwritable
spans.

Modifications
-------------
Use the correct constant values for all service tags.

Wrap multiple SetAttribute calls in a CanWrite check.

Results
-------
No more string allocations on every operation lowercasing the service
value.

All services now use the correct value per the RFC. Search in particular
was way off base.

In cases where a span is not being traced (NoopRequestSpan) we'll avoid
additional CPU cycles on repeated dynamic dispatch to SetAttribute as
well as unnecessary property lookups for the values.

Change-Id: I416a795e09b3a03af6496770f870b0dacda198c9
Reviewed-on: https://review.couchbase.org/c/couchbase-net-client/+/167886
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>

show more ...


Revision tags: 3.2.5, 3.2.5-DI
# eb1c124f 02-Dec-2021 Brant Burnett <bburnett@centeredgesoftware.com>

NCBC-3033: Remove finalizer from OperationBase

Motivation
----------
Objects with finalizers reduce GC performance by pushing objects to
Gen 1 rather than collecting them in Gen

NCBC-3033: Remove finalizer from OperationBase

Motivation
----------
Objects with finalizers reduce GC performance by pushing objects to
Gen 1 rather than collecting them in Gen 0. OperationBase can be managed
without a finalizer.

Modifications
-------------
Remove the finalizer from OperationBase, and go with a simple Dispose
mechanism instead.

Ensure all call sites which create an operation are disposing of the
operation correctly.

Results
-------
For call sites which were not disposing of the operation, the operation
will no longer live on into Gen 1 garbage collection. In cases where
ExtractData() was not called (i.e. error scenarios) the buffer will be
returned to the ArrayPool for reuse much sooner.

For all call sites CPU cycles related to managing the finalizers and the
finalizer queue have been eliminated.

For any call sites which were missed and are still not disposing (there
shouldn't be any, but you never know) there may still be a GC impact.
This is because the buffers in error scenarios will be promoted to at
least Gen 1 and then collected, leaving a hole in the heap eventually
requiring compaction.

Change-Id: I5e7152a644991126dd73425e6d0d14a6f980147e
Reviewed-on: https://review.couchbase.org/c/couchbase-net-client/+/166873
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>

show more ...


# 2f9745bf 16-Dec-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2981: Add timeout_ms to threshold logging report

Motivation
----------
This patch adds the missing timeout_ms attribute to the Span and
therefore the threshold logging repor

NCBC-2981: Add timeout_ms to threshold logging report

Motivation
----------
This patch adds the missing timeout_ms attribute to the Span and
therefore the threshold logging report.

Modifications
-------------
- Move the logic to add the timeout_ms value to the Span from the
OperationConfigurator to just after the read in the operation
completed callback.

Change-Id: Id44464e0a29dd2156a49a15f2ee7e1c46a5e9cfd
Reviewed-on: https://review.couchbase.org/c/couchbase-net-client/+/167728
Reviewed-by: Richard Ponton <richard.ponton@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# 150a9956 14-Dec-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2980: missing server_duration in tracing and reports

Motivation
----------
The server_duration which is the time the server took to complete and
operation should be captured

NCBC-2980: missing server_duration in tracing and reports

Motivation
----------
The server_duration which is the time the server took to complete and
operation should be captured in tracing and made available in the
various reports.

Modification
------------
- Ensure that server_duration is read when returned by the server
- Add the server_duration to the Span

Result
------
The server_duration is now availabe.

Change-Id: Ib5d7a575309ec3f6aa71f5e48f0198efc9da7cbe
Reviewed-on: https://review.couchbase.org/c/couchbase-net-client/+/167597
Reviewed-by: Richard Ponton <richard.ponton@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# b1e9caa3 26-Nov-2021 Brant Burnett <bburnett@centeredgesoftware.com>

NCBC-3023: Apply nullable annotations to serializer/transcoder

Motivation
----------
Any JSON serializer may return null if the value being decoded is null,
even if the type dese

NCBC-3023: Apply nullable annotations to serializer/transcoder

Motivation
----------
Any JSON serializer may return null if the value being decoded is null,
even if the type deserialized is annotated as non-nullable using
nullable reference types. We should annotate our return types correctly
so consumers are warned that they should perform null reference checks
if they have nullable reference types enabled. This also aligns us with
System.Text.Json paradigms.

Modifications
-------------
Annotate serializers, transcoders, and ContentAs methods to indicate
they can accept and return null values. This also includes enabling
nullable reference types for all transcoders.

Add some missing null checks around ITypeTranscoder.Serializer, HTTP
result deserialization, and throughout DataStructures.

Results
-------
Consumers making use of nullable reference types will now be warned
if they fail to null check a deserialization result. Several cases
within the SDK will now throw more meaningful exceptions on a null
deserialization result. We are also better aligned for the eventual
addition of System.Text.Json serialization.

Change-Id: Ia4e7804e1a201659e743f9aaf111ad2abf651017
Reviewed-on: https://review.couchbase.org/c/couchbase-net-client/+/166484
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Richard Ponton <richard.ponton@couchbase.com>

show more ...


Revision tags: 3.2.4, 3.2.3, 3.2.1, 3.2.0
# d8ae00cb 13-Jul-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2829: Enable and collect server duration for tracing

Motivation
----------
Allows for the server duration to be captured if its enabled.

Modifications
-------------

NCBC-2829: Enable and collect server duration for tracing

Motivation
----------
Allows for the server duration to be captured if its enabled.

Modifications
-------------
- If ClusterOptions.EnableOperationDurationTracing is true enable
server duration and log to span for each K/V operation.

Result
------
Server duration is logged if enabled.

Change-Id: I4d3cb93487cbcfd3be75dcf0c351af780811d5d0
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/157460
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


# 3b5648ec 13-Jul-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2853: Ensure FF Maps is only used after a NMVB

Motivation
----------
If a NMVB is returned and a VBucket Fast-Forward is available, then use
it.

Modifications
-

NCBC-2853: Ensure FF Maps is only used after a NMVB

Motivation
----------
If a NMVB is returned and a VBucket Fast-Forward is available, then use
it.

Modifications
-------------
- Add WasNmvb flag to IOperation to check if the status is NMVB
- Change overload of VBucketKeyMapper.MapKey to take a bool that
indicates a NMVB instead of a revision.
- Unit tests

Result
------
If a NMVB is returned and there is a FFMAP it will be used.

Change-Id: I6859d72e289320358d2e4106a8b3e2de0830ad39
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/157446
Reviewed-by: <richard.ponton@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# d6a3e38f 07-Jul-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2856: Add orphaned response logging to SDK

Motivation
----------
Adds Orphaned Response tracing and logging to the SDK.

Modifications
-------------
- Add Orpha

NCBC-2856: Add orphaned response logging to SDK

Motivation
----------
Adds Orphaned Response tracing and logging to the SDK.

Modifications
-------------
- Add OrphanReporter and OrphanTracing classes
- Refactor ThresholdTracer into more generic RequestTracer - add
additional behavior by extending a new TraceListener implementation
- Enable in options
- Add IOperation.LogOrphaned to write a special flag indicating that
the operation is orphaned.

Result
------
If an operation is "orphaned" meaning a reponse is never recieved, it
will be flagged and logged.

Change-Id: I5b4a436de30c8ed4961a5c861b74091f25334785
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/157074
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


Revision tags: 3.1.7, 3.1.5
# 690bf3f2 11-May-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2869: OpenTelemetry tracing module

Motivation
----------
Provides a module for OpenTelemetry tracing.

Modifications
-------------
- Add OpenTelemetryRequestTra

NCBC-2869: OpenTelemetry tracing module

Motivation
----------
Provides a module for OpenTelemetry tracing.

Modifications
-------------
- Add OpenTelemetryRequestTracer
- Add OpenTelemetryRequestSpan

Result
------
Tracing can be exported via any of the OpenTelemetry exporters: ZipKin,
Jaeger, etc.

Change-Id: I5e841d358c101d2e13a335028d5e8cc005b901bd
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/153386
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


# 872ea949 01-Jul-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2916: Add "operation" property to LoggingMeterReport output

Motivation
----------
Reformat the LoggingMeterReport format and allow operations to be split
by opcode.

NCBC-2916: Add "operation" property to LoggingMeterReport output

Motivation
----------
Reformat the LoggingMeterReport format and allow operations to be split
by opcode.

Modifications
-------------
- Add optional tag parameter to allow the service and operation type to
be split into seperate items.

Result
------
Format follows RFC

Change-Id: Iae342c359b51fae342acae5367e9acd1228b16cf
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/156819
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


# 94f26dbc 25-Jun-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2900: LoggingMeter does not include percentile values

Motivation
----------
Fixes a bug where the LoggingMeter does not display the percentile
values.

Modifications

NCBC-2900: LoggingMeter does not include percentile values

Motivation
----------
Fixes a bug where the LoggingMeter does not display the percentile
values.

Modifications
-------------
- Remove dependency on dispatch span for capturing duration and
forwarding it to IValueRecorder. Use a stopwatch instead.
- Add IOperation.StopRecording method for stopping the stopwatch and
recording the elapsed interval.
- Refactor metrics into IRequest and RequestBase
- Remove LoggingMeterOutputFormater

Result
------
Metrics no longer has a dependency on spans.

Change-Id: I38a7bcf6f7fb457fc9737c08eb3bef93c72096ca
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/156498
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


# 6cc88436 23-Jun-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2903: Leftovers from AggregatingMeter to LoggingMeter

Modifications
-------------
Remove any AggregatingMeter references in code or comments from the
project.

Chang

NCBC-2903: Leftovers from AggregatingMeter to LoggingMeter

Modifications
-------------
Remove any AggregatingMeter references in code or comments from the
project.

Change-Id: I710682550fec9858d9d5934fbae66752a44f4ded
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/156371
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>

show more ...


# 8cb06c5a 22-Jun-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2790: Add Support to Preserve TTL

Motivation
----------
Add support for PreserveTtl for server versions (>= 7.0) which support
it.

Modifications
-------------

NCBC-2790: Add Support to Preserve TTL

Motivation
----------
Add support for PreserveTtl for server versions (>= 7.0) which support
it.

Modifications
-------------
- Add PreserveTtl support to Upsert, Replace and MutateIn operations
- Wire up Helo to validate servser support
- Add the framing extras byte to operation if its supported and
requested.
- Add fail-fast in CouchbaseCollection if used and server does not
support.

Result
------
Replace, Upsert and MutateIn support PersistTtl in servers >= 7.0 which
keeps subsequent calls from modifiying the original TTL value on update.

Change-Id: I065f36441e2f0146480bd1eedce9348e450a3873
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/156219
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


Revision tags: 2.7.25
# 9795828f 15-Apr-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2800: Provide Metrics Interface

Motivation
----------
This commit adds the IMeter and IValueRecorder interfaces defined in
RFC#67. It also adds the LoggingMeter implementati

NCBC-2800: Provide Metrics Interface

Motivation
----------
This commit adds the IMeter and IValueRecorder interfaces defined in
RFC#67. It also adds the LoggingMeter implementation of IMeter for
capturing latency metrics.

Modifications
-------------
- Add IMeter and IValueRecorder interfaces.
- Add LoggingMeter implementation and write report to logger
- Integrate into SDK
- Add NoopMeter and NoopValueRecorder to easily disable the meter
- Add IRequestSpan.Duration property to reuse data collected by spans
- Rename tracing imp

Result
------
Every 10s a latency report will be written to file for each service.

Change-Id: I8f8d2d6c0c73952a17f077ab54677bf20ade0786
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/151208
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


# cc7931bf 04-Jun-2021 jeffrymorris <jeffrymorris@gmail.com>

NCBC-2891: Pass 0x0 when default scope/collection is used

Motivation
----------
Fixes a bug where the CID for the default scope/collection is not passed
to the server.

M

NCBC-2891: Pass 0x0 when default scope/collection is used

Motivation
----------
Fixes a bug where the CID for the default scope/collection is not passed
to the server.

Modifications
-------------
Allow the default 0x0 CID to be passed to the server with the operation.

Change-Id: I55bcc0166e614e2b105cc25ee15825046e7a2f02
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/155141
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


# b0a90418 27-May-2021 jeffrymorris <jeffrymorris@gmail.com>

NCBC-2887: Ensure CID value of 0 is not appended to the key

Motivation
----------
Check to see if the default scope/collection is being used and if it,
don't send the CID with th

NCBC-2887: Ensure CID value of 0 is not appended to the key

Motivation
----------
Check to see if the default scope/collection is being used and if it,
don't send the CID with the key as it is not required by the server.

Modifications
--------------
- Check the CID value before doing the Leb128 and adding it to the key

Result
------
Ensure default scope/collection CID is not sent to the server.

Change-Id: Ib49c6b1542194c43ea978d728cc37821649f136b
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/154570
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


Revision tags: 3.1.4, 2.7.24, 3.1.3
# 5c51a3da 23-Feb-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2581: Provide Tracing Interface

Motivation
----------
Provides tracing for the .NET SDK based upon RFC 67 Extended SDK Observability. Also has an implementation of the threshold

NCBC-2581: Provide Tracing Interface

Motivation
----------
Provides tracing for the .NET SDK based upon RFC 67 Extended SDK Observability. Also has an implementation of the threshold logger.

Modifications
-------------
- Add IRequestTracer and IRequestSpan interfaces.
- Add ThresholdRequestTracer and ThresholdRequestSpan impl
- Port ServiceThresholdQueue from earlier impl + additional classes
that can be reused.
- Removed earlier implementation
- Wired up new interfaces to existing tracing scafolding
- Added code spans and attributes defined in RFC
- Added new TraceListener and ThresholdTraceListener impl
- Updated unit tests

Result
------
Tracing now follows tags/attributes and interface definitions defined in
the RFC. Includes Threshold Request Tracing and NoopRequestTracing impl.

Change-Id: If827b7c3eb8d82c8d92aac270439b84038927cc3
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/146769
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: <richard.ponton@couchbase.com>

show more ...


# 2cf4ef09 27-Mar-2021 RiPont <richard.ponton@couchbase.com>

NCBC-2831: Classify MutateIn SubDocumentPath errors properly

Motivation:
SubDocument errors like PathExists were not actually being thrown on MutateIn calls where the sub-document error

NCBC-2831: Classify MutateIn SubDocumentPath errors properly

Motivation:
SubDocument errors like PathExists were not actually being thrown on MutateIn calls where the sub-document error status was in the body of the response instead.

Modifications:
* Added Index and Status properties to SubdocExceptionException
* Various sub-document PathExceptions made descendants of SubdocExceptionException
* ExtractBody promoted to IOperation, rather than just OperationBase
* ResponseStatusExtensions reads body on SubDocMultiPathFailure.
* Tests for SubDoc Path exceptions.

Remarks:
I could have gone further, but chose not to.

Specifically, ResponseStatusExtensions already throws PathTooLongException and others which are probably unreachable from the code as it was before.
However, to preserve backwards compatibility in case those cases actually were being hit, I left those lines in.

Change-Id: I7f928062a13b8079527d2b1067ef4190436c380e
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/150410
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>

show more ...


# bc287781 17-Feb-2021 Jeff Morris <jeffry.morris@couchbase.com>

NCBC-2827: GET_CID and GET_SID do not correctly retry if Scope/Collection not found

Motivation
----------
GetSid and GetCid were defined on the IClusterNode interface and thus
we

NCBC-2827: GET_CID and GET_SID do not correctly retry if Scope/Collection not found

Motivation
----------
GetSid and GetCid were defined on the IClusterNode interface and thus
were not able to be retried. If a collection was updated on the server
this would mean a Collection/ScopeOutdatedException would be thrown.
This fix moves the methods into the Bucket and Scope objects were the
operations can be retried on failure.

Modifications
-------------
- Move GetSid to BucketBase
- Move GetCid to Scope
- Use Bucket.RetryAsync to fire off each operation
- Update ScopeFactory and BucketFactory for tracing and
IOperationConfiguration support
- Make the CollectionNotFoundException and ScopeNotFoundException
implement IRetriable to flag the failure as retriable
- Add IOperation.RequiresVBucketId flag to ensure that operations that
do not require VBucketId's have valid arguments (0)
- Update logic in ClusterNode to assign VBucket id's only if required
for an operation.
- Update unit tests

Result
------
Scope and Collection identifier opperations are now retried if failed
with Scope/Collection not found.

Change-Id: I669edee7bf82072f0242b2f85ba14e561f77433b
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/146271
Reviewed-by: <richard.ponton@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# 1a28374e 04-Feb-2021 Brant Burnett <bburnett@centeredgesoftware.com>

NCBC-2813: Cleanup IOperation and OperationBase code

Motivation
----------
Reduce DLL size, improve performance, and reduce complexity (and
therefore the risk of future bugs).

NCBC-2813: Cleanup IOperation and OperationBase code

Motivation
----------
Reduce DLL size, improve performance, and reduce complexity (and
therefore the risk of future bugs).

Modifications
-------------
Remove members from IOperation and IOperation<T> which are not used via
the interface. Also make properties readonly which are never set via the
interface. Organize members better, add XML doc comments, and enable
nullable reference types.

Remove unused members from OperationBase, and adjust the visibility of
members to be the minimum required. Remove the virtual keyword from
members that are never overridden, and remove no-op overrides from
descendants. Organize the members and add XML doc comments.

Since IRequest.Idempotent and IOperation.IsReadOnly are basically the
same thing, remove the implementation of Idempotent and forward the
requests to IsReadOnly. This also drops a backing field.

Drop backing fields from ClientContextId and Statement, which are never
set on operations.

Drop IsReplicaRead in favor of making ReplicaIdx nullable.

Drop GetResultWithValue returning IOperationResult<T> since every call
site was only reading .Content, which is available directly from
GetValue(). This allowed removing several other supporting methods that
were effectively unused, such as GetMessage() and its supporting
methods.

Drop ErrorMap/ErrorCode handling from reading the operation header, as
this was unused.

Renamed IOperation.GetConfig to ReadConfig to be more clear.

Results
-------
- Smaller DLL due to removed unused code
- There should be a marginal performance gain because OperationBase is
smaller, reducing memory allocations and cost to zero memory
- There should also be a marginal performance gain due to elimating a
few virtual method calls
- The code is much cleaner and easier to understand, which should make
further work in this area easier and less likely to introduce bugs

Change-Id: Ib5836078440e26ba1417efe4b46c95e9b04d1df9
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/145154
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


Revision tags: 3.1.2
# 57844b28 28-Jan-2021 Brant Burnett <bburnett@centeredgesoftware.com>

NCBC-2808: Use ValueTask and IValueTaskSource for OperationBase.Completed

Motivation
----------
Reduce heap allocations for each operation attempt related to the
TaskCompletionSo

NCBC-2808: Use ValueTask and IValueTaskSource for OperationBase.Completed

Motivation
----------
Reduce heap allocations for each operation attempt related to the
TaskCompletionSource and Completed task. We can do this using ValueTask
because Completed is never awaited more than once.

Modifications
-------------
Drop the TaskCompletionSouce from OperationBase, and replace with a
ManualResetValueTaskSource. Return ValueTask for IOperation.Completed
instead of a Task. Use a _completed integer we can swap using
Interlocked.Exchange to emulate TrySetXXX behaviors from TCS.

Results
-------
Allocation of TaskCompleteSource and the Task returned by Completed has
been eliminated (approximately 96 bytes), in exchange for a slightly
larger OperationBase (approximately 50 bytes) that we're already
allocating on the heap. Additionally, there is no allocation on retries.

This is done in exchange for the limitation that the Completion task may
only be awaited once per retry. However, this was already the pattern.

The implementation of ManualResetValueTaskCore is being acquired from
the Microsoft.Bcl.AsyncInterfaces package for .NET Framework and .NET
Core 2.1. Due to being unable to access .NET runtime internals, it will
be slightly less performant on those frameworks. The type is built in to
.NET Core 3.0 and later.

Change-Id: I18171d0d86f13452f300e4029e0661b07425a93a
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/144673
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>

show more ...


Revision tags: 2.7.23
# d9a085c6 02-Jan-2021 Brant Burnett <bburnett@centeredgesoftware.com>

NCBC-2776: Make SlicedMemoryOwner a structure

Motivation
----------
Reduce unnecessary key/value heap allocations.

Modifications
-------------
Rewrote SlicedMemoryOw

NCBC-2776: Make SlicedMemoryOwner a structure

Motivation
----------
Reduce unnecessary key/value heap allocations.

Modifications
-------------
Rewrote SlicedMemoryOwner<T> to be a readonly structure with a default
that is empty. Since the structure is larger than the size of an IntPtr,
mark it as readonly and pass it to methods using `in` parameters (this
avoids the cost of making copies on the stack).

Rework AsyncState completion callbacks to reduce the heap allocations
required building actions, etc. Without this rewrite more allocations
would have been required to create a closure.

Drop the now unnecessary EmptyMemoryOwner class.

Fix a couple of unstable unit tests for channel connection pools.

Results
-------
There are at least 2 fewer heap allocations during the completion of
key/value operations. The Action<object> callback object in async state
is now static, there is no more SlicedMemoryOwner<byte> allocation
during the read of operations on the connection, and for GET operations
there is no second SlicedMemoryOwner<byte> allocation during the call
to OperationBase.ExtractBody.

Change-Id: Ib527bb4416e7dc84e2eca498a50ad5b9d63b8400
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/144346
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>

show more ...


Revision tags: 3.1.1
# fc440704 29-Dec-2020 Brant Burnett <bburnett@centeredgesoftware.com>

NCBC-2722: Refactor K/V cancellation tokens and timeouts

Motivation
----------
Currently, cancellation tokens are registered to set the IOperation to
canceled in multiple spots,

NCBC-2722: Refactor K/V cancellation tokens and timeouts

Motivation
----------
Currently, cancellation tokens are registered to set the IOperation to
canceled in multiple spots, which is inefficient, disorganized, and
causes excess heap allocations.

Additionally, some of the registrations related to bootstrapping are
linked to the CancellationTokenSource of the DataFlowConnectionPool,
preventing garbage collection of the the registrations and the boostrap
operations.

It is also conceivable that a cancellation token from a previous
operation attempt could be triggered while in a subsequent attempt, and
it would then mark the operation cancelled. This probably isn't an issue
now given the retry structure but could cause problems in future design
iterations.

Timeouts are not currently handled in a way that matches the RFC, and
there is some inconsistency in how exceptions are bubbled up for
externally requested cancellations versus timeouts. There is also the
possibility of creating unnecessary ambiguity in mutation state when
requesting external cancellation of a mutation operation.

Modifications
-------------
Change cancellation token logic for sending operations to be defined as
only cancelling the send, not the IOperation. This removes token
registration from both the DataFlowConnectionPool
and OperationBase.SendAsync.

Pass the CancellationToken through to IConnection.SendAsync so the
actual send may be cancelled if it is still queued on the Socket,
rather than only being cancellable while in the connection pool queue.

Instead, register the cancellation token, if any, wherever
IOperation.Completed is being awaited. That way it may dispose of the
registration after the operation is completed, regardless of how it
completes. There are two such locations in ClusterNode and in
SaslMechanismBase.

Make the logic in AsyncState a bit smarter so that it may not be
completed more than once from multiple threads.

For K/V operations, pass CancellationTokenPair from CouchbaseCollection
down the stack through to ClusterNode.ExecuteAsync. This allows smart
behaviors in ClusterNode.ExecuteAsync and RetryOrchestrator so that
internal timeout OperationCanceledExceptions can be differentiated from
exceptions triggered by external cancellation.

Results
-------
Cleaner and easier to understand cancellation logic for operations,
which is also more efficient.

Bootstrap operations aren't left dangling and holding heap space.

Retries won't accidentally get marked cancelled if a previous attempt's
token is cancelled.

Externally requested cancellation will trigger generally bubble up the
OperationCanceledException. However, if a mutation operation has already
been sent on the wire it will instead ignore the cancellation, wait for
the result, and bubble that exception.

Timeout based cancellations will now correctly bubble up Ambiguious or
Unambiguous timeout exceptions based on whether the operation was a
mutation and if the operation has been sent on the wire.

CouchbaseCollection now correctly applies timeouts when an external
cancellation token is supplied. Previously, the external token
superceded timeouts.

Timeout/cancellation behavior: https://gist.github.com/brantburnett/7a562876b1d53015310ce38b69da18d7

Change-Id: Icf181739354409df389f173dc542c663b03d66d0
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/142715
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>

show more ...


# d20a6649 18-Jan-2021 RiPont <richard.ponton@couchbase.com>

NCBC-2796: SUBDOC_MULTI_PATH_DELETED needs to be handled as a success case for tombtones.

Motivation
----------
Transactions relies on correct behavior, here.
When a tombstone is

NCBC-2796: SUBDOC_MULTI_PATH_DELETED needs to be handled as a success case for tombtones.

Motivation
----------
Transactions relies on correct behavior, here.
When a tombstone is fetched with an xattr lookup, but the xattrs are missing, we still want to "successfully" return the fact that this is a tombstone.

Modifications
-------------
* Include SubdocMultiPathFailureDeleted where we're handling SubDocSuccessDeletedDocument
* GetCommandValues() may have no data to parse, so handle that.
* Integration Test to verify fix.

Results
-------
LookupIn on a tombstone with AccessDeleted and a missing xattr returns successfully.

Change-Id: I1700f96c605b2802a6f6f23be94460b43864726d
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/143733
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# 1663c0cc 31-Dec-2020 Brant Burnett <bburnett@centeredgesoftware.com>

NCBC-2774: Make OperationBuilderPool tunable

Motivation
----------
The current implementation of OperationBuilderPool uses set defaults for
the size of the pool. This could be li

NCBC-2774: Make OperationBuilderPool tunable

Motivation
----------
The current implementation of OperationBuilderPool uses set defaults for
the size of the pool. This could be limiting in edge cases where there
is lots of parallelization or lots of very large mutations. We should
make this tunable via configuration for advanced users.

Modifications
-------------
Drop our custom object pool implementation and use the more optimized
Microsoft.Extensions.ObjectPool package developed for ASP.Net Core.
Register this with dependency injection.

Add TuningOptions class underneath ClusterOptions to expose the
configuration settings, and wire these up to the pool via DI.

Inject the operation builder pool into the operation using
OperationConfigurator. Rework SASL bootstrapping operations to also use
the OperationConfigurator, using a custom ITranscoderOverrideOptions
to ensure that LegacyTranscoder is always used as before.

Drop the unnecessary ITypeTranscoder injection from ClusterNode, and
inject the ObjectPool<OperationBuilder> instead so it can be used for
boostrapping operations. This required dropping one last place where
GlobalTranscoder should have been used in GetConfig.

Results
-------
The pool of operation builders should be slightly more performant,
is separate per-cluster rather than global to the application, will be
cleaned up by GC if the cluster is closed rather than live for the app
lifetime, and has tunable configurations for advanced users.

Change-Id: If80c72d51e3b5a49d4261a36263391a776e95ca9
Reviewed-on: http://review.couchbase.org/c/couchbase-net-client/+/142717
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>

show more ...


1234567