0Pricing
Apache Kafka & Stream Processing Fundamentals · レッスン

スキーマ進化と互換性モード

Confluent Schema Registryがスキーマ変更時の互換性を強制する方法と、後方・前方・完全互換性を安全に選ぶ方法を学びます。

「スキーマ進化と互換性モード」はCoddyKit上の無料Apache Kafka & Stream Processing Fundamentalsレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはApache Kafka & Stream Processing Fundamentals学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Apache Kafka & Stream Processing Fundamentalsコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Why Schemas Evolve

Data contracts change over time — you add fields, deprecate others, rename things. Schema evolution is the discipline of changing schemas without breaking existing producers and consumers.

The Compatibility Problem

Producers and consumers often deploy at different times. A new producer might emit a v2 schema while old consumers still expect v1.

Without rules, that mismatch causes deserialization failures in production.

Backward Compatibility

Backward: new schema can read data written with the old schema.

  • Safe changes: delete a field, add a field with a default.
  • Upgrade consumers first.

Forward Compatibility

Forward: old schema can read data written with the new schema.

  • Safe changes: add a field, delete a field that had a default.
  • Upgrade producers first.

Full Compatibility

Full requires both backward and forward compatibility at once.

  • Only changes safe in both directions are allowed (add/remove fields with defaults).
  • Producers and consumers can be upgraded in any order.

Transitive Variants

Each mode has a transitive version (BACKWARD_TRANSITIVE, etc.).

Non-transitive checks only against the latest schema; transitive checks against all prior versions — stronger guarantees, more constraints.

Setting Compatibility

Compatibility is configured per subject (or globally) via the Schema Registry REST API.

curl -X PUT \
  http://localhost:8081/config/orders-value \
  -H 'Content-Type: application/vnd.schemaregistry.v1+json' \
  -d '{"compatibility": "BACKWARD"}'

A Backward-Safe Avro Change

Adding a field with a default keeps old data readable under BACKWARD mode.

{
  "type": "record",
  "name": "Order",
  "fields": [
    {"name": "id", "type": "string"},
    {"name": "amount", "type": "double"},
    {"name": "currency", "type": "string", "default": "USD"}
  ]
}

Testing Before You Register

The registry can check a candidate schema against the current one before you commit it.

curl -X POST \
  http://localhost:8081/compatibility/subjects/orders-value/versions/latest \
  -H 'Content-Type: application/vnd.schemaregistry.v1+json' \
  -d '{"schema": "...escaped avro..."}'

Breaking Changes

Changes that almost always break compatibility:

  • Renaming a field (treated as delete + add).
  • Changing a field's type incompatibly.
  • Adding a required field with no default.

For these, create a new subject/topic version instead.

Choosing a Mode

Rules of thumb:

  • BACKWARD (default) when you upgrade consumers first.
  • FORWARD when producers lead.
  • FULL for independently deployed teams.
  • Use transitive variants for long-lived, replayable topics.

Quick Check

Test your understanding of compatibility modes.

Recap

You learned schema evolution and compatibility modes.

  • BACKWARD: new reads old, upgrade consumers first.
  • FORWARD: old reads new, upgrade producers first.
  • FULL: both, any order.
  • Transitive variants check all prior versions; renames and required no-default fields break compatibility.

よくある質問

「スキーマ進化と互換性モード」レッスンは無料ですか?

はい。「スキーマ進化と互換性モード」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Apache Kafka & Stream Processing Fundamentalsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Apache Kafka & Stream Processing Fundamentalsコースには全4レッスンが含まれています。

「スキーマ進化と互換性モード」で何を学びますか?

Confluent Schema Registryがスキーマ変更時の互換性を強制する方法と、後方・前方・完全互換性を安全に選ぶ方法を学びます。 ブラウザで直接実行するハンズオンコードでApache Kafka & Stream Processing Fundamentalsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Apache Kafka & Stream Processing Fundamentalsを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのApache Kafka & Stream Processing Fundamentalsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「スキーマ進化と互換性モード」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このApache Kafka & Stream Processing Fundamentalsレッスンでコードを書いて実行できますか?

はい。すべてのApache Kafka & Stream Processing Fundamentalsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. なぜスキーマ管理が必要なのか
  2. AvroとProtobufのスキーマ
  3. Schema RegistryとKafkaの統合
  4. スキーマ進化と互換性モード
← Apache Kafka & Stream Processing Fundamentalsに戻る