src/replicationthrottle.cc
src/linked_list.cc
src/seqlist.cc
+ src/stats.cc
src/string_utils.cc
src/storeddockey.cc
src/stored-value.cc
meta.first,
meta.second,
mutationResponse->getItem()->getNRUValue(),
- 0);
+ mutationResponse->getCollectionLen());
break;
}
case DcpResponse::Event::Deletion:
mutationResponse->getRevSeqno(),
meta.first,
meta.second,
- 0);
+ mutationResponse->getCollectionLen());
break;
}
case DcpResponse::Event::SnapshotMarker:
const ProcessClock::duration runTime) {
myEngine->getKVBucket()->logRunTime(id, runTime);
}
-
-void EPStats::memAllocated(size_t sz) {
- if (isShutdown) {
- return;
- }
-
- if (localMemCounter.get() == nullptr) {
- // this HAS to be a non-bucket allocation
- // or else the callbacks would try to call this
- // function again & it would become an infinite loop
- SystemAllocationGuard system_alloc_guard;
- localMemCounter.set(new TLMemCounter());
- }
-
- if (0 == sz) {
- return;
- }
-
- localMemCounter.get()->used += sz;
- mergeMemCounter();
-}
-
-void EPStats::memDeallocated(size_t sz) {
- if (isShutdown) {
- return;
- }
-
- if (localMemCounter.get() == nullptr) {
- // this HAS to be a non-bucket allocation
- // or else the callbacks would try to call this
- // function again & it would become an infinite loop
- SystemAllocationGuard system_alloc_guard;
- localMemCounter.set(new TLMemCounter());
- }
-
- if (0 == sz) {
- return;
- }
-
- localMemCounter.get()->used -= sz;
- mergeMemCounter();
-}
-
-void EPStats::mergeMemCounter(bool force) {
- auto& counter = *(localMemCounter.get());
- counter.count++;
- if (force || counter.count % mem_merge_count_threshold == 0 ||
- std::abs(counter.used) > (long)mem_merge_bytes_threshold) {
- totalMemory->fetch_add(counter.used);
- counter.used = 0;
- }
-}
return isDatatypeSupported(cookie, PROTOCOL_BINARY_DATATYPE_XATTR);
}
+ bool isCollectionsSupported(const void* cookie) {
+ EventuallyPersistentEngine* epe =
+ ObjectRegistry::onSwitchThread(NULL, true);
+ bool isSupported = serverApi->cookie->is_collections_supported(cookie);
+ ObjectRegistry::onSwitchThread(epe);
+ return isSupported;
+ }
+
uint8_t getOpcodeIfEwouldblockSet(const void *cookie) {
EventuallyPersistentEngine *epe = ObjectRegistry::onSwitchThread(NULL, true);
uint8_t opcode = serverApi->cookie->get_opcode_if_ewouldblock_set(cookie);
--- /dev/null
+/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ * Copyright 2017 Couchbase, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stats.h"
+
+void EPStats::memAllocated(size_t sz) {
+ if (isShutdown) {
+ return;
+ }
+
+ if (localMemCounter.get() == nullptr) {
+ // this HAS to be a non-bucket allocation
+ // or else the callbacks would try to call this
+ // function again & it would become an infinite loop
+ SystemAllocationGuard system_alloc_guard;
+ localMemCounter.set(new TLMemCounter());
+ }
+
+ if (0 == sz) {
+ return;
+ }
+
+ localMemCounter.get()->used += sz;
+ mergeMemCounter();
+}
+
+void EPStats::memDeallocated(size_t sz) {
+ if (isShutdown) {
+ return;
+ }
+
+ if (localMemCounter.get() == nullptr) {
+ // this HAS to be a non-bucket allocation
+ // or else the callbacks would try to call this
+ // function again & it would become an infinite loop
+ SystemAllocationGuard system_alloc_guard;
+ localMemCounter.set(new TLMemCounter());
+ }
+
+ if (0 == sz) {
+ return;
+ }
+
+ localMemCounter.get()->used -= sz;
+ mergeMemCounter();
+}
+
+void EPStats::mergeMemCounter(bool force) {
+ auto& counter = *(localMemCounter.get());
+ counter.count++;
+ if (force || counter.count % mem_merge_count_threshold == 0 ||
+ std::abs(counter.used) > (long)mem_merge_bytes_threshold) {
+ totalMemory->fetch_add(counter.used);
+ counter.used = 0;
+ }
+}
\ No newline at end of file
uint64_t dcp_last_snap_end_seqno;
uint64_t dcp_last_byseqno;
uint64_t dcp_last_revseqno;
+uint8_t dcp_last_collection_len;
std::string dcp_last_meta;
std::string dcp_last_value;
std::string dcp_last_key;
dcp_last_value.assign(static_cast<const char*>(item->getData()),
item->getNBytes());
dcp_last_nru = nru;
- dcp_last_packet_size = 55 + dcp_last_key.length() +
+
+ // @todo: MB-24391: We are querying the header length with collections
+ // off, which if we extended our testapp tests to do collections may not be
+ // correct. For now collections testing is done via GTEST tests and isn't
+ // reliant on dcp_last_packet_size so this doesn't cause any problems.
+ dcp_last_packet_size =
+ protocol_binary_request_dcp_mutation::getHeaderLength(false);
+ dcp_last_packet_size = dcp_last_packet_size + dcp_last_key.length() +
item->getNBytes() + nmeta;
+
+ dcp_last_collection_len = collectionLen;
if (engine_handle_v1 && engine_handle) {
engine_handle_v1->release(engine_handle, NULL, item);
}
dcp_last_byseqno = by_seqno;
dcp_last_revseqno = rev_seqno;
dcp_last_meta.assign(static_cast<const char*>(meta), nmeta);
- dcp_last_packet_size =
- 42 + dcp_last_key.length() + item->getNBytes() + nmeta;
+
+ // @todo: MB-24391 as above.
+ dcp_last_packet_size = dcp_last_key.length() + item->getNBytes() + nmeta;
+ dcp_last_packet_size +=
+ protocol_binary_request_dcp_deletion::getHeaderLength(false);
+
dcp_last_value.assign(static_cast<const char*>(item->getData()),
item->getNBytes());
+ dcp_last_collection_len = collectionLen;
if (engine_handle_v1 && engine_handle) {
engine_handle_v1->release(engine_handle, nullptr, item);