Memcache Upsert Expiration

Can you please verify the commit that fixed the Memcache expiration?

https://issues.couchbase.com/browse/NCBC-1538

When passing in a TimeSpan here

It calls the ToTtl(this TimeSpan timespan) extension method. This extension method returns the (uint)Timespan.TotalSeconds.

This is then passed to the Upsert which accepts the uint param, and this value calls the extension ToTtl(this uint duration).


The issue is that the extension method is expecting an uint value in milliseconds. With the value of seconds passed in, the expiration is off by a factor of 1000.

I have used the uint upsert overload for the memcache bucket for the time being.
Thanks

If you look in the lower right of the web view of JIRA, you’ll see a link to the commit in code review that should have addressed this issue.

I am not sure what I should be looking for in this review.

http://review.couchbase.org/#/c/83941/1/Src/Couchbase.IntegrationTests/MemcachedBucketTests.cs

After upserting with a 1 second expiration a Get is immediately performed. The document is not given a chance to expire so the first Get is successful. A thread sleep for 1200 milliseconds was performed. The document was retrieved a second time via a Get and the response asserted as equal to KeyNotFound.

But it doesn’t cover the gap in tests. The object is expiring too quickly.

I think if you set the sleep to 500 milliseconds the unit test would still be successful.

@surge @ingenthr -

Indeed it is a regression. The cast from double to uint ends up setting the expiration to 0 which is infinite. I’ll push a patch in a few minutes.

Thanks,

Jeff

Cool, thanks for looking into it.

1 Like

@jmorris Is there an eta when this will be posted as a Nuget package?

It’s scheduled for v2.5.3 on or around Dec 5th, 2017. Note, once the patch has made it through code review on Gerrit and has been merged, you can always build from source on Github if you need immediately.

-Jeff

1 Like

@surge - we also generate pre-release nuget packages for each change that has been accepted. The pre-release nuget feed is here.

2 Likes