Liran Zelkha has posted comments on this change.

Change subject: core: Improve Dynamic Query SQL generator
......................................................................


Patch Set 12:

(10 comments)

http://gerrit.ovirt.org/#/c/28135/12/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/SearchQueryTest.java
File 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/SearchQueryTest.java:

Line 66:         final StoragePoolDAO storagePoolDAO = 
Mockito.mock(StoragePoolDAO.class);
Line 67:         final GlusterVolumeDao glusterVolumeDao = 
Mockito.mock(GlusterVolumeDao.class);
Line 68:         final NetworkViewDao networkViewDao = 
Mockito.mock(NetworkViewDao.class);
Line 69:         final DbEngineDialect dbEngineDialect = 
Mockito.mock(DbEngineDialect.class);
Line 70:         final DbFacade facadeMock = new DbFacade() {
> build is broken in this file and this line.
Done
Line 71:             @Override
Line 72:             public DiskDao getDiskDao() {
Line 73:                 return diskDao;
Line 74:             }


http://gerrit.ovirt.org/#/c/28135/12/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SearchObjectAutoCompleter.java
File 
backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SearchObjectAutoCompleter.java:

Line 80:         // vds - storage domain
Line 81:         addJoin(SearchObjects.VDS_OBJ_NAME,
Line 82:                 "storage_pool_id",
Line 83:                 SearchObjects.VDC_STORAGE_DOMAIN_OBJ_NAME,
Line 84:                 "storage_pool_id");
> Just curios, is that a bug-fix, or an optimization?
Bug fix for the optimization. There's some mixup in the views between 
storage_id and storage_pool_id.
Line 85: 
Line 86:         // cluster - storage domain
Line 87:         addJoin(SearchObjects.VDC_CLUSTER_OBJ_NAME, "storage_id", 
SearchObjects.VDC_STORAGE_DOMAIN_OBJ_NAME, "id");
Line 88: 


Line 387:     }
Line 388: 
Line 389:     public String getInnerJoin(String searchObj, String crossRefObj, 
boolean useTags) {
Line 390:         final String[] joinKey = 
mJoinDictionary.get(StringFormat.format("%1$s.%2$s", searchObj, crossRefObj));
Line 391:         final String crossRefTable = getRelatedTableName(crossRefObj, 
true);
> useTags isn't relevant here? it should always be true?
Done
Line 392:         final String searchObjTable = getRelatedTableName(searchObj, 
useTags);
Line 393: 
Line 394:         return StringFormat.format(" LEFT OUTER JOIN %3$s ON 
%1$s.%2$s=%3$s.%4$s ", searchObjTable, joinKey[0],
Line 395:                 crossRefTable, joinKey[1]);


Line 414:         if (useTags) {
Line 415:             return getRelatedTableName(obj);
Line 416:         }
Line 417: 
Line 418:         return getRelatedTableNameWithOutTags(obj);
> s/WithOut/Without
Done
Line 419:     }
Line 420: 
Line 421:     private String getRelatedTableNameWithOutTags(String obj) {
Line 422:         if (obj == null) {


http://gerrit.ovirt.org/#/c/28135/12/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/StorageDomainFieldAutoCompleter.java
File 
backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/StorageDomainFieldAutoCompleter.java:

Line 43: 
Line 44:         // building the ColumnName Dict
Line 45:         columnNameDict.put(NAME, "storage_name");
Line 46:         columnNameDict.put(STATUS, "storage_domain_shared_status");
Line 47:         columnNameDict.put(DATACENTER, "storage_pool_name::text");
> why did you specify here ::text? due to casting?
For some reason in the database it is defined as "unknown", hence we need the 
cast :-(
Line 48:         columnNameDict.put(TYPE, "storage_type");
Line 49:         columnNameDict.put(SIZE, "available_disk_size");
Line 50:         columnNameDict.put(USED, "used_disk_size");
Line 51:         columnNameDict.put(COMMITTED, "commited_disk_size");


http://gerrit.ovirt.org/#/c/28135/12/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxChecker.java
File 
backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxChecker.java:

Line 860: 
Line 861:             // Add special handling (not deleted) to event searches
Line 862:             if (searchObjStr.equalsIgnoreCase("EVENT")) {
Line 863:                 whereBuilder.add("not deleted");
Line 864:             }
> not sure I understand this special treatment.
Done
Line 865: 
Line 866:             // adding WHERE if required and All implicit AND
Line 867:             StringBuilder wherePhrase = new StringBuilder();
Line 868:             if (whereBuilder.size() > 0) {


Line 860: 
Line 861:             // Add special handling (not deleted) to event searches
Line 862:             if (searchObjStr.equalsIgnoreCase("EVENT")) {
Line 863:                 whereBuilder.add("not deleted");
Line 864:             }
> Oved, we keep in the table of events events that are also deleted, but UI s
>From DB perspective, will be the same. And then it's just one more view to 
>maintain. I prefer to keep it this way. We have a view inflation as it is.
Line 865: 
Line 866:             // adding WHERE if required and All implicit AND
Line 867:             StringBuilder wherePhrase = new StringBuilder();
Line 868:             if (whereBuilder.size() > 0) {


Line 1111: 
Line 1112:         String tableName;
Line 1113: 
Line 1114:         // We will take the table with tags for all subtables
Line 1115:         // TODO: Optimize this
> what about this TODO, is should be done or omitted from the final patch
Only in a future patch, so I thought to leave it here for the next patch. It's 
much more tedious and dangerous change
Line 1116:         if (conditionType == ConditionType.ConditionwithSpesificObj) 
{
Line 1117:             tableName = mSearchObjectAC.getRelatedTableName(objName, 
true);
Line 1118:         } else {
Line 1119:             tableName = mSearchObjectAC.getRelatedTableName(objName, 
fieldName);


Line 1113: 
Line 1114:         // We will take the table with tags for all subtables
Line 1115:         // TODO: Optimize this
Line 1116:         if (conditionType == ConditionType.ConditionwithSpesificObj) 
{
Line 1117:             tableName = mSearchObjectAC.getRelatedTableName(objName, 
true);
> same here. is it always true?
Yes - this is the optimization TODO remark
Line 1118:         } else {
Line 1119:             tableName = mSearchObjectAC.getRelatedTableName(objName, 
fieldName);
Line 1120:         }
Line 1121:         if (customizedRelation.equalsIgnoreCase("LIKE") || 
customizedRelation.equalsIgnoreCase("ILIKE")) {


http://gerrit.ovirt.org/#/c/28135/12/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxContainer.java
File 
backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxContainer.java:

Line 19:     private int privateMaxCount;
Line 20:     private long searchFrom = 0;
Line 21:     private boolean caseSensitive=true;
Line 22: 
Line 23:     public boolean isTags() {
> Please rename to something more meaningful 
Done
Line 24:         return mOrigText.contains("tag")
Line 25:                 || (getSearchObjectStr() != null && 
(getSearchObjectStr().equals(SearchObjects.VDC_USER_OBJ_NAME)))
Line 26:                 || 
(getCrossRefObjList().contains(SearchObjects.VDC_STORAGE_DOMAIN_OBJ_NAME) && 
(getSearchObjectStr() == null || 
!getSearchObjectStr().equals(SearchObjects.VDS_OBJ_NAME)));
Line 27:     }


-- 
To view, visit http://gerrit.ovirt.org/28135
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I862873171c6753f8c8863c10c336e981e39dc8cb
Gerrit-PatchSet: 12
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liran Zelkha <lzel...@redhat.com>
Gerrit-Reviewer: Barak Azulay <bazu...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Liran Zelkha <lzel...@redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to