Skip to content

Commit

Permalink
[FLINK-27556][state] Inline state handle id generation
Browse files Browse the repository at this point in the history
...  to avoid unnecessary overhead when it's not used.
  • Loading branch information
rkhachatryan committed Jul 8, 2022
1 parent c9f2c4a commit 231e96b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public class FileStateHandle implements StreamStateHandle {
/** The size of the state in the file. */
private final long stateSize;

private final PhysicalStateHandleID physicalID;

/**
* Creates a new file state for the given file path.
*
Expand All @@ -55,7 +53,6 @@ public FileStateHandle(Path filePath, long stateSize) {
checkArgument(stateSize >= -1);
this.filePath = checkNotNull(filePath);
this.stateSize = stateSize;
this.physicalID = new PhysicalStateHandleID(filePath.toUri().toString());
}

/**
Expand All @@ -79,7 +76,7 @@ public Optional<byte[]> asBytesIfInMemory() {

@Override
public PhysicalStateHandleID getStreamStateHandleID() {
return physicalID;
return new PhysicalStateHandleID(filePath.toUri().toString());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ public class ByteStreamStateHandle implements StreamStateHandle {
*/
private final String handleName;

private final PhysicalStateHandleID physicalID;

/** Creates a new ByteStreamStateHandle containing the given data. */
public ByteStreamStateHandle(String handleName, byte[] data) {
this.handleName = Preconditions.checkNotNull(handleName);
this.data = Preconditions.checkNotNull(data);
this.physicalID = new PhysicalStateHandleID(handleName);
}

@Override
Expand All @@ -62,7 +59,7 @@ public Optional<byte[]> asBytesIfInMemory() {

@Override
public PhysicalStateHandleID getStreamStateHandleID() {
return physicalID;
return new PhysicalStateHandleID(handleName);
}

public byte[] getData() {
Expand Down

0 comments on commit 231e96b

Please sign in to comment.