انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-043-L04

إبقاء الفهرس متزامنًا

  • الدرس 4 من 6
  • Mid-level
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

feed the index from the source of truth without dual-write bugs.

الموضوعات المخطط لها

  • The database is the source of truth; the index is rebuildable.
  • Do not write the database and the index in the same request: one can fail and they diverge (dual write).
  • Use events: catalog publishes ProductUpdated (outbox pattern), an indexer consumes it and upserts the document by product id; deletions as delete events.
  • Use the product version as an external version so older events do not overwrite newer ones.
  • Document a full reindex: new index, bulk load from the database, switch an alias, delete the old index.
تفاصيل المخطط المبدئي

عرض عملي

flow: catalog DB → outbox → broker → indexer → OpenSearch alias products → products_v2.

اختبر فهمك

Why is dual write dangerous?

أظهر الإجابة

One write can fail, leaving database and index inconsistent.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.