@@ -223,7 +223,7 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::remove(
223
223
const boost::optional<cb::durability::Requirements>& durability,
224
224
mutation_descr_t & mut_info) {
225
225
return acquireEngine (this )->itemDelete (
226
- cookie, key, cas, vbucket, durability, nullptr , mut_info);
226
+ cookie, key, cas, vbucket, durability, mut_info);
227
227
}
228
228
229
229
void EventuallyPersistentEngine::release (gsl::not_null<item*> itm) {
@@ -2140,23 +2140,27 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::itemDelete(
2140
2140
uint64_t & cas,
2141
2141
Vbid vbucket,
2142
2142
boost::optional<cb::durability::Requirements> durability,
2143
- ItemMetaData* item_meta,
2144
2143
mutation_descr_t & mut_info) {
2145
2144
// Check if this is a in-progress durable delete which has now completed -
2146
2145
// (see 'case EWOULDBLOCK' at the end of this function where we record
2147
2146
// the fact we must block the client until the SycnWrite is durable).
2148
- if (durability && getEngineSpecific (cookie) != nullptr ) {
2149
- // Non-null means this is the second call to this function after
2150
- // the SyncWrite has completed.
2151
- // Clear the engineSpecific, and return SUCCESS.
2152
- storeEngineSpecific (cookie, nullptr );
2153
- // @todo-durability - add support for non-sucesss (e.g. Aborted) when
2154
- // we support non-successful completions of SyncWrites.
2155
- return ENGINE_SUCCESS;
2147
+ if (durability) {
2148
+ void * deletedCas = getEngineSpecific (cookie);
2149
+ if (deletedCas) {
2150
+ // Non-null means this is the second call to this function after
2151
+ // the SyncWrite has completed.
2152
+ // Clear the engineSpecific, and return SUCCESS.
2153
+ storeEngineSpecific (cookie, nullptr );
2154
+
2155
+ cas = reinterpret_cast <uint64_t >(deletedCas);
2156
+ // @todo-durability - add support for non-sucesss (e.g. Aborted)
2157
+ // when we support non-successful completions of SyncWrites.
2158
+ return ENGINE_SUCCESS;
2159
+ }
2156
2160
}
2157
2161
2158
2162
ENGINE_ERROR_CODE ret = kvBucket->deleteItem (
2159
- key, cas, vbucket, cookie, durability, item_meta , mut_info);
2163
+ key, cas, vbucket, cookie, durability, nullptr , mut_info);
2160
2164
2161
2165
switch (ret) {
2162
2166
case ENGINE_KEY_ENOENT:
@@ -2174,7 +2178,7 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::itemDelete(
2174
2178
// the result of the SyncWrite (see call to getEngineSpecific at
2175
2179
// the head of this function).
2176
2180
// (just store non-null value to indicate this).
2177
- storeEngineSpecific (cookie, reinterpret_cast <void *>(0x1 ));
2181
+ storeEngineSpecific (cookie, reinterpret_cast <void *>(cas ));
2178
2182
}
2179
2183
break ;
2180
2184
0 commit comments