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

عرض عملي: مهمة ليلية تعمل مرة واحدة عبر ثلاث نسخ

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

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

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

في هذا الدرس

run reconciliation exactly once and fence its writes. Prepares MID-032-LAB1.

تفاصيل المخطط المبدئي

خطوة بخطوة

  1. Scale orders to three replicas; the @Scheduled reconciliation job runs three times.
  2. Add ShedLock with a JDBC lock provider (verify library and version before recording) and annotate with @SchedulerLock(name = "recon", lockAtMostFor = "10m").
  3. Run again: one replica executes, others skip.
  4. Planned mistake: set lockAtMostFor shorter than the job. A second replica starts while the first still runs. Fix: size it above the worst-case runtime and fence the writes.
  5. Add a lock-generation number as a fencing token on the state table.
  6. Pause the lock holder with docker pause, let the lease expire, let another run, unpause, and show the stale writes are rejected.

التطبيق

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

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

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

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