Skip to content

Commit

Permalink
MSEARCH-794: fix status setting query
Browse files Browse the repository at this point in the history
  • Loading branch information
mukhiddin-yusuf committed Aug 16, 2024
1 parent 59008c2 commit f9cc57e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private List<MergeRangeEntity> constructRecordMergeRanges(int recordsCount,
List<MergeRangeEntity> ranges = new ArrayList<>();
int pages = (int) Math.ceil((double) recordsCount / rangeSize);
var query = CqlQuery.sortBy(new CqlQuery("cql.allRecords=1"), CqlQueryParam.ID);
var recordIds = inventoryService.fetchInventoryRecordIds(recordType, null, 0, rangeSize);
var recordIds = inventoryService.fetchInventoryRecordIds(recordType, query, 0, rangeSize);
if (CollectionUtils.isEmpty(recordIds)) {
log.warn("There are no records to create merge ranges: [recordType: {}, recordsCount: {}, tenant: {}]",
recordType, recordsCount, tenantId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.folio.search.model.reindex.ReindexStatusEntity;
import org.folio.search.model.types.ReindexEntityType;
import org.folio.search.model.types.ReindexStatus;
import org.folio.spring.FolioExecutionContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Log4j2
@Repository
@RequiredArgsConstructor
public class ReindexStatusRepository {
Expand Down Expand Up @@ -73,6 +75,8 @@ public void setReindexMergeFailed(List<ReindexEntityType> entityTypes) {
var sql = UPDATE_FOR_ENTITIES_SQL.formatted(
fullTableName, "%s = ?, %s = ?".formatted(STATUS_COLUMN, END_TIME_MERGE_COLUMN));

log.info("inTypes: {}", inTypes);
log.info("sql: {}", sql);
jdbcTemplate.update(sql, ReindexStatus.MERGE_FAILED.name(), Timestamp.from(Instant.now()), inTypes);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
<column name="status" type="VARCHAR(20)">
<constraints nullable="false"/>
</column>
<column name="total_merge_ranges" type="int eger"/>
<column name="total_merge_ranges" type="integer"/>
<column name="processed_merge_ranges" type="integer"/>
<column name="total_upload_ranges" type="integer"/>
<column name="processed_upload_ranges" type="integer"/>
Expand Down

0 comments on commit f9cc57e

Please sign in to comment.