Skip to content

[client] Avoid repeated synchronous schema fetches in ClientSchemaGetter #3336

@Leondon9

Description

@Leondon9

Problem

ClientSchemaGetter#getSchema fetches missing schema IDs synchronously through Admin#getTableSchema, but the fetched schema is not stored in the local schema cache. If callers request the same schema ID again, the client can repeat the same admin metadata request even though the schema was already fetched successfully.

Proposed improvement

Cache schemas fetched through the synchronous fallback path in ClientSchemaGetter#getSchema. This keeps repeated lookups for the same schema ID local after the first successful fetch while preserving the existing latest-schema update behavior.

Benefit

This avoids unnecessary admin metadata calls for repeated schema lookups and makes the synchronous fetch path consistent with cache expectations.

Validation

A focused unit test can verify that two getSchema(schemaId) calls for the same initially missing schema ID only trigger one admin fetch and that latest schema metadata is updated when the fetched schema is newer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions