Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/issue 26212 #26213

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -663,7 +663,9 @@ public boolean delete(Data key, CallerProvenance provenance) {
mapDataStore.remove(key, now, null);
}
} else {
return removeRecord(key, record, now, provenance, null) != null;
Object oldValue = removeRecord(key, record, now, provenance, null);
updateStatsOnRemove(now);
return oldValue != null;
}
return false;
}
Expand Down
Expand Up @@ -174,6 +174,24 @@ public void remove_if_same_does_not_update_last_update_time_when_no_matching_val
assertLastUpdateTimeIsNotUpdated(() -> map.remove("key:0", "value:100"));
}

@Test
public void delete_updates_last_update_time() {
for (int i = 0; i < 10; i++) {
map.set("key:" + i, "value:" + i);
}

assertLastUpdateTimeUpdated(() -> map.delete("key:0"));
}

@Test
public void delete_does_not_update_last_update_time_when_no_matching_key() {
for (int i = 0; i < 10; i++) {
map.set("key:" + i, "value:" + i);
}

assertLastUpdateTimeIsNotUpdated(() -> map.delete("key:100"));
}

@Test
public void clear_updates_last_update_time() {
for (int i = 0; i < 10; i++) {
Expand Down