[GH-ISSUE #346] [BUG] Client::Put should return the OBJECT_ALREADY_EXISTS to let user know #129

Closed
opened 2026-10-29 21:09:47 +00:00 by bsakaguchi · 4 comments
Owner

Originally created by @maobaolong on GitHub (May 11, 2025).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/346

issue

The following code snippet is in the Client::Put.

    // Start put operation
    PutStartResponse start_response =
        master_client_.PutStart(key, slice_lengths, slice_size, config);
    ErrorCode err = start_response.error_code;
    if (err != ErrorCode::OK) {
        if (err == ErrorCode::OBJECT_ALREADY_EXISTS) {
            VLOG(1) << "object_already_exists key=" << key;
            return ErrorCode::OK;
        }
        LOG(ERROR) << "Failed to start put operation: " << err;
        return err;
    }

User can not aware of that the new key content didn't put into the mooncake store.

approach

In general, we have to support the following behaviors and let specified by user while object exist during put.

  1. Original behavior - Do nothing, just keep old value and return OK.
  2. Return OBJECT_ALREADY_EXISTS - Return the OBJECT_ALREADY_EXISTS directly to caller to let user aware this error. #347
  3. Replace old key - Remove the old key and put new key.
Originally created by @maobaolong on GitHub (May 11, 2025). Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/346 # issue The following code snippet is in the `Client::Put`. ```cpp // Start put operation PutStartResponse start_response = master_client_.PutStart(key, slice_lengths, slice_size, config); ErrorCode err = start_response.error_code; if (err != ErrorCode::OK) { if (err == ErrorCode::OBJECT_ALREADY_EXISTS) { VLOG(1) << "object_already_exists key=" << key; return ErrorCode::OK; } LOG(ERROR) << "Failed to start put operation: " << err; return err; } ``` User can not aware of that the new key content didn't put into the mooncake store. # approach In general, we have to support the following behaviors and let specified by user while object exist during put. 1. Original behavior - Do nothing, just keep old value and return OK. 2. Return OBJECT_ALREADY_EXISTS - Return the OBJECT_ALREADY_EXISTS directly to caller to let user aware this error. #347 3. Replace old key - Remove the old key and put new key.
bsakaguchi 2026-10-29 21:09:47 +00:00
Author
Owner

@doujiang24 commented on GitHub (May 11, 2025):

Sometimes we want to add one more replica, I think it might be a reasonable TODO, thoughts?

<!-- gh-comment-id:2869532733 --> @doujiang24 commented on GitHub (May 11, 2025): Sometimes we want to add one more replica, I think it might be a reasonable TODO, thoughts?
Author
Owner

@maobaolong commented on GitHub (May 12, 2025):

Sometimes we want to add one more replica, I think it might be a reasonable TODO, thoughts?

@doujiang24 Thanks for your reply, it could be an api like set_replication(int replica_num) to increase or decrease the replication.

<!-- gh-comment-id:2872250372 --> @maobaolong commented on GitHub (May 12, 2025): > Sometimes we want to add one more replica, I think it might be a reasonable TODO, thoughts? @doujiang24 Thanks for your reply, it could be an api like `set_replication(int replica_num)` to increase or decrease the replication.
Author
Owner

@github-actions[bot] commented on GitHub (Jul 12, 2026):

This issue has had no activity for 90 days and will be closed in 7 days if there is no further activity. Please comment or react if it should stay open.

<!-- gh-comment-id:4949900656 --> @github-actions[bot] commented on GitHub (Jul 12, 2026): This issue has had no activity for 90 days and will be closed in 7 days if there is no further activity. Please comment or react if it should stay open.
Author
Owner

@github-actions[bot] commented on GitHub (Jul 20, 2026):

Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.

<!-- gh-comment-id:5018723642 --> @github-actions[bot] commented on GitHub (Jul 20, 2026): Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/Mooncake#129
No description provided.