Important bug fix for OVDB

Heath Kehoe heath.kehoe at intermec.com
Fri May 19 06:55:39 UTC 2000


This patch needs to go into both the BETA and CURRENT trees.  It fixes
a nasty bug where nnrpds can return the wrong OV data from an XOVER
command, when ovdb is being used, with nnrpdcheckart on.

-heath


*** nnrpd/article.c.dist	Fri May 19 01:42:59 2000
--- nnrpd/article.c	Fri May 19 01:45:26 2000
***************
*** 911,917 ****
      ARTNUM		artnum;
      void		*handle;
      char		*data;
!     int			len;
      TOKEN		token;
  
      if (!PERMcanread) {
--- 911,917 ----
      ARTNUM		artnum;
      void		*handle;
      char		*data;
!     int			len, searches;
      TOKEN		token;
  
      if (!PERMcanread) {
***************
*** 956,961 ****
--- 956,962 ----
      (void)fflush(stdout);
      if (PERMaccessconf->nnrpdoverstats)
  	gettimeofday(&stv, NULL);
+     searches=0;
      while (OVsearch(handle, &artnum, &data, &len, &token, NULL)) {
  	if (PERMaccessconf->nnrpdoverstats) {
  	    gettimeofday(&etv, NULL);
***************
*** 962,967 ****
--- 963,983 ----
  	    OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
  	    OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
  	}
+ 
+ 	/* If there is unsent IOv data; and we've searched more than
+ 	 * IOV_MAX times, do a push.  This is because ovdb will only
+ 	 * retain the data (the pointers to which provided by OVsearch)
+ 	 * for the last IOV_MAX*2 calls (plus a few to be safe)
+ 	 */
+ 	if(queued_iov == 0) {
+ 	    searches = 0;
+ 	} else {
+ 	    if(++searches > IOV_MAX*2) {
+ 		searches = 0;
+ 		PushIOv();
+ 	    }
+ 	}
+ 
  	if (len == 0 || PERMaccessconf->nnrpdcheckart && !ARTinstorebytoken(token)) {
  	    if (PERMaccessconf->nnrpdoverstats) {
  		OVERmiss++;
*** storage/ovdb/ovdb.c.dist	Fri May 19 01:47:13 2000
--- storage/ovdb/ovdb.c	Fri May 19 01:47:19 2000
***************
*** 147,153 ****
      time_t expires;
  };
  
! #define SEARCHQUEUELEN  (IOV_MAX+5)
  
  struct ovdbsearch {
      DB *db;
--- 147,153 ----
      time_t expires;
  };
  
! #define SEARCHQUEUELEN  (2*IOV_MAX+5)
  
  struct ovdbsearch {
      DB *db;




More information about the inn-workers mailing list