Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODINVSTOR-1277: Delete 6 unused instance database indexes #1101

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## v28.1.0 YYYY-mm-DD
### Breaking changes
* Description ([ISSUE](https://folio-org.atlassian.net/browse/ISSUE))
* Drop CQL array support for `instance identifiers` field ([MODINVSTOR-1277](https://folio-org.atlassian.net/browse/MODINVSTOR-1277))

### New APIs versions
* Provides `API_NAME vX.Y`
Expand All @@ -21,7 +21,7 @@
* Add item barcode right truncation search index ([MODINVSTOR-1292](https://folio-org.atlassian.net/browse/MODINVSTOR-1292))

### Tech Dept
* Description ([ISSUE](https://folio-org.atlassian.net/browse/ISSUE))
* Delete 6 unused instance database indexes ([MODINVSTOR-1277](https://folio-org.atlassian.net/browse/MODINVSTOR-1277))

### Dependencies
* Bump `LIB_NAME` from `OLD_VERSION` to `NEW_VERSION`
Expand Down
23 changes: 2 additions & 21 deletions src/main/java/org/folio/rest/impl/InstanceStorageApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.folio.rest.jaxrs.model.InstanceRelationship;
import org.folio.rest.jaxrs.model.InstanceRelationships;
import org.folio.rest.jaxrs.model.InstanceWithoutPubPeriod;
import org.folio.rest.jaxrs.model.Instances;
import org.folio.rest.jaxrs.model.MarcJson;
import org.folio.rest.jaxrs.model.RetrieveDto;
import org.folio.rest.jaxrs.resource.InstanceStorage;
Expand All @@ -35,8 +34,6 @@
import org.folio.rest.persist.PostgresClient;
import org.folio.rest.persist.cql.CQLWrapper;
import org.folio.rest.support.EndpointFailureHandler;
import org.folio.rest.support.EndpointHandler;
import org.folio.rest.support.GetInstanceStorageInstanceResponse;
import org.folio.rest.tools.messages.MessageConsts;
import org.folio.rest.tools.messages.Messages;
import org.folio.rest.tools.utils.TenantTool;
Expand All @@ -45,7 +42,6 @@

public class InstanceStorageApi implements InstanceStorage {
private static final Logger log = LogManager.getLogger();
private static final String TITLE = "title";
private final Messages messages = Messages.getInstance();

@Validate
Expand Down Expand Up @@ -206,7 +202,7 @@ public void getInstanceStorageInstances(String totalRecords, int offset, int lim
Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {

fetchInstances(query, limit, offset, routingContext, okapiHeaders, asyncResultHandler, vertxContext);
fetchInstances(query, limit, offset, routingContext, okapiHeaders, vertxContext);
}

@Validate
Expand Down Expand Up @@ -390,28 +386,13 @@ public void postInstanceStorageInstancesRetrieve(RetrieveDto entity,
Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
fetchInstances(entity.getQuery(), entity.getLimit(), entity.getOffset(),
routingContext, okapiHeaders, asyncResultHandler, vertxContext);
routingContext, okapiHeaders, vertxContext);
}

private void fetchInstances(String query, int limit, int offset,
RoutingContext routingContext,
Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
if (PgUtil.checkOptimizedCQL(query, TITLE) != null) {
try {
PreparedCql preparedCql = handleCql(query, limit, offset);
PgUtil.getWithOptimizedSql(preparedCql.getTableName(), Instance.class, Instances.class,
TITLE, query, offset, limit,
okapiHeaders, vertxContext, GetInstanceStorageInstanceResponse.class,
EndpointHandler.handleInstances(asyncResultHandler));
} catch (Exception e) {
log.error(e.getMessage(), e);
asyncResultHandler.handle(io.vertx.core.Future.succeededFuture(
GetInstanceStorageInstancesResponse.respond500WithTextPlain(e.getMessage())));
}
return;
}
new InstanceService(vertxContext, okapiHeaders)
.streamGetInstances(INSTANCE_TABLE, query, offset, limit, null, "instances", 0, routingContext);
}
Expand Down
Loading