)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"fa647092840648ad39531008a844d1d414eda364","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"19a3f1a0_d9ed9ced","updated":"2024-03-13 02:53:01.000000000","message":"Seems memcache just stores exptime as unixtime (epoch) so we could probably get away with that too.\n\nWhat you do you think (comments inline)?","commit_id":"b73b4bc8b960ea7279fb778e94c69d3fc3140c1d"},{"author":{"_account_id":34930,"name":"Jianjian Huo","email":"jhuo@nvidia.com","username":"jhuo"},"change_message_id":"e6ce98da829998460b7a228c0cc9c0805959756d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"98d96d71_2fc9526d","updated":"2024-03-15 00:53:39.000000000","message":"thanks!","commit_id":"b73b4bc8b960ea7279fb778e94c69d3fc3140c1d"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"7f1d2b1b8b9a84ee30a58642d1632ddee07aece3","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"ca1dd471_27ecb42a","updated":"2024-03-15 02:51:35.000000000","message":"Just fixed the pep8 issues.\n\nBut otherwise great! Will land this as soon as zuul comes back good!","commit_id":"27ef11ea14240d8611dd1cbadaf8412727c85f49"}],"test/unit/common/test_memcached.py":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"fa647092840648ad39531008a844d1d414eda364","unresolved":true,"context_lines":[{"line_number":115,"context_line":"            flags,"},{"line_number":116,"context_line":"            exptime,"},{"line_number":117,"context_line":"            self.inbuf[:int(num_bytes)],"},{"line_number":118,"context_line":"            current_time"},{"line_number":119,"context_line":"        )"},{"line_number":120,"context_line":"        self.inbuf \u003d self.inbuf[int(num_bytes) + 2:]"},{"line_number":121,"context_line":"        if noreply !\u003d b\u0027noreply\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"901f0157_7084cce6","line":118,"updated":"2024-03-13 02:53:01.000000000","message":"So we\u0027re basically keeping current_time with the key so we can do the ttl expiry. If it\u0027s only used in the expiry calcuation then maybe exptime just needs to always be turned into an epoch (unix timestamp)?\n\nFrom the memcache protocol.txt:\n\n  - \u003cexptime\u003e is expiration time. If it\u0027s 0, the item never expires\n    (although it may be deleted from the cache to make place for other\n    items). If it\u0027s non-zero (either Unix time or offset in seconds from\n    current time), it is guaranteed that clients will not be able to\n    retrieve this item after the expiration time arrives (measured by\n    server time). If a negative value is given the item is immediately\n    expired.\n\nSo if it\u0027s a seconds offset, can we just:\n\n   exptime \u003d time.time() + exptime\n\nAnd then always just deal in epochs?\n\nLooking at the source, this seems to be what they do and 30 days in seconds is the max delta/offset: https://github.com/memcached/memcached/blob/master/memcached.c#L172-L176 \n\n\nThen when we use the new assert_cache_values we don\u0027t then need to go and only compare [:3] values.","commit_id":"b73b4bc8b960ea7279fb778e94c69d3fc3140c1d"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"7f1d2b1b8b9a84ee30a58642d1632ddee07aece3","unresolved":false,"context_lines":[{"line_number":115,"context_line":"            flags,"},{"line_number":116,"context_line":"            exptime,"},{"line_number":117,"context_line":"            self.inbuf[:int(num_bytes)],"},{"line_number":118,"context_line":"            current_time"},{"line_number":119,"context_line":"        )"},{"line_number":120,"context_line":"        self.inbuf \u003d self.inbuf[int(num_bytes) + 2:]"},{"line_number":121,"context_line":"        if noreply !\u003d b\u0027noreply\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9aef0b8e_191c729f","line":118,"in_reply_to":"0381e166_75bf19de","updated":"2024-03-15 02:51:35.000000000","message":"Yes! That\u0027s my understanding as well!","commit_id":"b73b4bc8b960ea7279fb778e94c69d3fc3140c1d"},{"author":{"_account_id":34930,"name":"Jianjian Huo","email":"jhuo@nvidia.com","username":"jhuo"},"change_message_id":"e6ce98da829998460b7a228c0cc9c0805959756d","unresolved":true,"context_lines":[{"line_number":115,"context_line":"            flags,"},{"line_number":116,"context_line":"            exptime,"},{"line_number":117,"context_line":"            self.inbuf[:int(num_bytes)],"},{"line_number":118,"context_line":"            current_time"},{"line_number":119,"context_line":"        )"},{"line_number":120,"context_line":"        self.inbuf \u003d self.inbuf[int(num_bytes) + 2:]"},{"line_number":121,"context_line":"        if noreply !\u003d b\u0027noreply\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"0381e166_75bf19de","line":118,"in_reply_to":"901f0157_7084cce6","updated":"2024-03-15 00:53:39.000000000","message":"thanks for your insights! This got me to dig into the protocol of memcached exptime, and found out we have something to deal with that protocol as well (probably no one uses it yet other than test case):\nhttps://review.opendev.org/c/openstack/swift/+/912352/1/swift/common/memcached.py#104\n\nI have modified my patch again to support all different cases.\nso the exptime interface from MemcacheRing client of memcached.py:\n1. if exptime \u003c 30 * 24 * 60 * 60, means it\u0027s a delta, just use it.\n2. if exptime \u003e 30 * 24 * 60 * 60, convert it to time expressed in seconds since the epoch.\n\nAnd the new implementation of MockMemcached ttl (following Memcached protocol):\n1. if exptime is 0, store 0.\n2. if exptime \u003c\u003d 30 * 24 * 60 * 60, convert it to time expressed in seconds since the epoch.\n3. if exptime \u003e 30 * 24 * 60 * 60, it\u0027s absolute time already, just store it.","commit_id":"b73b4bc8b960ea7279fb778e94c69d3fc3140c1d"}]}
