@@ -223,7 +223,7 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::remove(
223223 const boost::optional<cb::durability::Requirements>& durability,
224224 mutation_descr_t & mut_info) {
225225 return acquireEngine (this )->itemDelete (
226- cookie, key, cas, vbucket, durability, nullptr , mut_info);
226+ cookie, key, cas, vbucket, durability, mut_info);
227227}
228228
229229void EventuallyPersistentEngine::release (gsl::not_null<item*> itm) {
@@ -2140,23 +2140,27 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::itemDelete(
21402140 uint64_t & cas,
21412141 Vbid vbucket,
21422142 boost::optional<cb::durability::Requirements> durability,
2143- ItemMetaData* item_meta,
21442143 mutation_descr_t & mut_info) {
21452144 // Check if this is a in-progress durable delete which has now completed -
21462145 // (see 'case EWOULDBLOCK' at the end of this function where we record
21472146 // 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+ }
21562160 }
21572161
21582162 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);
21602164
21612165 switch (ret) {
21622166 case ENGINE_KEY_ENOENT:
@@ -2174,7 +2178,7 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::itemDelete(
21742178 // the result of the SyncWrite (see call to getEngineSpecific at
21752179 // the head of this function).
21762180 // (just store non-null value to indicate this).
2177- storeEngineSpecific (cookie, reinterpret_cast <void *>(0x1 ));
2181+ storeEngineSpecific (cookie, reinterpret_cast <void *>(cas ));
21782182 }
21792183 break ;
21802184
0 commit comments