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

View File

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

View File

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