Skip to content

feat(kv): enhance namespaced key-value store operations and handlers #2613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

1sonofqiu
Copy link
Contributor

More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.

Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@superhx
Copy link
Collaborator

superhx commented Jun 6, 2025

Missing modification of KVImage

* @param keyAndNamespace key and namespace.
* @return async get result. {@link ValueAndEpoch} value and epoch, null if key not exist.
*/
CompletableFuture<ValueAndEpoch> getNamespacedKV(KeyAndNamespace keyAndNamespace);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we modify the Key with additional namespace field instead of create a new class

this.epoch = 0L;
}

public KeyValue(Key key, Value value, String namespace, long epoch) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the doc for epoch field

@@ -47,30 +50,54 @@ public class KVControlManager {
private final SnapshotRegistry registry;
private final Logger log;
private final TimelineHashMap<String, ByteBuffer> kv;
private final TimelineHashMap<String, KeyMetadata> keyMetadataMap;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we don't need keyMetadata. We could just assign a special namespace&epoch to the old KV.

* @param options
* @return
*/
PutNamespacedKVResult putNamespacedKV(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the parameter "partitions" exist?

@@ -4866,6 +4877,86 @@ public UpdateGroupResult updateGroup(String groupId, UpdateGroupSpec groupSpec,
return new UpdateGroupResult(future.get(CoordinatorKey.byGroupId(groupId)));
}

@Override
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add AutoMQ extended code in the last of file and wrap the code with AutoMQ inject start / end.

@@ -0,0 +1,23 @@
package org.apache.kafka.clients.admin;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Apache License header

"name": "Epoch",
"type": "int64",
"versions": "1+",
"about": "Epoch"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more description

.setEpoch(currentEpoch));
}

long newEpoch = System.currentTimeMillis();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use a incremental epoch

@superhx superhx linked an issue Jun 6, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Enhance KVRecord
2 participants