Skip to content
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

KAFKA-12396 added a nullcheck before trying to retrieve a key #10548

Merged
merged 10 commits into from Apr 30, 2021
Expand Up @@ -326,6 +326,7 @@ public <PS extends Serializer<P>, P> KeyValueIterator<Bytes, byte[]> prefixScan(

@Override
public synchronized byte[] get(final Bytes key) {
Objects.requireNonNull(key, "key cannot be null");
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add this to MeteredKeyValueStore instead -- this way, we get the same guard for the in-memory key-value store (or other custom stores).

We should also add this check to other methods that accept a key, like put, putIfAbsent etc...

Furthermore, we should also add it for other store types, ie, MeteredTimestampedKeyValueStore, MeteredWindowedStore, MeteredTimestampedWindowStore and MeteredSessionStore.

Last, but not least, we should add corresponding unit tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On it.

Copy link
Member

Choose a reason for hiding this comment

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

This check can be remove, as we do the check in the "metered" store that will wrap this one.

validateStoreOpen();
try {
return dbAccessor.get(key.get());
Expand Down