neverchanje commented on a change in pull request #598:
URL: https://github.com/apache/incubator-pegasus/pull/598#discussion_r487728910
##########
File path: src/server/pegasus_write_service_impl.h
##########
@@ -223,29 +227,14 @@ class pegasus_write_service::impl : public
dsn::replication::replica_base
}
}
// set new ttl
- if (update.expire_ts_seconds == 0)
- new_expire_ts = old_expire_ts;
- else if (update.expire_ts_seconds < 0)
+ if (update.expire_ts_seconds == 0) {
+ new_expire_ts = get_ctx.expire_ts;
+ } else if (update.expire_ts_seconds < 0) {
new_expire_ts = 0;
- else // update.expire_ts_seconds > 0
+ } else { // update.expire_ts_seconds > 0
new_expire_ts = update.expire_ts_seconds;
+ }
}
- } else if (s.IsNotFound()) {
- // old value is not found, set to 0 before increment
- new_value = update.increment;
- new_expire_ts = update.expire_ts_seconds > 0 ?
update.expire_ts_seconds : 0;
- } else {
Review comment:
It was moved here:
```
db_get_context get_ctx;
int err = db_get(raw_key, &get_ctx);
if (err == 0) {
if (!get_ctx.found) {
// old value is not found, set to 0 before increment
new_value = update.increment;
new_expire_ts = update.expire_ts_seconds > 0 ?
update.expire_ts_seconds : 0;
} else if (get_ctx.expired) {
```
Because NotFound is treated as a success in `db_get`. 0 is returned.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]