Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Read current vb state only if local doc exists

When setting new vbucket state of a vbucket, read exisiting
vbucket state only if the database file for the vbucket exists

Change-Id: I3cfef8f353c42c0adcfe669d47307f6f5fd0f1d5
Reviewed-on: http://review.couchbase.org/15689
Tested-by: Jin Lim <jin@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
  • Loading branch information...
commit 99e5fa6b97bdc075a10e5c58b65294b7ff404488 1 parent 3257d36
@jinlim jinlim authored chiyoung committed
Showing with 8 additions and 3 deletions.
  1. +8 −3 couch-kvstore/couch-kvstore.cc
View
11 couch-kvstore/couch-kvstore.cc
@@ -596,6 +596,7 @@ bool CouchKVStore::setVBucketState(uint16_t vbucketId, vbucket_state_t state,
rev = checkNewRevNum(dbFileName, true);
if (rev == 0) {
fileRev = 1;
+ newfile = true;
} else {
fileRev = rev;
}
@@ -621,10 +622,14 @@ bool CouchKVStore::setVBucketState(uint16_t vbucketId, vbucket_state_t state,
}
fileRev = newFileRev;
- // first get current max_deleted_seq before updating
- // local doc (vbstate)
+ // if not newly created file, get current max_deleted_seq number
+ // first from the local doc before updating it
vbucket_state vbState;
- readVBState(db, vbucketId, vbState);
+ if (newfile) {
+ vbState.maxDeletedSeqno = 0;
+ } else {
+ readVBState(db, vbucketId, vbState);
+ }
// update local doc with new state & checkpointId
vbState.state = state;
Please sign in to comment.
Something went wrong with that request. Please try again.