From bd150c0c264371893b99b4b8c050f90cb7b9863b Mon Sep 17 00:00:00 2001 From: Cong Zhao Date: Tue, 12 Jul 2022 15:02:06 +0800 Subject: [PATCH] [fix][broker] Expose timestamp field for SchemaData&SchemaInfo (#16380) Fixes #16379 ### Motivation Miss the timestamp field when constructing SchemaData from `SchemaRegistryFormat.SchemaInfo`, so timestamp value 0 gets the scheme. See: https://github.com/apache/pulsar/blob/95b984694bd3c4f1eadf4e6198de033f9b517128/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java#L621-L629 ### Modifications * Expose timestamp field for SchemaData * Add timestamp field for SchemaInfo --- .../schema/SchemaRegistryServiceImpl.java | 1 + .../broker/admin/AdminApiSchemaTest.java | 18 +++++++- .../admin/AdminApiSchemaWithAuthTest.java | 21 +++++---- .../pulsar/client/api/SimpleSchemaTest.java | 44 ++++++++++--------- .../org/apache/pulsar/schema/SchemaTest.java | 9 ++-- .../client/admin/internal/SchemasImpl.java | 1 + .../PulsarClientImplementationBinding.java | 3 +- .../pulsar/common/schema/SchemaInfo.java | 13 +++++- ...PulsarClientImplementationBindingImpl.java | 6 +-- .../impl/schema/RecordSchemaBuilderImpl.java | 1 + .../client/impl/schema/SchemaInfoTest.java | 15 ++++--- .../client/impl/schema/SchemaInfoImpl.java | 5 +++ 12 files changed, 92 insertions(+), 45 deletions(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java index a9e316bfd6aa9..5fbe91e3bcd5d 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java @@ -623,6 +623,7 @@ static SchemaData schemaInfoToSchema(SchemaRegistryFormat.SchemaInfo info) { .user(info.getUser()) .type(convertToDomainType(info.getType())) .data(info.getSchema().toByteArray()) + .timestamp(info.getTimestamp()) .isDeleted(info.getDeleted()) .props(toMap(info.getPropsList())) .build(); diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiSchemaTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiSchemaTest.java index acbe1f7c2467a..3cd54c3104ac2 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiSchemaTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiSchemaTest.java @@ -23,6 +23,7 @@ import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.Mockito.doReturn; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; @@ -41,6 +42,7 @@ import org.apache.pulsar.client.api.MessageId; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.api.schema.SchemaDefinition; +import org.apache.pulsar.client.impl.schema.SchemaInfoImpl; import org.apache.pulsar.client.impl.schema.StringSchema; import org.apache.pulsar.common.policies.data.ClusterData; import org.apache.pulsar.common.policies.data.PersistentTopicInternalStats; @@ -172,11 +174,13 @@ private void testSchemaInfoApi(Schema schema, SchemaInfo readSi = admin.schemas().getSchemaInfo(topicName); log.info("Read schema of topic {} : {}", topicName, readSi); + ((SchemaInfoImpl)readSi).setTimestamp(0); assertEquals(readSi, si); readSi = admin.schemas().getSchemaInfo(topicName + "-partition-0"); log.info("Read schema of topic {} : {}", topicName, readSi); + ((SchemaInfoImpl)readSi).setTimestamp(0); assertEquals(readSi, si); } @@ -225,12 +229,14 @@ private void testSchemaInfoWithVersionApi(Schema schema, SchemaInfoWithVersion readSi = admin.schemas().getSchemaInfoWithVersion(topicName); log.info("Read schema of topic {} : {}", topicName, readSi); + ((SchemaInfoImpl)readSi.getSchemaInfo()).setTimestamp(0); assertEquals(readSi.getSchemaInfo(), si); assertEquals(readSi.getVersion(), 0); readSi = admin.schemas().getSchemaInfoWithVersion(topicName + "-partition-0"); log.info("Read schema of topic {} : {}", topicName, readSi); + ((SchemaInfoImpl)readSi.getSchemaInfo()).setTimestamp(0); assertEquals(readSi.getSchemaInfo(), si); assertEquals(readSi.getVersion(), 0); @@ -242,11 +248,19 @@ public void createKeyValueSchema(ApiVersion version) throws Exception { "test"); String topicName = "persistent://"+namespace + "/test-key-value-schema"; Schema keyValueSchema = Schema.KeyValue(Schema.AVRO(Foo.class), Schema.AVRO(Foo.class)); - admin.schemas().createSchema(topicName, - keyValueSchema.getSchemaInfo()); + admin.schemas().createSchema(topicName, keyValueSchema.getSchemaInfo()); SchemaInfo schemaInfo = admin.schemas().getSchemaInfo(topicName); + long timestamp = schemaInfo.getTimestamp(); + assertNotEquals(keyValueSchema.getSchemaInfo().getTimestamp(), timestamp); + assertNotEquals(0, timestamp); + + ((SchemaInfoImpl)keyValueSchema.getSchemaInfo()).setTimestamp(schemaInfo.getTimestamp()); assertEquals(keyValueSchema.getSchemaInfo(), schemaInfo); + + admin.schemas().createSchema(topicName, keyValueSchema.getSchemaInfo()); + SchemaInfo schemaInfo2 = admin.schemas().getSchemaInfo(topicName); + assertEquals(timestamp, schemaInfo2.getTimestamp()); } diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiSchemaWithAuthTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiSchemaWithAuthTest.java index 29c0f97e61074..c0cd511814d04 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiSchemaWithAuthTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiSchemaWithAuthTest.java @@ -18,9 +18,18 @@ */ package org.apache.pulsar.broker.admin; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertThrows; +import static org.testng.Assert.assertTrue; import com.google.common.collect.Sets; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; +import java.util.Base64; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import javax.crypto.SecretKey; import lombok.extern.slf4j.Slf4j; import org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest; import org.apache.pulsar.broker.authentication.AuthenticationProviderToken; @@ -30,6 +39,7 @@ import org.apache.pulsar.client.admin.PulsarAdminException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.auth.AuthenticationToken; +import org.apache.pulsar.client.impl.schema.SchemaInfoImpl; import org.apache.pulsar.common.policies.data.AuthAction; import org.apache.pulsar.common.policies.data.ClusterData; import org.apache.pulsar.common.policies.data.TenantInfoImpl; @@ -38,15 +48,6 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import javax.crypto.SecretKey; -import java.util.Base64; -import java.util.EnumSet; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertThrows; -import static org.testng.Assert.assertTrue; /** * Unit tests for schema admin api. */ @@ -117,10 +118,12 @@ public void testGetCreateDeleteSchema() throws Exception { assertThrows(PulsarAdminException.class, () -> adminWithoutPermission.schemas().getSchemaInfo(topicName)); SchemaInfo readSi = adminWithConsumePermission.schemas().getSchemaInfo(topicName); + ((SchemaInfoImpl)readSi).setTimestamp(0); assertEquals(readSi, si); assertThrows(PulsarAdminException.class, () -> adminWithoutPermission.schemas().getSchemaInfo(topicName, 0)); readSi = adminWithConsumePermission.schemas().getSchemaInfo(topicName, 0); + ((SchemaInfoImpl)readSi).setTimestamp(0); assertEquals(readSi, si); List allSchemas = adminWithConsumePermission.schemas().getAllSchemas(topicName); assertEquals(allSchemas.size(), 1); diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaTest.java index 983a7f341e06d..cb8b8728ceee8 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleSchemaTest.java @@ -18,12 +18,6 @@ */ package org.apache.pulsar.client.api; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Cleanup; -import lombok.Data; -import lombok.NoArgsConstructor; - import static java.nio.charset.StandardCharsets.UTF_8; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotEquals; @@ -31,13 +25,22 @@ import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; - +import java.io.ByteArrayInputStream; +import java.io.EOFException; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Cleanup; +import lombok.Data; +import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.avro.reflect.ReflectData; import org.apache.avro.Schema.Parser; -import org.apache.pulsar.client.impl.MessageImpl; -import org.apache.pulsar.client.impl.schema.KeyValueSchemaImpl; -import org.apache.pulsar.common.schema.LongSchemaVersion; +import org.apache.avro.reflect.ReflectData; import org.apache.pulsar.client.admin.PulsarAdminException; import org.apache.pulsar.client.api.PulsarClientException.IncompatibleSchemaException; import org.apache.pulsar.client.api.PulsarClientException.InvalidMessageException; @@ -45,12 +48,16 @@ import org.apache.pulsar.client.impl.BinaryProtoLookupService; import org.apache.pulsar.client.impl.HttpLookupService; import org.apache.pulsar.client.impl.LookupService; +import org.apache.pulsar.client.impl.MessageImpl; import org.apache.pulsar.client.impl.PulsarClientImpl; +import org.apache.pulsar.client.impl.schema.KeyValueSchemaImpl; +import org.apache.pulsar.client.impl.schema.SchemaInfoImpl; import org.apache.pulsar.client.impl.schema.reader.AvroReader; import org.apache.pulsar.client.impl.schema.writer.AvroWriter; import org.apache.pulsar.common.naming.TopicName; import org.apache.pulsar.common.schema.KeyValue; import org.apache.pulsar.common.schema.KeyValueEncodingType; +import org.apache.pulsar.common.schema.LongSchemaVersion; import org.apache.pulsar.common.schema.SchemaInfo; import org.apache.pulsar.common.schema.SchemaType; import org.testng.Assert; @@ -60,15 +67,6 @@ import org.testng.annotations.Factory; import org.testng.annotations.Test; -import java.io.ByteArrayInputStream; -import java.io.EOFException; -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; - @Test(groups = "broker-api") @Slf4j public class SimpleSchemaTest extends ProducerConsumerBase { @@ -455,6 +453,9 @@ public void newProducerForMessageSchemaOnTopicInitialWithNoSchema() throws Excep } List allSchemas = admin.schemas().getAllSchemas(topic); + allSchemas.forEach(schemaInfo -> { + ((SchemaInfoImpl)schemaInfo).setTimestamp(0); + }); Assert.assertEquals(allSchemas, Arrays.asList(v1Schema.getSchemaInfo(), v2Schema.getSchemaInfo())); } @@ -493,6 +494,9 @@ public void newNativeAvroProducerForMessageSchemaOnTopicInitialWithNoSchema() th } List allSchemas = admin.schemas().getAllSchemas(topic); + allSchemas.forEach(schemaInfo -> { + ((SchemaInfoImpl)schemaInfo).setTimestamp(0); + }); Assert.assertEquals(allSchemas, Arrays.asList(v1Schema.getSchemaInfo(), v2Schema.getSchemaInfo())); } diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java index ac12506a059a9..a9a1efe2ced38 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java @@ -20,7 +20,6 @@ import static org.apache.pulsar.common.naming.TopicName.PUBLIC_TENANT; import static org.apache.pulsar.schema.compatibility.SchemaCompatibilityCheckTest.randomName; - import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; @@ -28,9 +27,6 @@ import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; - -import lombok.EqualsAndHashCode; -import org.apache.avro.Schema.Parser; import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.Sets; import java.io.ByteArrayInputStream; @@ -45,7 +41,9 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import lombok.Cleanup; +import lombok.EqualsAndHashCode; import lombok.extern.slf4j.Slf4j; +import org.apache.avro.Schema.Parser; import org.apache.bookkeeper.client.BKException; import org.apache.bookkeeper.client.BookKeeper; import org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest; @@ -986,6 +984,9 @@ public void testProducerMultipleSchemaMessages() throws Exception { producer.newMessage(Schema.NATIVE_AVRO(personThreeSchemaAvroNative)).value(content).send(); List allSchemas = admin.schemas().getAllSchemas(topic); + allSchemas.forEach(schemaInfo -> { + ((SchemaInfoImpl)schemaInfo).setTimestamp(0); + }); Assert.assertEquals(allSchemas.size(), 5); Assert.assertEquals(allSchemas.get(0), Schema.STRING.getSchemaInfo()); Assert.assertEquals(allSchemas.get(1), Schema.JSON(Schemas.PersonThree.class).getSchemaInfo()); diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/SchemasImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/SchemasImpl.java index c12b801cb52d7..d24f2d982b329 100644 --- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/SchemasImpl.java +++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/SchemasImpl.java @@ -367,6 +367,7 @@ static SchemaInfo convertGetSchemaResponseToSchemaInfo(TopicName tn, return SchemaInfo.builder() .schema(schema) .type(response.getType()) + .timestamp(response.getTimestamp()) .properties(response.getProperties()) .name(tn.getLocalName()) .build(); diff --git a/pulsar-client-api/src/main/java/org/apache/pulsar/client/internal/PulsarClientImplementationBinding.java b/pulsar-client-api/src/main/java/org/apache/pulsar/client/internal/PulsarClientImplementationBinding.java index 73513432cdfee..da85d3645be64 100644 --- a/pulsar-client-api/src/main/java/org/apache/pulsar/client/internal/PulsarClientImplementationBinding.java +++ b/pulsar-client-api/src/main/java/org/apache/pulsar/client/internal/PulsarClientImplementationBinding.java @@ -252,5 +252,6 @@ static byte[] getBytes(ByteBuffer byteBuffer) { return array; } - SchemaInfo newSchemaInfoImpl(String name, byte[] schema, SchemaType type, Map propertiesValue); + SchemaInfo newSchemaInfoImpl(String name, byte[] schema, SchemaType type, long timestamp, + Map propertiesValue); } diff --git a/pulsar-client-api/src/main/java/org/apache/pulsar/common/schema/SchemaInfo.java b/pulsar-client-api/src/main/java/org/apache/pulsar/common/schema/SchemaInfo.java index a71513ab662c5..d47118ac92869 100644 --- a/pulsar-client-api/src/main/java/org/apache/pulsar/common/schema/SchemaInfo.java +++ b/pulsar-client-api/src/main/java/org/apache/pulsar/common/schema/SchemaInfo.java @@ -48,6 +48,11 @@ public interface SchemaInfo { */ Map getProperties(); + /** + * The created time of schema. + */ + long getTimestamp(); + String getSchemaDefinition(); static SchemaInfoBuilder builder() { @@ -60,6 +65,7 @@ class SchemaInfoBuilder { private SchemaType type; private Map properties; private boolean propertiesSet; + private long timestamp; SchemaInfoBuilder() { } @@ -85,6 +91,11 @@ public SchemaInfoBuilder properties(Map properties) { return this; } + public SchemaInfoBuilder timestamp(long timestamp) { + this.timestamp = timestamp; + return this; + } + public SchemaInfo build() { Map propertiesValue = this.properties; if (!this.propertiesSet) { @@ -92,7 +103,7 @@ public SchemaInfo build() { } return DefaultImplementation .getDefaultImplementation() - .newSchemaInfoImpl(name, schema, type, propertiesValue); + .newSchemaInfoImpl(name, schema, type, timestamp, propertiesValue); } } } diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImplementationBindingImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImplementationBindingImpl.java index 972048557f65d..eb555112c2848 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImplementationBindingImpl.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImplementationBindingImpl.java @@ -387,8 +387,8 @@ public MessagePayloadFactory newDefaultMessagePayloadFactory() { return new MessagePayloadFactoryImpl(); } - public SchemaInfo newSchemaInfoImpl( - String name, byte[] schema, SchemaType type, Map propertiesValue) { - return new SchemaInfoImpl(name, schema, type, propertiesValue); + public SchemaInfo newSchemaInfoImpl(String name, byte[] schema, SchemaType type, long timestamp, + Map propertiesValue) { + return new SchemaInfoImpl(name, schema, type, timestamp, propertiesValue); } } diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/RecordSchemaBuilderImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/RecordSchemaBuilderImpl.java index f2e1d1974f5c4..b1a5a4aa49e3f 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/RecordSchemaBuilderImpl.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/RecordSchemaBuilderImpl.java @@ -108,6 +108,7 @@ public SchemaInfo build(SchemaType schemaType) { name, baseSchema.toString().getBytes(UTF_8), schemaType, + System.currentTimeMillis(), properties ); } diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/SchemaInfoTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/SchemaInfoTest.java index 71e0a7e8b5ff7..ba8286c61fd9c 100644 --- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/SchemaInfoTest.java +++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/SchemaInfoTest.java @@ -18,6 +18,9 @@ */ package org.apache.pulsar.client.impl.schema; +import static org.testng.Assert.assertEquals; +import java.util.HashMap; +import java.util.Map; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.common.schema.KeyValueEncodingType; import org.apache.pulsar.common.schema.SchemaInfo; @@ -25,11 +28,6 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import java.util.HashMap; -import java.util.Map; - -import static org.testng.Assert.assertEquals; - /** * Unit test {@link org.apache.pulsar.common.schema.SchemaInfo}. */ @@ -39,6 +37,7 @@ public class SchemaInfoTest { + " \"name\": \"INT32\",\n" + " \"schema\": \"\",\n" + " \"type\": \"INT32\",\n" + + " \"timestamp\": 0,\n" + " \"properties\": {}\n" + "}"; @@ -46,6 +45,7 @@ public class SchemaInfoTest { + " \"name\": \"String\",\n" + " \"schema\": \"\",\n" + " \"type\": \"STRING\",\n" + + " \"timestamp\": 0,\n" + " \"properties\": {}\n" + "}"; @@ -63,6 +63,7 @@ public class SchemaInfoTest { + " ]\n" + " },\n" + " \"type\": \"JSON\",\n" + + " \"timestamp\": 0,\n" + " \"properties\": {\n" + " \"__alwaysAllowNull\": \"true\",\n" + " \"__jsr310ConversionEnabled\": \"false\",\n" @@ -135,6 +136,7 @@ public class SchemaInfoTest { + " ]\n" + " },\n" + " \"type\": \"AVRO\",\n" + + " \"timestamp\": 0,\n" + " \"properties\": {\n" + " \"__alwaysAllowNull\": \"false\",\n" + " \"__jsr310ConversionEnabled\": \"false\",\n" @@ -210,6 +212,7 @@ public class SchemaInfoTest { + " ]\n" + " },\n" + " \"type\": \"AVRO\",\n" + + " \"timestamp\": 0,\n" + " \"properties\": {\n" + " \"__alwaysAllowNull\": \"false\",\n" + " \"__jsr310ConversionEnabled\": \"false\",\n" @@ -232,6 +235,7 @@ public class SchemaInfoTest { + " ]\n" + " },\n" + " \"type\": \"JSON\",\n" + + " \"timestamp\": 0,\n" + " \"properties\": {\n" + " \"__alwaysAllowNull\": \"true\",\n" + " \"__jsr310ConversionEnabled\": \"false\",\n" @@ -242,6 +246,7 @@ public class SchemaInfoTest { + " }\n" + " },\n" + " \"type\": \"KEY_VALUE\",\n" + + " \"timestamp\": 0,\n" + " \"properties\": {\n" + " \"key.schema.name\": \"\",\n" + " \"key.schema.properties\": \"{\\\"__alwaysAllowNull\\\":\\\"false\\\",\\\"__jsr310ConversionEnabled\\\":\\\"false\\\",\\\"foo1\\\":\\\"foo-value1\\\",\\\"foo2\\\":\\\"foo-value2\\\",\\\"foo3\\\":\\\"foo-value3\\\"}\",\n" diff --git a/pulsar-common/src/main/java/org/apache/pulsar/client/impl/schema/SchemaInfoImpl.java b/pulsar-common/src/main/java/org/apache/pulsar/client/impl/schema/SchemaInfoImpl.java index ca8b6ccf9bd28..d67dc5f29e1c8 100644 --- a/pulsar-common/src/main/java/org/apache/pulsar/client/impl/schema/SchemaInfoImpl.java +++ b/pulsar-common/src/main/java/org/apache/pulsar/client/impl/schema/SchemaInfoImpl.java @@ -59,6 +59,11 @@ public class SchemaInfoImpl implements SchemaInfo { */ private SchemaType type; + /** + * The created time of schema. + */ + private long timestamp; + /** * Additional properties of the schema definition (implementation defined). */