Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/lib/op_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ int op_set::_parse_text_server_parameters() {
int op_set::_parse_binary_request(const binary_request_header& header, const char* body) {
if (header.get_extras_length() == _binary_request_required_extras_length
&& this->_entry.parse(header, body) == 0) {
if (this->_entry.version > 0) {
this->_behavior |= storage::behavior_cas;
}
this->_entry.flag = ntohl(*(reinterpret_cast<const uint32_t*>(body)));
this->_entry.expire = util::realtime(ntohl(*(reinterpret_cast<const uint32_t*>(body + 4))));
shared_byte data(new uint8_t[this->_entry.size]);
Expand Down Expand Up @@ -129,7 +132,7 @@ int op_set::_run_server() {
}
if (r_storage == storage::result_stored
|| r_storage == storage::result_touched) {
if (this->get_ident() == "cas"){
if ((this->_behavior & storage::behavior_cas) || this->get_ident() == "cas"){
stats_object->increment_cas_hits();
} else if (this->get_ident() == "touch"){
stats_object->increment_touch_hits();
Expand All @@ -138,7 +141,7 @@ int op_set::_run_server() {
this->_is_sync(this->_entry.option,
this->_cluster->get_replication_type()));
} else {
if (this->get_ident() == "cas"){
if ((this->_behavior & storage::behavior_cas) || this->get_ident() == "cas"){
if (r_storage == storage::result_exists){
stats_object->increment_cas_badval();
} else if (r_storage == storage::result_not_found) {
Expand Down
1 change: 1 addition & 0 deletions test/lib/test_op_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ namespace test_op_set
cut_assert_equal_int(1, op._entry.flag);
cut_assert_equal_double(stats_object->get_timestamp() + 60, 2, op._entry.expire);
cut_assert_equal_int(5, op._entry.size);
cut_assert_equal_int(5, op._entry.version);
cut_assert_equal_memory("value", 5, op._entry.data.get(), 5);
char* dummy;
cut_assert_equal_int(-1, c->readsize(1, &dummy));
Expand Down