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

عرض عملي: انحراف الكتابة (write skew) تحت serializable

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

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

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

في هذا الدرس

reproduce write skew and see SERIALIZABLE stop it.

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

خطوة بخطوة

  1. Rule: at least one admin must stay active. Table admin(id, active) with two active admins.
  2. Under REPEATABLE READ, both transactions check "count of active > 1" and each deactivates a different admin; both commit and no admin remains.
  3. Repeat with SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; one commit fails with 40001.
  4. Planned mistake: run the application code without retry; the user sees an error. Fix: retry the whole transaction a limited number of times.
  5. Mention the alternative: lock a parent row or use a constraint.

اختبر فهمك

Why does REPEATABLE READ allow this?

أظهر الإجابة

Each transaction writes a different row, so there is no write-write conflict.

التطبيق

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

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

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

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