Fix reindexing issue in broken relationships

This commit is contained in:
mohitdeuex 2023-04-26 01:39:51 +05:30
parent 3af5c4b517
commit e5f6f8a277
3 changed files with 8 additions and 11 deletions

View File

@ -43,7 +43,6 @@ import static org.openmetadata.service.util.EntityUtil.objectMatch;
import static org.openmetadata.service.util.EntityUtil.tagLabelMatch;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.networknt.schema.JsonSchema;
@ -393,7 +392,7 @@ public abstract class EntityRepository<T extends EntityInterface> {
@Transaction
public ResultList<T> listAfterWithSkipFailure(
UriInfo uriInfo, Fields fields, ListFilter filter, int limitParam, String after) throws IOException {
List<T> errors = new ArrayList<>();
List<String> errors = new ArrayList<>();
int total = dao.listCount(filter);
List<T> entities = new ArrayList<>();
if (limitParam > 0) {
@ -406,7 +405,7 @@ public abstract class EntityRepository<T extends EntityInterface> {
entities.add(entity);
} catch (Exception e) {
LOG.error("Failed in Set Fields for Entity with Json : {}", json);
errors.add(JsonUtils.readValue(json, new TypeReference<>() {}));
errors.add(json);
}
}
@ -819,7 +818,7 @@ public abstract class EntityRepository<T extends EntityInterface> {
}
public final ResultList<T> getResultList(
List<T> entities, List<T> errors, String beforeCursor, String afterCursor, int total) {
List<T> entities, List<String> errors, String beforeCursor, String afterCursor, int total) {
return new ResultList<>(entities, errors, beforeCursor, afterCursor, total);
}

View File

@ -36,7 +36,7 @@ public class ResultList<T> {
private Paging paging;
@JsonProperty("errors")
private List<T> errors;
private List<String> errors;
public ResultList() {}
@ -89,7 +89,7 @@ public class ResultList<T> {
.withTotal(total);
}
public ResultList(List<T> data, List<T> errors, String beforeCursor, String afterCursor, int total) {
public ResultList(List<T> data, List<String> errors, String beforeCursor, String afterCursor, int total) {
this.data = data;
this.errors = errors;
paging =
@ -110,12 +110,12 @@ public class ResultList<T> {
}
@JsonProperty("errors")
public List<T> getErrors() {
public List<String> getErrors() {
return errors;
}
@JsonProperty("errors")
public void setErrors(List<T> data) {
public void setErrors(List<String> data) {
this.errors = data;
}

View File

@ -71,9 +71,7 @@ public class PaginatedEntitiesSource implements Source<ResultList<? extends Enti
if (result.getErrors().size() > 0) {
result
.getErrors()
.forEach(
(error) ->
LOG.error("[PaginatedEntitiesSource] Failed in getting Record, RECORD: {}", error.toString()));
.forEach((error) -> LOG.error("[PaginatedEntitiesSource] Failed in getting Record, RECORD: {}", error));
}
LOG.debug(