Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…rd-storage into MODSOURCE-824

# Conflicts:
#	NEWS.md
  • Loading branch information
VRohach committed Nov 26, 2024
2 parents aafc300 + dd3baed commit b19740d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 202x-xx-xx 5.10.0-SNAPSHOT
* [MODSOURCE-816](https://folio-org.atlassian.net/browse/MODSOURCE-816) [RRT] Optimize execution plan for streaming SQL
* [MODSOURCE-824](https://folio-org.atlassian.net/browse/MODSOURCE-824) Endpoint /batch/parsed-records/fetch does not return deleted records

## 2024-10-28 5.9.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,8 @@ public static Condition filterRecordByUpdatedDateRange(Date updatedAfter, Date u
public static Condition filterRecordByDeleted(Boolean deleted) {
Condition condition = filterRecordByState(RecordState.ACTUAL.name());
if (deleted == null) {
condition = condition.or(filterRecordByState(RecordState.DELETED.name()))
.or(filterRecordByState(RecordState.ACTUAL.name()));
}
if (Boolean.TRUE.equals(deleted)) {
condition = RECORDS_LB.STATE.in(RecordState.ACTUAL, RecordState.DELETED);
} else if (Boolean.TRUE.equals(deleted)) {
condition = condition.or(filterRecordByState(RecordState.DELETED.name()))
.or(filterRecordByState(RecordState.ACTUAL.name()).and(filterRecordByLeaderRecordStatus(DELETED_LEADER_RECORD_STATUS)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@
<include file="scripts/v-5.7.0/2023-08-29--16-00-define-version-column-default-value.xml" relativeToChangelogFile="true"/>
<include file="scripts/v-5.7.0/2023-10-11--16-00-recreate-indexes-on-marc-indexers.xml" relativeToChangelogFile="true"/>

<include file="scripts/v-5.10.0/2024-11-22--16-00-create-indexes-on-marc-indexers-005.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.0.xsd">

<changeSet id="2024-11-22--16-00-create-immutable-to-date-function" author="javokhir_abdullaev">
<createProcedure>
CREATE OR REPLACE FUNCTION ${database.defaultSchemaName}.immutable_to_date(input_text TEXT) RETURNS date AS $$
DECLARE
output_date DATE;
BEGIN
IF input_text ~ '^[0-9]+(\.[0-9]+)?$' THEN
RETURN to_timestamp(input_text::DOUBLE PRECISION / 1000)::date;
ELSE
BEGIN
output_date := to_date(substring(input_text, 1, 8), 'yyyymmdd');
EXCEPTION WHEN others THEN
RETURN NULL;
END;
RETURN output_date;
END IF;
END;
$$ LANGUAGE plpgsql IMMUTABLE;
</createProcedure>
</changeSet>

<changeSet id="2024-11-22--16-01-create-indexes-on-005-partition" author="javokhir_abdullaev">
<sql>
CREATE INDEX idx_records_lb_suppress_discovery ON ${database.defaultSchemaName}.records_lb (suppress_discovery);
CREATE INDEX idx_marc_records_tracking_marc_id_version ON ${database.defaultSchemaName}.marc_records_tracking (marc_id, version);
CREATE INDEX idx_marc_indexers_005_marc_id ON ${database.defaultSchemaName}.marc_indexers_005 (marc_id);
CREATE INDEX idx_marc_indexers_005_value_date ON ${database.defaultSchemaName}.marc_indexers_005 (${database.defaultSchemaName}.immutable_to_date(value));
</sql>
</changeSet>

</databaseChangeLog>

0 comments on commit b19740d

Please sign in to comment.