Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 189030

Summary: DBSimpleSearchCommand is hard coded to only support CBE model
Product: z_Archived Reporter: Joe Toomey <jptoomey>
Component: TPTPAssignee: Joe Toomey <jptoomey>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P1 CC: jkubasta, paulslau, slavescu
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch with partial fix, the container is not set yet none

Description Joe Toomey CLA 2007-05-24 17:02:44 EDT
I am trying to get some basic benchmarking numbers to validate our post 4.4 approach of using large resource support to achieve scalability for the test log model.  The code that I wrote in 4.4 to make the test log viewer query based does not work when I add back in the DB support code because the queries generated by the DBSimpleSearchCommand assume the CBE model.

The following code is being used to create a verdict based query:

		SimpleSearchQuery verdictQuery = ExtensionsFactory.eINSTANCE.createSimpleSearchQuery();
		verdictQuery.getSources().add(EcoreUtil.getURI(result).toString());

		// Minimum paths required to traverse the complete execution history.
		verdictQuery.getRequiredPaths().add(Common_TestprofilePackage.eINSTANCE.getTPFExecutionResult_ExecutionHistory());
		verdictQuery.getRequiredPaths().add(Common_TestprofilePackage.eINSTANCE.getTPFExecutionHistory_ExecutionEvents());
		verdictQuery.getRequiredPaths().add(Common_TestprofilePackage.eINSTANCE.getTPFExecutionEvent_Children());
		verdictQuery.getRequiredPaths().add(Common_TestprofilePackage.eINSTANCE.getTPFInvocationEvent_InvokedExecutionResult());

		SimpleOperand Operand = ExtensionsFactory.eINSTANCE.createSimpleOperand();
		Operand.setType(Common_TestprofilePackage.eINSTANCE.getTPFVerdictEvent());
		verdictQuery.getOutputElements().add(Operand);
		
		LogicalExpression whereExpression = createORExpression();

		if (verdict != null) {
			BinaryExpression verdictTypeFilter = createBinaryExpression(Common_TestprofilePackage.eINSTANCE.getTPFVerdictEvent_Verdict(), Common_TestprofilePackage.eINSTANCE.getTPFVerdictEvent_Verdict().getEAttributeType(), verdict);		
			whereExpression.getArguments().add(verdictTypeFilter);
		}
				
		verdictQuery.setWhereExpression(whereExpression);
		
		QueryResult queryResult = null;
		IHyadesResourceExtension hyadesResourceExtension = (IHyadesResourceExtension) HyadesResourceExtensions.getInstance().get(LoadersUtils.getPostfix(result.eResource().getURI().toString()));
		if (hyadesResourceExtension != null) {
			List notLoadedTypes = new ArrayList();
			ResourceSet resourceSet = result.eResource().getResourceSet();
			queryResult = hyadesResourceExtension.executeQuery(verdictQuery, resourceSet, notLoadedTypes);
		}
		return queryResult;

This code works correctly when run using an XMI based resource, but fails when the resource is saved to a database.  The query created by DBSimpleSearchCommand is:

SELECT "TPFVerdictEvent"."id" FROM "CBECommonBaseEvent", "Correlation_Params" AS "P", "TPFVerdictEvent" WHERE "CBECommonBaseEvent"."p_p"="P"."agentPath" AND ("P"."correlationContainer"=100605) AND ("TPFVerdictEvent"."verdict" LIKE pass)  AND ("TPFVerdictEvent"."p_p" LIKE '100605/%') 

It's not critical that this fix make it into 4.4, but I'd like to have a patch so that I can provide some benchmarking numbers to consuming products that are relying on this approach.
Comment 1 jkubasta CLA 2007-06-04 10:42:17 EDT
Marius, can you get this fixed by eod tomorrow?
Comment 2 Joe Toomey CLA 2007-06-26 15:08:15 EDT
Updating priority.
Comment 3 Marius Slavescu CLA 2007-07-06 16:28:23 EDT
Created attachment 73216 [details]
Patch with partial fix, the container is not set yet

Joe in order to try the patch you need to do the following:

- apply the patch (extract also org.eclipse.tptp.platform.models and org.eclipse.hyades.use.cases plugins, you may need to extract also org.eclipse.tptp.test.auto.gui to make the CopyXMIToFromDatabase action showup)
- create the database using this script /org.eclipse.hyades.resources.database/scripts/CreateDatabaseAndTablesCloudscape-allTPTPPackages.sql
- set the following debug option in your runtime launch configuration org.eclipse.tptp.platform.models/debug/databaseResourcePostfix = __Cloudscape
- lunch in debug mode create a project and copy an execution resource from org.eclipse.hyades.use.cases plugin (for example I used Platform.UI.ProfilingPerspective.Launch_1180121993656.execution)
- open Test perspective (to make sure that the executiondb resource extension is registered correctly)
- open Navigator view and select there the execution file and use the "Copy XMI resources -> to Database" action to copy the XMI resource to a new RDB resource
- open the new resource with the Test Log viewer

Add a breakpoint in BasePagingList [line: 276] - loadEObjects(int, int) so you can check that the objects are retrieved correctly, you'll see that the addCurrentPageToContainer doesn't work for Test model, to fix that part I need to change the schema to add the parent type path (p_t_p) in addition to parent path (p_p) and make the necessary code changes to use the new field, I plan to have it done by end of next week.

In the mean time to allow you to test the views you could just add some hard coded logic in the org.eclipse.hyades.resources.database.internal.impl.IndirectedList.findContainerType(EObject o) method to make it work for your sample execution resource instance.
Comment 4 Paul Slauenwhite CLA 2007-08-20 08:34:39 EDT
Reassigning to Component Owner in preparation for 4.5.
Comment 5 Paul Slauenwhite CLA 2007-08-23 06:56:24 EDT
All P1s must be addressed in 4.5.
Comment 6 Paul Slauenwhite CLA 2007-11-05 14:44:24 EST
Please provide a sizing for this defect before Monday, November 12, 2007.
Comment 7 Marius Slavescu CLA 2007-11-05 15:30:04 EST
Do you still need this defect to be fixed?

The Large Resource Support will be moved in the new TPTP LTA optional package (which will be created as part of bug 207240), so it won't be available in the TPTP default package.
Comment 8 Joe Toomey CLA 2007-11-16 14:54:46 EST
Since the request for the rest of this work has been rescinded, we don't need to fix this defect anymore. 

Resolving as WONTFIX.
Comment 9 Paul Slauenwhite CLA 2009-02-25 11:56:04 EST
Closing by default since not closed by the originator in the 7+ months since
being resolved.  

Please reopen if the issue is still present in the latest TPTP release or the
resolution is not correct.