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 Indexing of lastUpdated for Deleted Resources #469

Merged
merged 1 commit into from
Sep 7, 2021

Conversation

alexanderkiel
Copy link
Member

When deleting a resource, a resource content with type and id only was
stored and indexed. However, because the lastUpdated timestamp is not
part of the resource content, it was associated to the resource content
before indexing. So the lastUpdate timestamp was indexed even for the
deleted version of a resource, so that a search for _lastUpdated found
that version and returned it as match in results.

This patch completely omits storing and indexing of deleted resource
contents and uses the hash consisting of all zero bytes for the
resource handle. Pulling such a deleted resource handle will return a
resource content consisting of type and id only immediately.

@codecov
Copy link

codecov bot commented Sep 7, 2021

Codecov Report

Merging #469 (0eb286a) into develop (7e257b4) will increase coverage by 0.06%.
The diff coverage is 95.89%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #469      +/-   ##
===========================================
+ Coverage    91.55%   91.62%   +0.06%     
===========================================
  Files          230      231       +1     
  Lines        13392    13407      +15     
  Branches       440      440              
===========================================
+ Hits         12261    12284      +23     
+ Misses         691      683       -8     
  Partials       440      440              
Impacted Files Coverage Δ
modules/db-tx-log/src/blaze/db/tx_log/spec.clj 86.20% <ø> (ø)
modules/db/src/blaze/db/impl/codec.clj 99.44% <ø> (+0.54%) ⬆️
...odules/fhir-structure/src/blaze/fhir/hash/spec.clj 85.71% <80.00%> (+19.04%) ⬆️
...b-tx-log-kafka/src/blaze/db/tx_log/kafka/codec.clj 90.90% <90.90%> (ø)
...ules/db-tx-log-kafka/src/blaze/db/tx_log/kafka.clj 97.33% <100.00%> (+9.16%) ⬆️
...b/src/blaze/db/impl/index/compartment/resource.clj 100.00% <100.00%> (ø)
modules/db/src/blaze/db/node.clj 94.78% <100.00%> (+0.02%) ⬆️
modules/db/src/blaze/db/node/resource_indexer.clj 94.59% <100.00%> (+0.84%) ⬆️
modules/db/src/blaze/db/node/transaction.clj 100.00% <100.00%> (ø)
modules/db/src/blaze/db/node/tx_indexer/verify.clj 98.20% <100.00%> (+0.02%) ⬆️
... and 2 more

@alexanderkiel alexanderkiel force-pushed the fix-lastupdated branch 2 times, most recently from 83ed850 to 5256c4e Compare September 7, 2021 12:53
When deleting a resource, a resource content with type and id only was
stored and indexed. However, because the lastUpdated timestamp is not
part of the resource content, it was associated to the resource content
before indexing. So the lastUpdate timestamp was indexed even for the
deleted version of a resource, so that a search for _lastUpdated found
that version and returned it as match in results.

This patch completely omits storing and indexing of deleted resource
contents and uses the hash consisting of all zero bytes for the
resource handle. Pulling such a deleted resource handle will return a
resource content consisting of type and id only immediately.
@alexanderkiel alexanderkiel merged commit 92a811c into develop Sep 7, 2021
@alexanderkiel alexanderkiel deleted the fix-lastupdated branch September 7, 2021 13:30
alexanderkiel added a commit that referenced this pull request Sep 19, 2021
Introduced in #469 we have no longer hashed in the delete command.
However, in the local transaction log implementation, we still try to
decode the hash. This fix has to be merged into the 0.12.0 release
branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant