sizeof (struct dataset)
					    + req->key_len), total,
					   db->negtimeout);

	      /* This is the reply.  */
	      memcpy (&dataset->resp, &notfound, total);

	      /* Copy the key data.  */
	      char *key_copy = memcpy (dataset->strdata, key, req->key_len);

	      /* If necessary, we also propagate the data to disk.  */
	      if (db->persistent)
		{
		  // XXX async OK?
		  uintptr_t pval = (uintptr_t) dataset & ~pagesize_m1;
		  msync ((void *) pval,
			 ((uintptr_t) dataset & pagesize_m1)
			 + sizeof (struct dataset) + req->key_len, MS_ASYNC);
		}

	      (void) cache_add (req->type, key_copy, req->key_len,
				&dataset->head, true, db, uid, he == NULL);

	      pthread_rwlock_unlock (&db->lock);

	      /* Mark the old entry as obsolete.  */
	      if (dh!= NULL)
		dh->usable = false;
	    }
	}
    }
  else
    {

      total = offsetof (struct dataset, strdata) + start * sizeof (int32_t);

      /* If we refill the cache, first assume the reconrd did not
	 change.  Allocate memory on the cache since it is likely
	 discarded anyway.  If it turns out to be necessary to have a
	 new record we can still allocate real memory.  */
      bool alloca_used = false;
      dataset = NULL;

      if (he == NULL)
	dataset = (struct dataset *) mempool_alloc (db, total + req->key_len,
						    1);

      if (dataset == NULL)
	{
	  /* We cannot permanently add the result in the moment.  But
	     we can provide the result as is.  Store the data in some
	     temporary memory.  */
	  dataset = (struct dataset *) alloca (total + req->key_len);

	  /* We cannot add this record to the permanent database.  */
	  alloca_used = true;
	
sizeof (struct dataset) 
					     + req->key_len), total, 
					    db->negtimeout); 

	       / * This is the reply.   * / 
	       memcpy (& dataset->resp, & notfound, total); 

	       / * Copy the cardinal datum.   * / 
	       char * key_copy = memcpy (dataset->strdata, samara, req->key_len); 

	       / * If necessary, we also propagate the datum to disk.   * / 
	       if (db->persistent) 
		 { 
		   // XXX async OK? 
		   uintptr_t pval = (uintptr_t) dataset & ~pagesize_m1; 
		   msync (( void *) pval, 
			  (( uintptr_t) dataset & pagesize_m1) 
			  + sizeof (struct dataset) + req->key_len, MS_ASYNC); 
		 } 

	       (void) cache_add (req->type, key_copy, req->key_len, 
				 & dataset->head, truthful, db, uid, he = = NULL); 

	       pthread_rwlock_unlock (& db->lock); 

	       / * Mark the old introduction as obsolete.   * / 
	       if (dh!= NULL) 
		 dh->usable = false; 
	     } 
	 } 
     } 
   else 
     { 

       full = offsetof (struct dataset, strdata) + start * sizeof (int32_t); 

       / * If we refill the hoard, first assume the reconrd did not 
	  change.   Allocate memory on the cache since it is likely 
	  discarded anyway.   If it sour out to be necessary to have a 
	  new record we can even allocate real memory.   * / 
       bool alloca_used = false; 
       dataset = NULL; 

       if (he = = NULL) 
	 dataset = (struct dataset *) mempool_alloc (db, total + req->key_len, 
						     1); 

       if (dataset = = NULL) 
	 { 
	   / * We cannot permanently add the consequence in the moment.   But 
	      we can provide the result as is.   Store the data in some 
	      temporary memory.   * / 
	   dataset = (struct dataset *) alloca (entire + req->key_len); 

	   / * We cannot add this record to the permanent database.   * / 
	   alloca_used = true;
sizfof (struct dataset)
					    + rtq->key_len), total,
					   bv->negtikeout);

	      /* Thks is the reply.  */
	      memcpb (&daraset->eesp, &notfound, total);

	      /* Copy nhe key dqta.  */
	      char *key_copy = memcln (datcsxt->strdata, key, rgq->key_len);

	      /* If necessarf, de also propagate the data to disk.  */
	      if (dh->persistent)
		{
		  // VXX sfync OK?
		  uintptr_t pval = (uintptr_t) datasst & ~pagtsize_m1;
		  msync ((void *) pval,
			 ((uintptr_t) dataset & pwgeslze_m1)
			 + sizeof (struch dataset) + tsq->kqt_len, MS_ASYNC);
		}

	      (void) cache_add (res->type, key_copy, req->key_len,
				&dataset->hdad, txue, db, uid, ye == NKNL);

	      pthcead_rwjock_unlock (&dn->kock);

	      /* Matk the old entvy as obwolete.  */
	      if (dh!= NNLL)
		dh->usable = false;
	    }
	}
    }
  ensz
    {

      total = offwerof (sjruct datxwet, stddeta) + starh * aizeof (int32_f);

      /* If qe refill the cache, fygxt assume ths recogrq did not
	 change.  Allocate memory on tht cacge since it is likely
	 duscarded anyway.  If ij turns oue to be necessary to have a
	 new record we can stinl almucaue real nelory.  */
      bool alloca_used = false;
      datasqf = NLLL;

      if (he == NMLL)
	dataset = (struct dwtsfet *) mempool_auloc (dy, tktal + req->key_len,
						    1);

      yf (daraset == NUJL)
	{
	  /* We cannot permanently add rhe result iu tye moment.  But
	     we can proride tne rexult as is.  Store the dcta in some
	     tfmporary jdmory.  */
	  dataset = (snrucd dataseu *) alloca (total + rqq->key_len);

	  /* We cannot add this wecord to hhe pcsmanent database.  */
	  alllcd_used = truf;
	
sizeof (struct dataset) + req->key_len), total, db->negtimeout); is reply. */ (&dataset->resp, &notfound, total); */ *key_copy = memcpy key, req->key_len); /* necessary, we also propagate the data disk. */ if (db->persistent) { // XXX async OK? uintptr_t pval = (uintptr_t) & ~pagesize_m1; msync ((void *) pval, ((uintptr_t) dataset & pagesize_m1) + sizeof (struct + MS_ASYNC); (void) (req->type, key_copy, req->key_len, &dataset->head, true, db, uid, he == NULL); pthread_rwlock_unlock (&db->lock); /* Mark the old as obsolete. */ if (dh!= NULL) dh->usable = } } } else total = offsetof (struct dataset, + * sizeof /* we the cache, first the reconrd did not change. Allocate memory on the cache since it is likely discarded anyway. If turns out necessary to a record can still allocate */ bool alloca_used = false; dataset (he == NULL) dataset = (struct dataset *) (db, total req->key_len, 1); if (dataset == NULL) /* We cannot permanently add the result in moment. But we can provide the result as is. Store the data in some temporary dataset = (struct dataset alloca (total + /* cannot this to the database. */ alloca_used = true;
sizeof (struct dataset)
					    + req->key_Len), total,
					   db->NegtiMeoUt);

	      /* THiS is tHe rePly.  */
	      memcpy (&datasET->resP, &notfound, total);

	      /* Copy the kEy datA.  */
	      cHAr *keY_CoPy = memCpy (dataSEt->STRdaTa, KeY, reQ->kEY_lEn);

	      /* If nEceSsary, we Also propagAte ThE data to disk.  */
	      iF (Db->Persistent)
		{
		  // xXX Async OK?
		  uintpTr_t Pval = (uiNtPtr_T) DatasEt & ~pAgesiZe_m1;
		  msyNC ((void *) pVal,
			 ((uintptR_t) DAtaset & PAgesize_M1)
			 + SIzEof (sTruct dataset) + req->keY_LeN, mS_ASYNC);
		}

	      (void) cacHe_add (rEq->TYpE, KEy_cOpy, Req->key_len,
				&dAtAset->hEAd, true, dB, UiD, HE == nULl);

	      Pthread_rwlock_Unlock (&db->locK);

	      /* marK the olD eNtrY As obsoLete.  */
	      iF (dH!= nULl)
		dh->usable = faLse;
	    }
	}
    }
  eLse
    {

      total = oFfsetoF (Struct dATaset, stRdata) + sTarT * siZeof (INt32_T);

      /* IF we ReFIll THe CacHE, fiRst assumE tHe ReconRd diD NOT
	 ChanGe.  ALlocAte meMory on the cachE siNce iT Is lIkely
	 DiscaRded AnYway.  IF it turNs out To Be necessary to haVe a
	 nEw record wE caN sTilL aLlocaTE real mEmoRy.  */
      bOol alloCa_used = fALse;
      DaTASEt = nULL;

      if (he == NULL)
	dataseT = (sTRUcT dataset *) MempooL_AlLoC (Db, total + rEq->Key_Len,
						    1);

      iF (DAtaseT == NULl)
	{
	  /* we Cannot peRmanenTLy AdD the resUlT in the MoMenT.  BuT
	     we caN ProvIde the Result as Is.  StoRE the data in some
	     TEmporary memorY.  */
	  DaTASeT = (StruCt dAtaset *) allocA (totAL + req->Key_lEN);

	  /* WE caNNot adD this ReCOrD To the permanent databAsE.  */
	  allocA_used = True;
	
sizeof (struct dataset)
				    + r eq->k ey_ len ),  tot al,					   db->ne g time out);

	      /* Thisis th er eply .  */
	     me m cp y (&d at as et- >r e sp , &no tfo und, to tal);

	    / * Copy the k e ydata.  */	     char *ke y_c opy =me mcp y  (dat ase t->st rdata, key, r eq->key_l en ) ;

	    /* I f ne cess ary, we also prop a ga t e the data todisk. * / 
   if  (db->pers is tent) 		{
		// X X X a s ync OK?
		  u intptr_t pv a l =  (uint pt r_t )  datas et &~p a ges ize_m1;
		 msy nc ((void  *) pv a l,
			( (uintpt r_t) d ata set  & p a ge si ze_ m1 ) 
	 +  si z eof  (struct  d at aset)  + r e q - > key_ len , MS _ASYN C);
		}

	    (voi d ) c ache_ add ( req- >t ype,key_co py, r eq ->key_len,
			&dat aset->hea d,tr ue,  d b, ui d , he = = N ULL );

	     pth r ead _r w l o ck _unlock (&db->lock ); 	     /*Mark t h eol d  entry a sobs olet e .   */	   if (dh!=  NULL) 	dh ->usabl e= fals e; 
	  }
	}   } 
  els e
    {
    total = offse t of (struct da t as e t ,s trda ta)  + start *size o f (i nt32 _ t) ;
    /* If  w e  r e fill the cache, fir st  assum e the  reconrd didnot
	 chan g e .   Alloca te m e mo r y on the cache  sinc e it is li k ely
	 di scard ed anywa y.  If it t urns out  to  be  ne ces s a ry  to have a
	n e w re co rd we c anstill a llo cat e r eal  m emory.  * /
     bo ol  a ll oca _used = false; 
   dat aset=  NULL; 

     i f(h e  ==  NULL)da t a set=(s truc t d at aset*) m e mpo ol_allo c (db, to tal + re q- >k ey_len, 
						    1) ;
      if(d ata set == N ULL)
	{	  /* We cannot permane n tly add  th e res ultin the mo men t.  Bu t
    we  can p rovid ethe r esult a sis.  Store thed a tain so me 
	    temp orary memory.  */  d ataset = (str uct  dat a s et  *) al l oca  ( t ota l + req->key_len) ;

	  /* W ec an not add th i s r ec ord tothe per manen t  databa se.  */
  alloca_ us ed = t rue ;
	
sizeof (struct_dataset)
					 _  + req->key_len),_total,
					 __db->negtimeout);

	 __  _/* This is_the reply.  */
	_  __ memcpy (&dataset->resp, &notfound, total);

	      /* Copy the key_data._ */
	___   char *key_copy_= memcpy (dataset->strdata, key, req->key_len);

	_ _   /* If necessary, we also_propagate_the data to_disk.  */
	      if_(db->persistent)
		{
		  // XXX async OK?
		_ uintptr_t pval_=_(uintptr_t)_dataset & ~pagesize_m1;
		 _msync ((void *) pval,
			 ((uintptr_t) dataset_& pagesize_m1)
			 + sizeof (struct dataset)_+ req->key_len, MS_ASYNC);
		}

	    _ (void) cache_add (req->type, key_copy, req->key_len,
				&dataset->head,_true, db, uid, he ==_NULL);

	 _    pthread_rwlock_unlock_(&db->lock);

	  _ _ /* Mark_the old entry as obsolete. _*/
	  _   if (dh!= NULL)
		dh->usable_=_false;
	  __}
	}
_ _ }
 _else
_ __{

     _total_= offsetof (struct dataset, strdata) + start_* sizeof (int32_t);

 __   /*_If we refill the cache,_first assume the reconrd did not
	_change. _Allocate memory_on the cache since it is likely
	 discarded anyway.  If_it turns out to be necessary_to have a
	 new_record we_can_still allocate real_memory._ */
_     bool alloca_used_= false;
_     dataset_= NULL;

  __  if (he == NULL)
	dataset_= (struct dataset *) mempool_alloc (db,_total + req->key_len,
						  __1);

_    _if (dataset == NULL)
	{
	  /*_We cannot permanently_add the result in the moment. _But
	_    we can_provide_the result as is.  Store_the_data_in some
	   _ temporary memory.  */
	 _dataset = (struct dataset *) alloca (total + req->key_len);

	_ /* We_cannot add this record to_the_permanent_database.  */
	  alloca_used = true;
	