Child pages
  • KIP-648: Renaming getter method for Interactive Queries
Skip to end of metadata
Go to start of metadata

Status

Current state: Accepted

Discussion thread: None

Voting thread : Here

JIRA: KAFKA-10316 - Getting issue details... STATUS

Motivation

In the 2.5 release, we introduce new classes for Interactive Queries via KIP-535 (https://issues.apache.org/jira/browse/KAFKA-6144).

The KIP did not specify the names for getter methods of `KeyQueryMetadata` explicitly and they were added in the PR as `getActiveHost()`, `getStandbyHosts()`, and `getPartition()`.

However, in Kafka it is custom to not use the `get` prefix for getters and thus the methods should have `activeHost()`, `standbyHosts()`, and `partition()`, respectively.

We need to rename the methods accordingly, by deprecating the existing ones and adding the new ones in parallel.

Public Interfaces

We propose to add 3 new getters without the prefix 'get' and deprecate the existing 3 getters in KeyQueryMetadata.java. The changes that are to be made in the class on a high-level is mentioned below. 

KeyQueryMetadata.java
package org.apache.kafka.streams;
public class KeyQueryMetadata{
//deprecated
	@Deprecated
    public HostInfo getActiveHost() {
        return activeHost;
    }
//deprecated
	@Deprecated
    public Set<HostInfo> getStandbyHosts() {
        return standbyHosts;
    }    
//deprecated
	@Deprecated
    public int getPartition() {
        return partition;
    }

//new
    public HostInfo activeHost() {
        return activeHost;
    }
//new
    public Set<HostInfo> standbyHosts() {
        return standbyHosts;
    }    
//new
    public int partition() {
        return partition;
    }
}

Proposed Changes

Deprecate the existing getters and add new getters without the prefix 'get' . Add the getters `activeHost()`, `standbyHosts()`, and `partition()` to KeyQueryMetadata.java.

Update the existing Tests to use the new getters of KeyQueryMetadata.java . Below are the Test classes that needs to update with new getters 

  • OptimizedKTableIntegrationTest.java
  • QueryableStateIntegrationTest.java
  • StoreQueryIntegrationTest.java
  • StreamsMetadataStateTest.java

Compatibility, Deprecation, and Migration Plan

  • Users using `getActiveHost()`, `getStandbyHosts()`, and `getPartition()` are not effected. These methods will be deprecated. 
  • Users using `getActiveHost()`, `getStandbyHosts()`, and `getPartition()` can update their code to use `activeHost()`, `standbyHosts()`, and `partition()`

Rejected Alternatives

None



  • No labels