This is an automated email from the ASF dual-hosted git repository. duhengforever pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/rocketmq-schema-registry.git
commit 92cf6e3c3bcce52c178c6c9ef1c2831b4c8bbf2c Author: huitong <[email protected]> AuthorDate: Thu Jul 21 11:20:42 2022 +0800 fix --- .../common/storage/StorageServiceProxy.java | 6 ++-- .../registry/core/api/v1/SchemaController.java | 32 +++++++++++----------- .../registry/storage/rocketmq/RocketmqClient.java | 1 - 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/common/src/main/java/org/apache/rocketmq/schema/registry/common/storage/StorageServiceProxy.java b/common/src/main/java/org/apache/rocketmq/schema/registry/common/storage/StorageServiceProxy.java index 41feb2c..181739d 100644 --- a/common/src/main/java/org/apache/rocketmq/schema/registry/common/storage/StorageServiceProxy.java +++ b/common/src/main/java/org/apache/rocketmq/schema/registry/common/storage/StorageServiceProxy.java @@ -70,7 +70,7 @@ public class StorageServiceProxy { * * @param name Qualified name with tenant / name of schema */ - @CacheEvict(key = "'schema.' + #name.getSchema()") + @CacheEvict(key = "'schema.' + #name.getTenant() + '/' + #name.getSchema()") public void delete(final QualifiedName name) { final RequestContext requestContext = RequestContextManager.getContext(); final StorageServiceContext storageServiceContext = storageUtil.convertToStorageServiceContext(requestContext); @@ -86,7 +86,7 @@ public class StorageServiceProxy { * @param schemaInfo schema information instance * @return true if errors after this should be ignored. */ - @CacheEvict(key = "'schema.' + #name.getSchema()") + @CacheEvict(key = "'schema.' + #name.getTenant() + '/' + #name.getSchema()") public SchemaInfo update(final QualifiedName name, final SchemaInfo schemaInfo) { final RequestContext requestContext = RequestContextManager.getContext(); final StorageServiceContext storageServiceContext = storageUtil.convertToStorageServiceContext(requestContext); @@ -103,7 +103,7 @@ public class StorageServiceProxy { * @param useCache if schema can be retrieved from cache * @return schema information instance */ - @Cacheable(key = "'schema.' + #name.getSchema()", condition = "#useCache") + @Cacheable(key = "'schema.' + #name.getTenant() + '/' + #name.getSchema()", condition = "#useCache") public SchemaInfo get(final QualifiedName name, final boolean useCache) { final RequestContext requestContext = RequestContextManager.getContext(); final StorageServiceContext storageServiceContext = storageUtil.convertToStorageServiceContext(requestContext); diff --git a/core/src/main/java/org/apache/rocketmq/schema/registry/core/api/v1/SchemaController.java b/core/src/main/java/org/apache/rocketmq/schema/registry/core/api/v1/SchemaController.java index 558d652..97fe8bb 100644 --- a/core/src/main/java/org/apache/rocketmq/schema/registry/core/api/v1/SchemaController.java +++ b/core/src/main/java/org/apache/rocketmq/schema/registry/core/api/v1/SchemaController.java @@ -92,9 +92,9 @@ public class SchemaController { ) public SchemaDto registerSchema( @ApiParam(value = "The subject of the schema", required = true) - @PathVariable(name = "subject-name") final String subject, + @PathVariable(value = "subject-name") final String subject, @ApiParam(value = "The name of the schema", required = true) - @PathVariable("schema-name") final String schemaName, + @PathVariable(value = "schema-name") final String schemaName, @ApiParam(value = "The schema detail", required = true) @RequestBody final SchemaDto schemaDto ) { @@ -129,9 +129,9 @@ public class SchemaController { @ApiParam(value = "The tenant of the schema", required = true) @PathVariable(value = "tenant-name") final String tenant, @ApiParam(value = "The subject of the schema", required = true) - @PathVariable(name = "subject-name") final String subject, + @PathVariable(value = "subject-name") final String subject, @ApiParam(value = "The name of the schema", required = true) - @PathVariable("schema-name") final String schemaName, + @PathVariable(value = "schema-name") final String schemaName, @ApiParam(value = "The schema detail", required = true) @RequestBody final SchemaDto schemaDto ) { @@ -175,7 +175,7 @@ public class SchemaController { @ApiParam(value = "The tenant of the schema", required = true) @PathVariable(value = "tenant-name") final String tenant, @ApiParam(value = "The subject of the schema", required = true) - @PathVariable("subject-name") final String subject + @PathVariable(value = "subject-name") final String subject ) { QualifiedName name = new QualifiedName(cluster, tenant, subject, null); return this.requestProcessor.processRequest( @@ -212,9 +212,9 @@ public class SchemaController { @ApiParam(value = "The tenant of the schema", required = true) @PathVariable(value = "tenant-name") final String tenant, @ApiParam(value = "The subject of the schema", required = true) - @PathVariable("subject-name") final String subject, + @PathVariable(value = "subject-name") final String subject, @ApiParam(value = "The version of the schema", required = true) - @PathVariable("version") final String version + @PathVariable(value = "version") final String version ) { QualifiedName name = new QualifiedName(cluster, tenant, subject, null, Long.valueOf(version)); return this.requestProcessor.processRequest( @@ -248,9 +248,9 @@ public class SchemaController { ) public SchemaDto updateSchema( @ApiParam(value = "The subject of the schema", required = true) - @PathVariable(name = "subject-name") final String subject, + @PathVariable(value = "subject-name") final String subject, @ApiParam(value = "The name of the schema", required = true) - @PathVariable("schema-name") final String schemaName, + @PathVariable(value = "schema-name") final String schemaName, @ApiParam(value = "The schema detail", required = true) @RequestBody final SchemaDto schemaDto ) { @@ -284,9 +284,9 @@ public class SchemaController { @ApiParam(value = "The tenant of the schema", required = true) @PathVariable(value = "tenant-name") final String tenant, @ApiParam(value = "The subject of the schema", required = true) - @PathVariable(name = "subject-name") final String subject, + @PathVariable(value = "subject-name") final String subject, @ApiParam(value = "The name of the schema", required = true) - @PathVariable("schema-name") final String schemaName, + @PathVariable(value = "schema-name") final String schemaName, @ApiParam(value = "The schema detail", required = true) @RequestBody final SchemaDto schemaDto ) { @@ -320,7 +320,7 @@ public class SchemaController { ) public SchemaRecordDto getSchemaBySubject( @ApiParam(value = "The name of the subject", required = true) - @PathVariable("subject-name") String subject + @PathVariable(value = "subject-name") String subject ) { return getSchemaBySubject(DEFAULT_CLUSTER, DEFAULT_CLUSTER, subject); } @@ -350,7 +350,7 @@ public class SchemaController { @ApiParam(value = "The tenant of the schema", required = true) @PathVariable(value = "tenant-name") final String tenant, @ApiParam(value = "The name of the subject", required = true) - @PathVariable("subject-name") String subject + @PathVariable(value = "subject-name") String subject ) { QualifiedName name = new QualifiedName(cluster, tenant, subject, null); log.info("Request for get schema for subject: {}", name.subjectFullName()); @@ -386,9 +386,9 @@ public class SchemaController { @ApiParam(value = "The tenant of the schema", required = true) @PathVariable(value = "tenant-name") final String tenant, @ApiParam(value = "The name of the subject", required = true) - @PathVariable("subject-name") String subject, + @PathVariable(value = "subject-name") String subject, @ApiParam(value = "The version of the schema", required = true) - @PathVariable("version") String version + @PathVariable(value = "version") String version ) { QualifiedName name = new QualifiedName(cluster, tenant, subject, null, Long.parseLong(version)); @@ -423,7 +423,7 @@ public class SchemaController { @ApiParam(value = "The tenant of the schema", required = true) @PathVariable(value = "tenant-name") final String tenant, @ApiParam(value = "The name of the subject", required = true) - @PathVariable("subject-name") String subject + @PathVariable(value = "subject-name") String subject ) { QualifiedName name = new QualifiedName(cluster, tenant, subject, null); diff --git a/schema-storage-rocketmq/src/main/java/org/apache/rocketmq/schema/registry/storage/rocketmq/RocketmqClient.java b/schema-storage-rocketmq/src/main/java/org/apache/rocketmq/schema/registry/storage/rocketmq/RocketmqClient.java index 5af299d..87cde86 100644 --- a/schema-storage-rocketmq/src/main/java/org/apache/rocketmq/schema/registry/storage/rocketmq/RocketmqClient.java +++ b/schema-storage-rocketmq/src/main/java/org/apache/rocketmq/schema/registry/storage/rocketmq/RocketmqClient.java @@ -52,7 +52,6 @@ import org.apache.rocketmq.schema.registry.common.json.JsonConverterImpl; import org.apache.rocketmq.schema.registry.common.model.SchemaInfo; import org.apache.rocketmq.schema.registry.common.model.SchemaRecordInfo; import org.apache.rocketmq.schema.registry.common.model.SubjectInfo; -import org.apache.rocketmq.store.DefaultMessageStore; import org.apache.rocketmq.tools.admin.DefaultMQAdminExt; import org.rocksdb.ColumnFamilyDescriptor; import org.rocksdb.ColumnFamilyHandle;
