Skip to content

Commit

Permalink
fix(lock): ensure that old document fields can be still read...
Browse files Browse the repository at this point in the history
...from older indices if for any reason a lock entry gets stuck
  • Loading branch information
cmark committed Dec 9, 2024
1 parent 390dd2a commit 13be6a6
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import static com.b2international.index.query.Expressions.exactMatch;
import static com.b2international.index.query.Expressions.matchAny;
import static com.google.common.collect.Lists.newArrayList;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
Expand All @@ -30,6 +30,7 @@
import com.b2international.index.migrate.SchemaRevision;
import com.b2international.index.query.Expression;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.google.common.base.MoreObjects;
Expand Down Expand Up @@ -98,7 +99,7 @@ public static class Builder {

private String id;
private String userId;
private List<String> contexts = newArrayList();
private List<String> contexts = new ArrayList<>(2);
private String repositoryId;
private String branchPath;
private Long timestamp;
Expand Down Expand Up @@ -143,6 +144,20 @@ public Builder timestamp(final Long timestamp) {
this.timestamp = timestamp;
return this;
}

@JsonSetter
Builder description(final String description) {
// lock documents with description value should propagate their values to contexts
addContext(description);
return this;
}

@JsonSetter
Builder parentDescription(final String parentDescription) {
// lock documents with a parentDescription value should propagate their values to contexts
addContext(parentDescription);
return this;
}

public DatastoreLockIndexEntry build() {
return new DatastoreLockIndexEntry(id, userId, contexts, repositoryId, branchPath, timestamp);
Expand Down

0 comments on commit 13be6a6

Please sign in to comment.