Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

Commit

Permalink
workaround for #175 Project not found at startup because maxScan reac…
Browse files Browse the repository at this point in the history
…hed on model mongo queries
  • Loading branch information
Marc Dutoo committed Aug 19, 2016
1 parent 4d51eee commit 4b1faca
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import org.oasis.datacore.core.meta.model.DCModelBase;
import org.oasis.datacore.core.meta.model.DCModelService;
import org.oasis.datacore.core.meta.model.DCResourceField;
import org.oasis.datacore.core.meta.pov.DCProject;
import org.oasis.datacore.core.security.DCUserImpl;
import org.oasis.datacore.core.security.EntityPermissionEvaluator;
import org.oasis.datacore.core.security.service.DatacoreSecurityService;
import org.oasis.datacore.model.resource.ResourceMetamodelIniter;
import org.oasis.datacore.rest.api.DCResource;
import org.oasis.datacore.rest.api.DatacoreApi;
import org.oasis.datacore.rest.server.MonitoringLogServiceImpl;
Expand Down Expand Up @@ -718,7 +720,13 @@ private List<DCEntity> executeMongoDbQuery(Query springMongoQuery,
// (BEWARE it is NOT the max amount of doc returned because sorts or multiple
// criteria can eat some scans)
boolean applyMaxScan = queryParsingContext.isHasNoIndexedField() // true // to test only
|| mgo == mgoManager.getDefaultMongoTemplate(); // else custom secondary
//&& !storageModel.getCollectionName().equals(DCProject.OASIS_META + '.' + ResourceMetamodelIniter.MODEL_MIXIN_NAME) // don't apply
&& !storageModel.getCollectionName().startsWith(DCProject.OASIS_META + '.') // don't apply
// on metamodel ; WORKAROUND FOR #175 Project not found at startup because maxScan reached on model mongo queries
// which is OK because there are not a lot of entities in metamodel.
// Solution : maybe prefix existing indexes ex. _p.dcmo:globalFields.dcmf:name by _b,
// but shouldn't they be used anyway ?
&& mgo == mgoManager.getDefaultMongoTemplate(); // don't apply on custom secondary
int maxScan = 0;
if (applyMaxScan) {
maxScan = this.maxScan;
Expand Down

0 comments on commit 4b1faca

Please sign in to comment.