Skip to content

Commit 87cf079

Browse files
committed
CBD-6348: [BP] Backport changes related to C++20
Backport from trinity Change-Id: I94a93a30236585d4a428d583a602ab2c12d86c35 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/235072 Tested-by: Trond Norbye <[email protected]> Well-Formed: Restriction Checker Reviewed-by: Jim Walker <[email protected]>
1 parent 08d3250 commit 87cf079

File tree

4 files changed

+50
-50
lines changed

4 files changed

+50
-50
lines changed

engines/ep/src/hash_table.cc

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -554,54 +554,6 @@ HashTable::Statistics::StoredValueProperties HashTable::Statistics::prologue(
554554
return StoredValueProperties(v);
555555
}
556556

557-
struct HashTable::Statistics::CacheLocalStatistics {
558-
// Many of these stats should logically be NonNegativeCounters,
559-
// but as they are used inside a LastLevelCacheStore there are
560-
// multiple copies of each stat; one copy _may_ go negative
561-
// even though the sum across cores remains non-negative.
562-
563-
/// Count of alive & deleted, in-memory non-resident and resident
564-
/// items. Excludes temporary and prepared items.
565-
CopyableAtomic<ssize_t> numItems;
566-
567-
/// Count of alive, non-resident items.
568-
CopyableAtomic<ssize_t> numNonResidentItems;
569-
570-
/// Count of deleted items.
571-
CopyableAtomic<ssize_t> numDeletedItems;
572-
573-
/// Count of items where StoredValue::isTempItem() is true.
574-
CopyableAtomic<ssize_t> numTempItems;
575-
576-
/// Count of items where StoredValue resides in system namespace
577-
CopyableAtomic<ssize_t> numSystemItems;
578-
579-
/// Count of items where StoredValue is a prepared SyncWrite.
580-
CopyableAtomic<ssize_t> numPreparedSyncWrites;
581-
582-
/**
583-
* Number of documents of a given datatype. Includes alive
584-
* (non-deleted), committed documents in the HashTable.
585-
* (Prepared documents are not counted).
586-
* For value eviction includes resident & non-resident items (as the
587-
* datatype is part of the metadata), for full-eviction will only
588-
* include resident items.
589-
*/
590-
AtomicDatatypeCombo datatypeCounts = {};
591-
592-
//! Cache size (fixed-length fields in StoredValue + keylen +
593-
//! valuelen).
594-
CopyableAtomic<ssize_t> cacheSize = {};
595-
596-
//! Meta-data size (fixed-length fields in StoredValue + keylen).
597-
CopyableAtomic<ssize_t> metaDataMemory = {};
598-
599-
//! Memory consumed by items in this hashtable.
600-
CopyableAtomic<ssize_t> memSize = {};
601-
602-
/// Memory consumed if the items were uncompressed.
603-
CopyableAtomic<ssize_t> uncompressedMemSize = {};
604-
};
605557

606558
HashTable::Statistics::Statistics(EPStats& epStats) : epStats(epStats) {
607559
}

engines/ep/src/hash_table.h

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,54 @@ class HashTable {
326326
size_t getUncompressedMemSize() const;
327327

328328
private:
329-
struct CacheLocalStatistics;
329+
struct CacheLocalStatistics {
330+
// Many of these stats should logically be NonNegativeCounters,
331+
// but as they are used inside a LastLevelCacheStore there are
332+
// multiple copies of each stat; one copy _may_ go negative
333+
// even though the sum across cores remains non-negative.
334+
335+
/// Count of alive & deleted, in-memory non-resident and resident
336+
/// items. Excludes temporary and prepared items.
337+
CopyableAtomic<ssize_t> numItems;
338+
339+
/// Count of alive, non-resident items.
340+
CopyableAtomic<ssize_t> numNonResidentItems;
341+
342+
/// Count of deleted items.
343+
CopyableAtomic<ssize_t> numDeletedItems;
344+
345+
/// Count of items where StoredValue::isTempItem() is true.
346+
CopyableAtomic<ssize_t> numTempItems;
347+
348+
/// Count of items where StoredValue resides in system namespace
349+
CopyableAtomic<ssize_t> numSystemItems;
350+
351+
/// Count of items where StoredValue is a prepared SyncWrite.
352+
CopyableAtomic<ssize_t> numPreparedSyncWrites;
353+
354+
/**
355+
* Number of documents of a given datatype. Includes alive
356+
* (non-deleted), committed documents in the HashTable.
357+
* (Prepared documents are not counted).
358+
* For value eviction includes resident & non-resident items (as the
359+
* datatype is part of the metadata), for full-eviction will only
360+
* include resident items.
361+
*/
362+
AtomicDatatypeCombo datatypeCounts = {};
363+
364+
//! Cache size (fixed-length fields in StoredValue + keylen +
365+
//! valuelen).
366+
CopyableAtomic<ssize_t> cacheSize = {};
367+
368+
//! Meta-data size (fixed-length fields in StoredValue + keylen).
369+
CopyableAtomic<ssize_t> metaDataMemory = {};
370+
371+
//! Memory consumed by items in this hashtable.
372+
CopyableAtomic<ssize_t> memSize = {};
373+
374+
/// Memory consumed if the items were uncompressed.
375+
CopyableAtomic<ssize_t> uncompressedMemSize = {};
376+
};
330377

331378
LastLevelCacheStore<CacheLocalStatistics> llcLocal;
332379

engines/ep/src/mutation_log.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ MutationLog::~MutationLog() {
323323
}
324324

325325
void MutationLog::disable() {
326-
if (file >= INVALID_FILE_VALUE) {
326+
if (file != INVALID_FILE_VALUE) {
327327
close();
328328
disabled = true;
329329
}

utilities/logtags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
#pragma once
1212

13+
#include <cstdint>
1314
#include <iosfwd>
1415
#include <string>
1516

0 commit comments

Comments
 (0)