On Wed, Feb 19, 2025 at 02:48:10PM +0100, Ilya Maximets wrote:
> On 2/13/25 16:39, Max Lamprecht via dev wrote:
> > This hook can be used by libaries to restore previous indexes after a
> > clear.
> > 
> > Signed-off-by: Max Lamprecht <[email protected]>
> > ---
> >  python/ovs/db/idl.py | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
> > index c8cc54346..03efb1a01 100644
> > --- a/python/ovs/db/idl.py
> > +++ b/python/ovs/db/idl.py
> > @@ -790,6 +790,9 @@ class Idl(object):
> >          to doing nothing to avoid overhead where it is not needed.
> >          """
> > 
> > +    def after_clear(self):
> > +        """Hook that can be used to restore indexes after a clear."""
> > +
> >      def __clear(self):
> >          changed = False
> >  
> > @@ -802,6 +805,7 @@ class Idl(object):
> >  
> >          if changed:
> >              self.change_seqno += 1
> > +            self.after_clear()
> >  
> >      def __update_has_lock(self, new_has_lock):
> >          if new_has_lock and not self.has_lock:
> > --
> > 2.43.0
> 
> Hi, Max.  Thanks for the patch!  Could you please explain in more details
> what's the use case for this functionality?  It's not obvious to me why
> such a hook is needed.
> 
> Best regards, Ilya Maximets.
Hi Ilya,

We use openstack in combination with ovn/ovs.
We observed that our networking api(neutron) got slower over time and 
discovered that the
ovsidl loses indexes.

We noticed that right before we see the lookups without indices, we called 
self.clear() in ovs [1]
It seems like the idl called for a new full sync(comment: "clear table rows for 
new dump")
With "table.rows = custom_index.IndexedRows(table)" this clear() function 
reinitializes
the complete table.rows object which also clears all indixes which where 
created by the ovsdbapp lib [2]

After this patch I will submit another patch to ovsdbapp that uses this
hook to restore previous indexes.

[1] 
https://github.com/openvswitch/ovs/blob/8b7f1eb8db1aa99ccf7b542662129450caff65e0/python/ovs/db/idl.py#L495
[2] 
https://github.com/openstack/ovsdbapp/blob/14300779028fab5b1756dc35544d08ec0bb1f1b4/ovsdbapp/backend/ovs_idl/__init__.py#L81
[3] https://bugs.launchpad.net/neutron/+bug/2092133/comments/5
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to