|
@@ -99,7 +99,12 @@ public final class RetentionLease implements ToXContentObject, Writeable {
|
|
|
this.id = id;
|
|
|
this.retainingSequenceNumber = retainingSequenceNumber;
|
|
|
this.timestamp = timestamp;
|
|
|
- this.source = source;
|
|
|
+ // deduplicate the string instances to save memory for the known possible source values
|
|
|
+ this.source = switch (source) {
|
|
|
+ case "ccr" -> "ccr";
|
|
|
+ case ReplicationTracker.PEER_RECOVERY_RETENTION_LEASE_SOURCE -> ReplicationTracker.PEER_RECOVERY_RETENTION_LEASE_SOURCE;
|
|
|
+ default -> source;
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -109,10 +114,7 @@ public final class RetentionLease implements ToXContentObject, Writeable {
|
|
|
* @throws IOException if an I/O exception occurs reading from the stream
|
|
|
*/
|
|
|
public RetentionLease(final StreamInput in) throws IOException {
|
|
|
- id = in.readString();
|
|
|
- retainingSequenceNumber = in.readZLong();
|
|
|
- timestamp = in.readVLong();
|
|
|
- source = in.readString();
|
|
|
+ this(in.readString(), in.readZLong(), in.readVLong(), in.readString());
|
|
|
}
|
|
|
|
|
|
/**
|