Skip to content

Commit 653d919

Browse files
Revert "Fix data race in CouchKVStore stats access"
(as this breaks windows: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\vector(1708) : error C2558: class 'Couchbase::RelaxedAtomic<uint64_t>' : no copy constructor available or copy constructor is declared 'explicit') This reverts commit a847eb3. Change-Id: I05c57a1be697c50f4ae091e277c684bc2f8afdd5 Reviewed-on: http://review.couchbase.org/55887 Reviewed-by: abhinav dangeti <[email protected]> Tested-by: abhinav dangeti <[email protected]>
1 parent 86e3309 commit 653d919

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

src/couch-kvstore/couch-kvstore.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,9 @@ CouchKVStore::CouchKVStore(KVStoreConfig &config, bool read_only) :
281281

282282
// pre-allocate lookup maps (vectors) given we have a relatively
283283
// small, fixed number of vBuckets.
284-
dbFileRevMap.assign(numDbFiles, Couchbase::RelaxedAtomic<uint64_t>(1));
285-
cachedDocCount.assign(numDbFiles, Couchbase::RelaxedAtomic<size_t>(-1));
286-
cachedDeleteCount.assign(numDbFiles, Couchbase::RelaxedAtomic<size_t>(-1));
284+
dbFileRevMap.assign(numDbFiles, 1);
285+
cachedDocCount.assign(numDbFiles, -1);
286+
cachedDeleteCount.assign(numDbFiles, -1);
287287
cachedVBStates.assign(numDbFiles, nullptr);
288288

289289
initialize();

src/couch-kvstore/couch-kvstore.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
#include "config.h"
2222
#include "libcouchstore/couch_db.h"
23-
#include <relaxed_atomic.h>
2423

2524
#include <map>
2625
#include <string>
@@ -528,26 +527,19 @@ class CouchKVStore : public KVStore
528527
void removeCompactFile(const std::string &filename);
529528

530529
const std::string dbname;
531-
532-
// Map of the fileRev for each vBucket. Using RelaxedAtomic so
533-
// stats gathering (doDcpVbTakeoverStats) can get a snapshot
534-
// without having to lock.
535-
std::vector<Couchbase::RelaxedAtomic<uint64_t>> dbFileRevMap;
536-
530+
std::vector<uint64_t>dbFileRevMap;
537531
uint16_t numDbFiles;
538532
std::vector<CouchRequest *> pendingReqsQ;
539533
bool intransaction;
540534

541535
/* all stats */
542536
CouchKVStoreStats st;
543537
couch_file_ops statCollectingFileOps;
544-
/* deleted docs in each file, indexed by vBucket. RelaxedAtomic
545-
to allow stats access witout lock */
546-
std::vector<Couchbase::RelaxedAtomic<size_t>> cachedDeleteCount;
538+
/* deleted docs in each file, indexed by vBucket */
539+
std::vector<size_t> cachedDeleteCount;
547540

548-
/* non-deleted docs in each file, indexed by vBucket.
549-
RelaxedAtomic to allow stats access witout lock. */
550-
std::vector<Couchbase::RelaxedAtomic<size_t>> cachedDocCount;
541+
/* non-deleted docs in each file, indexed by vBucket */
542+
std::vector<size_t> cachedDocCount;
551543

552544
/* pending file deletions */
553545
AtomicQueue<std::string> pendingFileDeletions;

0 commit comments

Comments
 (0)