summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/key_string.h
diff options
context:
space:
mode:
authornehakhatri5 <neha.khatr@mongodb.com>2018-02-22 00:33:13 +1100
committernehakhatri5 <neha.khatr@mongodb.com>2018-03-01 11:52:06 +1100
commit9960da7396adf3a92ac22e3c0fc62be1bc54be91 (patch)
treea383fc314340b3e77ee8f36e8cd41c7ddf6abf40 /src/mongo/db/storage/key_string.h
parent6168a6e7f5586ffc273888bec73b76c1184105bd (diff)
downloadmongo-9960da7396adf3a92ac22e3c0fc62be1bc54be91.tar.gz
SERVER-32822 Support read from unique index with both old and new format entries
During rolling upgrades the existing unique indexes' version would be changed without translating the existing data to the new format. With an index in this state, new data can be inserted in new format. When reading from such an index, use the correct read logic based on the format of the entry being read. In doing so, filter the key from the KeyString to obtain size of the Index Key. Index Key size would indicate that whether the key is old format or new format.
Diffstat (limited to 'src/mongo/db/storage/key_string.h')
-rw-r--r--src/mongo/db/storage/key_string.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/storage/key_string.h b/src/mongo/db/storage/key_string.h
index c0857ca3180..e9ed78a9cf6 100644
--- a/src/mongo/db/storage/key_string.h
+++ b/src/mongo/db/storage/key_string.h
@@ -300,6 +300,10 @@ public:
appendRecordId(rid);
}
+ static size_t getKeySize(const char* buffer,
+ size_t len,
+ Ordering ord,
+ const TypeBits& typeBits);
static BSONObj toBson(StringData data, Ordering ord, const TypeBits& types);
static BSONObj toBson(const char* buffer, size_t len, Ordering ord, const TypeBits& types);