Bug 478175 - MIGRATED_FROM_JIRA: Penrose don't use relationships when loading secondary sources
MIGRATED_FROM_JIRA: Penrose don't use relationships when loading secondary so...
Status: MODIFIED
Product: penrose
Classification: Retired
Component: Engine (Show other bugs)
2.0
All Linux
low Severity low
: ---
: ---
Assigned To: Endi Sukma Dewata
Ben Levenson
:
Depends On:
Blocks: 471500
  Show dependency treegraph
 
Reported: 2008-12-27 03:06 EST by Chandrasekar Kannan
Modified: 2016-01-28 17:00 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Chandrasekar Kannan 2008-12-27 03:06:13 EST
I'm using a mapping like samples/jdbc. When performing the following query it loads all entries for the field uniquemember:

InitialDirContext ctx = connect();
ctx.search("ou=groups,o=teste", "cn=ADM01", new SearchControls());

After some debugging, it seens that the problem is like the following:

In LoadGraphVisitor.visitNode the code check "sourceValues.contains(sourceMapping.getName())" and if true it traverse the edges and finishes. The problem is that  LoadGraphVisitor.visitEdge use the attribute "loadedSourceValues" for doing relationship joining, but this won't be set to any value due the "if" in LoadGraphVisitor.visitNode.

I've applied the following change, from: (LoadGraphVisitor.visitEdge line 116)
        if (sourceValues.contains(sourceMapping.getName())) {
            log.debug("Source "+sourceMapping.getName()+" has been loaded.");
            graphIterator.traverseEdges(node);
            return;
        }

To:
        if (sourceValues.contains(sourceMapping.getName())) {
        	  loadedSourceValues.set(sourceMapping.getName(), Collections.singletonList(sourceValues));
            log.debug("Source "+sourceMapping.getName()+" has been loaded.");
            graphIterator.traverseEdges(node);
            return;
        }

If you guys prefer, I can generate a diff for the fix.
Additional Comments From endisd dated Thu Mar 22 18:12:19 CDT 2007 
In Penrose 1.2 the <relationship> tag has been replaced by foreign key reference in the field mapping. For example, if you previously have:

 <source name="ug">
    ...
    <field name="groupname">
        <variable>cn</variable>
    </field>
    ...
  </source>

 <relationship>ug.groupname = g.groupname</relationship>

now it should be defined as follows:

 <source name="ug">
    ...
    <field name="groupname">
        <variable>u.groupname</variable>
    </field>
    ...
  </source>

The code that uses the relationship has been rewritten, so please try again. If the problem persists feel free to reopen the issue.



=========================================================
Issue dump from jira
$VAR1 = {
          'priority' => '3',
          'customFieldValues' => [],
          'project' => 'PENROSE',
          'status' => '5',
          'components' => [
                            {
                              'name' => 'Engine',
                              'id' => '10009'
                            }
                          ],
          'reporter' => 'kumpera',
          'key' => 'PENROSE-200',
          'assignee' => 'endisd',
          'summary' => 'Penrose don't use relationships when loading secondary sources',
          'id' => '10603',
          'updated' => '2007-03-22 18:12:30.0',
          'votes' => '0',
          'fixVersions' => [
                           {
                             'releaseDate' => '2007-05-18 00:00:00.0',
                             'sequence' => '22',
                             'name' => 'Penrose-1.2',
                             'released' => 'true',
                             'id' => '10088',
                             'archived' => 'false'
                           }
                         ],
          'description' => 'I'm using a mapping like samples/jdbc. When performing the following query it loads all entries for the field uniquemember:

InitialDirContext ctx = connect();
ctx.search("ou=groups,o=teste", "cn=ADM01", new SearchControls());

After some debugging, it seens that the problem is like the following:

In LoadGraphVisitor.visitNode the code check "sourceValues.contains(sourceMapping.getName())" and if true it traverse the edges and finishes. The problem is that  LoadGraphVisitor.visitEdge use the attribute "loadedSourceValues" for doing relationship joining, but this won't be set to any value due the "if" in LoadGraphVisitor.visitNode.

I've applied the following change, from: (LoadGraphVisitor.visitEdge line 116)
        if (sourceValues.contains(sourceMapping.getName())) {
            log.debug("Source "+sourceMapping.getName()+" has been loaded.");
            graphIterator.traverseEdges(node);
            return;
        }

To:
        if (sourceValues.contains(sourceMapping.getName())) {
        	  loadedSourceValues.set(sourceMapping.getName(), Collections.singletonList(sourceValues));
            log.debug("Source "+sourceMapping.getName()+" has been loaded.");
            graphIterator.traverseEdges(node);
            return;
        }

If you guys prefer, I can generate a diff for the fix.',
          'affectsVersions' => [
                               {
                                 'releaseDate' => '2006-11-27 00:00:00.0',
                                 'sequence' => '20',
                                 'name' => 'Penrose-1.1.2',
                                 'released' => 'true',
                                 'id' => '10091',
                                 'archived' => 'false'
                               }
                             ],
          'created' => '2007-02-22 08:24:49.0',
          'environment' => 'windowx XP, java 1.5.06, penrose 1.1.2.',
          'resolution' => '1',
          'type' => '1'
        };


=========================================================
Comment 1 Chandrasekar Kannan 2008-12-27 03:06:15 EST
Marking bug as MODIFIED as it was already resolved in Jira - PENROSE-200

Note You need to log in before you can comment on or make changes to this bug.