Memcache CAS

Chris Goffinet goffinet at yahoo-inc.com
Mon Sep 17 07:31:13 UTC 2007


1) Okay. Does it make sense then to just implement a 'revision' into  
the item struct? That way we can just revision++ on new 'set'?

2) I'll add support for those 3 again so you can see what happened.  
I'll look into draining the output correctly so client's won't have an  
issue with this.


Chris Goffinet
goffinet at yahoo-inc.com



On Sep 17, 2007, at 12:23 AM, Dustin Sallings wrote:

>
> On Sep 17, 2007, at 0:12, Chris Goffinet wrote:
>
>> 1) For :1113 I noticed if I added the item_remove diff like you  
>> suggested, it ends up returning the memory identifier of the new  
>> variable that is always the same in memory vs address of actual  
>> item pulled from item_get. Suggestions to fix? Try it yourself,  
>> when you use the same itmp variable on it and set a few items over  
>> and over again. It will usually always be same memory address (even  
>> if data changes).
>
> 	I suppose that makes sense with the slab allocator.  Perhaps the  
> memory address is not adequate and a counter would be more  
> appropriate after all.
>
>> 2) Yeah I expanded item_alloc because the way memcache reads  
>> through the loop of data sent. Originally I did it the way I sent  
>> you, but ran into an issue with existing clients. I noticed that  
>> memcached would throw an error right when memcache read the cas  
>> command (which is OK..). But all of our commands (add,replace,set)  
>> wait until complete_nread occur before returning either STORED/ 
>> NOT_STORED to be compatible with existing clients.
>
> 	Draining the input buffer does seem like the right thing to do.  I  
> think it's somewhat important to be able to distinguish between an  
> allocation failure, match failure, and and a missing record.
>
> 	In my binary protocol implementation, I implemented a command that  
> could transmit an error back to the client and sink a chunk of data  
> whose size is known ahead of time.  I use it for unknown commands,  
> failing sets, etc... so I can basically do this when a cas  
> comparison fails:
>
> 	write_bin_error(c, ERR_EXISTS, vlen);
>
> -- 
> Dustin Sallings
>
>



More information about the memcached mailing list