diff --git a/atlasdb-client/src/main/java/com/palantir/atlasdb/persister/JacksonPersister.java b/atlasdb-client/src/main/java/com/palantir/atlasdb/persister/JacksonPersister.java index adc75007f73..f1a1118d07e 100644 --- a/atlasdb-client/src/main/java/com/palantir/atlasdb/persister/JacksonPersister.java +++ b/atlasdb-client/src/main/java/com/palantir/atlasdb/persister/JacksonPersister.java @@ -19,10 +19,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Throwables; import com.palantir.atlasdb.persist.api.ReusablePersister; -import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.StringReader; -import java.nio.charset.StandardCharsets; /** * A {@link ReusablePersister} that uses an {@link ObjectMapper} to serialize and deserialize objects @@ -41,14 +38,7 @@ public JacksonPersister(Class typeRef, ObjectMapper mapper) { @Override public final T hydrateFromBytes(byte[] input) { try { - if (input.length <= 8192 && mapper.getFactory().canUseCharArrays()) { - // Optimize to avoid allocation of heap ByteBuffer via InputStreamReader. - // Remove after upgrade to Jackson 2.16. - // see: https://github.com/FasterXML/jackson-core/pull/1081 - // and https://github.com/FasterXML/jackson-benchmarks/pull/9 - return mapper.readValue(new StringReader(new String(input, StandardCharsets.UTF_8)), typeRef); - } - return mapper.readValue(new ByteArrayInputStream(input), typeRef); + return mapper.readValue(input, typeRef); } catch (IOException e) { throw Throwables.propagate(e); } diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/internalschema/persistence/InternalSchemaMetadataPayloadCodec.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/internalschema/persistence/InternalSchemaMetadataPayloadCodec.java index bf4633f121c..de0345303d3 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/internalschema/persistence/InternalSchemaMetadataPayloadCodec.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/internalschema/persistence/InternalSchemaMetadataPayloadCodec.java @@ -25,10 +25,7 @@ import com.palantir.conjure.java.serialization.ObjectMappers; import com.palantir.logsafe.SafeArg; import com.palantir.logsafe.exceptions.SafeIllegalStateException; -import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.StringReader; -import java.nio.charset.StandardCharsets; import java.util.Optional; import java.util.function.Function; @@ -101,15 +98,7 @@ static VersionedInternalSchemaMetadata encode(InternalSchemaMetadata internalSch private static InternalSchemaMetadata decodeViaJson(byte[] byteArray) { try { - if (byteArray.length <= 8192) { - // Optimize to avoid allocation of heap ByteBuffer via InputStreamReader. - // Remove after upgrade to Jackson 2.16. - // see: https://github.com/FasterXML/jackson-core/pull/1081 - // and https://github.com/FasterXML/jackson-benchmarks/pull/9 - return SCHEMA_METADATA_READER.readValue( - new StringReader(new String(byteArray, StandardCharsets.UTF_8))); - } - return SCHEMA_METADATA_READER.readValue(new ByteArrayInputStream(byteArray)); + return SCHEMA_METADATA_READER.readValue(byteArray); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/changelog/@unreleased/pr-7168.v2.yml b/changelog/@unreleased/pr-7168.v2.yml new file mode 100644 index 00000000000..8f8a708a44f --- /dev/null +++ b/changelog/@unreleased/pr-7168.v2.yml @@ -0,0 +1,8 @@ +type: improvement +improvement: + description: |- + Now that AtlasDB has upgraded to Jackson 2.16.1, remove performance workaround that landed upstream in Jackson 2.16.0. See https://github.com/FasterXML/jackson-core/pull/1081 + + Removes changes from https://github.com/palantir/atlasdb/pull/6750 + links: + - https://github.com/palantir/atlasdb/pull/7168