[ 
https://issues.apache.org/jira/browse/DISPATCH-937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16405412#comment-16405412
 ] 

Chuck Rolke commented on DISPATCH-937:
--------------------------------------

The PR as it stands reduces the number of trips through validate. That said, 
there are still a lot of trips through validate.

The attachment dispatch-937-1_vhost-creation-1.txt records a test run against 
pull request 265. It holds a patch with a couple of python print statements, a 
router config file, and a qdmanage command to create a vhost. Then it also 
holds the console output generated by the extra print statements.

At first glance it seems like the validations are done on the same data but on 
closer inspection I don't think that is the case. This is only visible from the 
console log if your editor supports horizontal scrolling to show really long 
lines.

[[~ganeshmurthy]] if the console log sequence at the end of the attachment 
seems OK then this PR looks good.

> schema.validate(attributes) called 4 times before the router starts
> -------------------------------------------------------------------
>
>                 Key: DISPATCH-937
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-937
>             Project: Qpid Dispatch
>          Issue Type: Bug
>          Components: Management Agent
>    Affects Versions: 1.0.1
>            Reporter: Ganesh Murthy
>            Assignee: Ganesh Murthy
>            Priority: Major
>             Fix For: 1.2.0
>
>         Attachments: dispatch-937-1_vhost-creation-1.txt
>
>
> Start the router with the config file etc/qdrouterd.conf. This config file 
> has one router entity
> {noformat}
> router {
>     mode: interior
>     id: Router.A
> }{noformat}
>  
> The schema.validate is called 4 times on the router entity. It should be 
> called only once
>  
> Here is the traceback of the 4 times it was called -
>  
> {noformat}
> {'type': u'org.apache.qpid.dispatch.router', u'mode': u'standalone', u'id': 
> u'Router.A'}
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 142, in configure_dispatch
>     config = Config(filename)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 41, in __init__
>     self.load(filename, raw_json)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 112, in load
>     self.load(f, raw_json)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 120, in load
>     self.schema.validate_all(entities)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 576, in validate_all
>     self.validate_add(a, entities)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/qdrouter.py",
>  line 53, in validate_add
>     super(QdSchema, self).validate_add(attributes, entities)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 585, in validate_add
>     self.validate_entity(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 568, in validate_entity
>     entity_type.validate(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 396, in validate
>     for line in traceback.format_stack():
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 164, in configure_dispatch
>     configure(config.by_type('router')[0])
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 151, in configure
>     agent.configure(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 855, in configure
>     self._create(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 828, in _create
>     self.add_entity(entity)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 859, in add_entity
>     self.entities.add(entity)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 519, in add
>     entity.validate()       # Fill in defaults etc.
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 171, in validate
>     super(EntityAdapter, self).validate(**kwargs)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 639, in validate
>     self.entity_type.validate(self.attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 396, in validate
>     for line in traceback.format_stack():
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 164, in configure_dispatch
>     configure(config.by_type('router')[0])
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 151, in configure
>     agent.configure(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 855, in configure
>     self._create(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 828, in _create
>     self.add_entity(entity)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 859, in add_entity
>     self.entities.add(entity)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 521, in add
>     self.schema.validate_add(entity, self.entities)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/qdrouter.py",
>  line 53, in validate_add
>     super(QdSchema, self).validate_add(attributes, entities)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 585, in validate_add
>     self.validate_entity(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 566, in validate_entity
>     attributes['type'] = self.long_name(attributes['type'])
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/python2.7/site-packages/qpid_dispatch/management/entity.py",
>  line 77, in __setitem__
>     def __setitem__(self, name, value): self._set(name, value)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 636, in _set
>     self.validate()
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 171, in validate
>     super(EntityAdapter, self).validate(**kwargs)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 639, in validate
>     self.entity_type.validate(self.attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 396, in validate
>     for line in traceback.format_stack():
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 164, in configure_dispatch
>     configure(config.by_type('router')[0])
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
>  line 151, in configure
>     agent.configure(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 855, in configure
>     self._create(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 828, in _create
>     self.add_entity(entity)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 859, in add_entity
>     self.entities.add(entity)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/agent.py",
>  line 521, in add
>     self.schema.validate_add(entity, self.entities)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/qdrouter.py",
>  line 53, in validate_add
>     super(QdSchema, self).validate_add(attributes, entities)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 585, in validate_add
>     self.validate_entity(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 568, in validate_entity
>     entity_type.validate(attributes)
> File 
> "/home/gmurthy/opensource/qpid-dispatch/install/lib/qpid-dispatch/python/qpid_dispatch_internal/management/schema.py",
>  line 396, in validate
>     for line in traceback.format_stack():{noformat}
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to