Chapter 19 · Course 1 c19-m01
What did the table contain yesterday?
Your goal Compare old and current states of a versioned table to find an authorization added later.
The lesson, the vocabulary, the worked example and the mission are separate blocks. You can follow them in order or return to the one you need.
Video explanation
This English explanation has English subtitles. Its examples may use a separate practice dataset; use the data stated in the written mission for your answers.
Story · optional context
The story so far
You are Aster Motors' new data recruit. Luca was hurt when a car resembling the missing Noctis 01 prototype crashed, and Voss accuses you of authorizing its departure. Mara Sol and Imani showed that the second gate command, OPEN-18, predates the crash according to the controller clock although it was received later. The calculation survived a restart. Imani has now found two versions of the authorization register: one before the circulated report and another used to accuse you.
This lesson stands alone. An Iceberg table is a data table whose versions are described by metadata and snapshots. Reading an old snapshot lets us inspect the table's logical state at that point if the version has been retained. You will compare two fictional register snapshots, calculate the differences, and explain why a change does not automatically identify the person who made it.
Before the lesson
Purpose of this course
Compare old and current states of a versioned table to find an authorization added later.
Topics covered
Explain an Iceberg snapshot without confusing it with an ordinary copied file.; Read an old state by snapshot identifier and compare it with the current state.; Identify a changed value separately from a newly present command.; State retention requirements and the limit of the evidence about the writer.
What you will learn
- Explain an Iceberg snapshot without confusing it with an ordinary copied file.
- Read an old state by snapshot identifier and compare it with the current state.
- Identify a changed value separately from a newly present command.
- State retention requirements and the limit of the evidence about the writer.
PART 1 · THE LESSON
Understand step by step
Lesson · explanation
Voss shows only one version of the register
You are Aster Motors' new data recruit. Luca was hurt in a crash involving a car resembling the missing Noctis 01 prototype, and Voss accuses you of authorizing its departure. Mara and Imani observed that OPEN-18 carries a time before the crash signal even though its message arrived later. The calculation survived a restart. Voss now shows a register in which your authorization appears present.
Imani has the ID of an older version of that same register. Her question is not merely 'does the current table carry your name?' but 'what did the table say before the report used to accuse you?' Current state may have changed since the events being examined. Read the older version without overwriting the newer one, then compare the same fields.
Picture a notebook with every complete edition retained. Yesterday's edition has the 'authorized by recruit' box unchecked; today's edition has it checked. Looking only at today's page cannot tell you it was already checked yesterday. Comparing editions shows a change but not necessarily who held the pen.
This lesson aims to explain an Iceberg snapshot, compare fictional S100 and S101, and state the evidence limit. Time presses in the story, but the exercise has no timer. No real Iceberg table is changed; a small Python example only makes the comparison easier to see.
Pause and think
Why can the current register alone not tell us what it showed earlier?
See the explanation
Its values may have changed; read and compare a retained older version.
Lesson · explanation
An Iceberg table has a consistent history
A data table resembles a large sheet of rows and columns. Iceberg organizes it with metadata: information describing which data belong to each version. A snapshot refers to one consistent table state after an operation. It is more than an image of a screen or one isolated log message.
Imagine a library with a dated catalog pointing to the books on its shelves at that moment. The catalog need not contain every book, but it identifies a coherent collection. Similarly, Iceberg metadata identifies which files form a table state at a given snapshot. Reading that version should reconstruct rows belonging to that state.
In the case, S100 and S101 are authorization-register snapshot IDs. S100 names the retained older state. S101 names a later state presented as current in the copy. Exact IDs prevent confusion between similar tables. Comparing S100 from one table with S101 from another could invent a change that never happened.
The lesson's Python script uses dictionaries and deepcopy to imitate separate states. It creates no real Iceberg table and shows no actual metadata files. This simplification teaches the logical question: what values did each version contain? In a real investigation, query the snapshots through a compatible engine and record the table and query used.
Pause and think
Is an Iceberg snapshot merely a screenshot of the register?
See the explanation
No. It refers to a consistent table state described by metadata and files.
Lesson · explanation
Time travel reads a retained old state
Time travel means querying an older snapshot instead of the current state. If S100 and its referenced files remain available, Mara can read it without turning S101 back into S100. Picture opening yesterday's notebook edition while today's still lies on the table. Both can be compared without destroying either one.
A compatible engine may select an old version by snapshot ID or by time, using engine-specific syntax. In this mission, S100 is simpler because it identifies the exact version Imani wants. A time alone could be misread if zones or commit moments are confused. Note the selection method so another investigator can find the same state.
Time travel does not mean every past version lives forever. If an old snapshot expired or its necessary files are gone, reading may fail. A screenshot of the old table is not a perfect replacement: it may omit rows or provenance. Check that the retained version exists and can be read before depending on it.
Calling a query of S100 a 'restore' would also be misleading. Reading the old state does not automatically erase the current state or repair the table. In this lesson, observe first. Any correction comes later with responsible people and protected evidence. The first job is to learn what both versions actually said.
Pause and think
What does time travel to S100 allow if its files still exist?
See the explanation
Reading the register's older state without overwriting later S101.
Lesson · explanation
Compare a value that changed
Snapshot S100 describes SHELL-02 with authorized_by_recruit=false. In that table state, the field does not mark your authorization. Snapshot S101 describes the same shell with authorized_by_recruit=true. Compare the same column for the same vehicle to see false → true. This is an observable difference between two states, not a guess from a chart.
Picture two cards both labeled SHELL-02. On the first, the authorization box is unchecked; on the second, checked. First ensure the cards concern the same shell and register. Comparing different vehicles or tables would produce a false difference. Here vehicle=SHELL-02 keeps the subject fixed.
This change contradicts a claim that 'S100 already showed your authorization.' In the retained copy, S100 says otherwise. But false → true does not reveal exactly when the field was written, whether several fields changed in one operation, or which person changed it. Snapshots show states, not video of every keystroke.
The Python code creates an original dictionary, keeps a copy as S100, then makes another copy and changes the value before calling it S101. deepcopy stops modifying S101 from silently changing S100. The script prints S100_still_false True to check separation in the demonstration. That local test does not prove a real table's integrity.
Pause and think
How does authorized_by_recruit differ for SHELL-02?
See the explanation
S100 has false and S101 has true; the value changed between states.
Lesson · explanation
Find a newly present command separately
S100's command list contains only OPEN-17. S101 contains OPEN-17 and OPEN-18. The newly present command is OPEN-18. This is a second observation, separate from false becoming true. The changes appear between the same versions, but proximity does not prove one person or one action caused both.
Picture two piles of cards. Put S100 cards on the left and S101 cards on the right; mentally remove cards present in both. OPEN-17 is shared. OPEN-18 remains on the right. The code does the same with sets: S101 commands minus S100 commands, producing a list containing OPEN-18.
If the question also concerned removed commands, check the difference the other way. Here no S100 command is absent from S101: OPEN-17 remains. Saying only 'the lists differ' is less useful because it names neither an addition nor a removal. A clear comparison writes old and new values and computes the differences needed for the question.
OPEN-18 was already recognized as a distinct command in the stream lessons. Its appearance in the register gives Imani a lead to connect with gate events and table versions. It does not prove your account authorized an opening or that Voss wrote S101. Check access sources, commits, and times before assigning a cause.
Pause and think
Which command appears in S101 but not S100?
See the explanation
OPEN-18. OPEN-17 is present in both versions.
Lesson · explanation
A visible change does not name its writer
The comparison establishes two facts in the copy: authorization changes from false to true, and OPEN-18 appears. It does not show who wrote S101, which account was used, or the exact moment each field changed. A snapshot represents a state after an operation, and one operation may change several rows or columns. Two states are not a video of every keystroke.
Imagine entering a room and finding a chair moved. Yesterday's and today's photos prove its position changed; they do not show who moved it. To seek the person, you need other clues: access records, times, people present, and change logs. Imani similarly looks for commits and independent access logs around the register.
Record snapshot commit times, but do not automatically equate them with when each gate command was created. A commit marks a table version. A gate event has its own time, and a message may arrive still later. Earlier lessons showed how event and receipt times differ. Keep those categories separate here too.
Voss presents the current register bearing your name as if it also described the older state. S100 contradicts that claim for the observed field, provided its source and retention are verified. This weakens his argument but does not automatically establish deliberate falsification or a culprit. A measured conclusion lets Mara check the lead.
Pause and think
Can the two snapshots tell us who changed the authorization?
See the explanation
No. They show a difference between states; independent commit and access records are needed to investigate the writer.
Lesson · explanation
Preserve S100 before it becomes unreadable
Reading an old state still requires its metadata and the files referenced by its snapshot. An expiration policy may remove old snapshots and make S100 unavailable. Picture removing an old edition from the catalog and destroying the pages it points to: knowing it existed no longer lets you read it. Mara must know retention rules before cleanup runs.
Compaction may reorganize files for technical reasons. By itself, it should not prevent reading a snapshot still retained if its necessary files remain available. The concrete danger is expiration or cleanup that removes what S100 references. Do not use 'saved' as a vague guarantee; verify that the version and its data can actually be read.
Mara records table ID, exact S100 and S101 IDs, metadata and commit times, and the queries that read each version. She exports needed results to an authorized case archive and keeps a digest of working exports. A digest helps later check whether a working copy changed without notice.
Do not change retention policy urgently without approval from the evidence owner. That person decides how to preserve the version before expiration and documents the action. A lone screenshot sent in a message cannot reliably tie a result to the correct table and snapshot. Reading context is part of the evidence.
Pause and think
What must remain available to read S100?
See the explanation
Its retained snapshot, metadata, and the files it references.
Lesson · explanation
Present the comparison without overclaiming
Begin the mission by defining S100 and S101 as two consistent states of the same versioned table. Explain that time travel reads S100 while it remains available. Then give a simple comparison: S100, SHELL-02, authorization false, command OPEN-17; S101, SHELL-02, authorization true, commands OPEN-17 and OPEN-18. The difference is clear without inventing a hidden scene.
Write a limited conclusion: 'The observed register changed between S100 and S101. The older version did not show the authorization Voss displays in the newer version, and OPEN-18 appears in the latter. These states alone do not identify who made the change.' This protects against an accusation based only on current state while leaving the investigation open.
Add the checking method: exact IDs, source table, commit times, queries, metadata, and verifiable exports. Then request change and access logs to seek the writer. Do not treat the lead as magical proof. If S100 expires or its origin is doubtful, Mara cannot repeat the comparison reliably.
The next lesson shows how a table can add fields without breaking readers of old versions. For now, you can state what the register said before and after, and what needs checking. In a mystery, a hidden page may change the story; in a data investigation, it must remain readable and traceable too.
Pause and think
What conclusion is justified by S100 and S101?
See the explanation
Authorization changes from false to true and OPEN-18 appears between states; the snapshots alone do not identify the writer.
Visual guide
Two versions, one decisive difference
- 1S100: authorization false; OPEN-17
- 2S101: authorization true; OPEN-17 and OPEN-18
- 3Difference: false → true and OPEN-18 added
- 4Next question: origin and writer of the change
The comparison shows what changed; independent traces are needed to attribute the action.
Code · read each line
Compare two fictional snapshots
from copy import deepcopy
original={"vehicle":"SHELL-02","authorized_by_recruit":False,"command_ids":["OPEN-17"]}
history={"S100":deepcopy(original)}
changed=deepcopy(original)
changed["authorized_by_recruit"]=True
changed["command_ids"].append("OPEN-18")
history["S101"]=deepcopy(changed)
old=history["S100"]
current=history["S101"]
print("S100",old["authorized_by_recruit"],old["command_ids"])
print("S101",current["authorized_by_recruit"],current["command_ids"])
print("authorization_changed",old["authorized_by_recruit"]!=current["authorized_by_recruit"])
print("new_commands",sorted(set(current["command_ids"])-set(old["command_ids"])))
print("S100_still_false",history["S100"]["authorized_by_recruit"] is False)The script creates S100 and then S101 without changing S100. It shows the authorization change and newly added OPEN-18. It is not an Iceberg implementation.
PART 2 · WATCH IT WORK
A complete worked example
Follow each step, then the result
Worked example: the disputed authorization
S100 says false and OPEN-17. S101 says true, OPEN-17, and OPEN-18.
- Read S100 as the older state and note false.
- Read S101 as the newer state and note true.
- Find commands present only in S101: OPEN-18.
- Conclude that the versions differ; request commit traces before naming a writer.
A retained snapshot lets us compare table states, but a visible difference does not automatically identify its author.
How this helps with your missionFor the mission, explain S100 and S101 as consistent states of the same Iceberg table. Read S100 only while its snapshot and files remain. Compare SHELL-02: authorized_by_recruit=false and OPEN-17 in S100; true, OPEN-17, and OPEN-18 in S101. Conclude that a change is visible, not that a writer is known. Record table, IDs, commit times, queries, metadata, checked exports, and retention rules before any authorized expiration.
PART 3 · YOUR TURN
Use the lesson to solve the mission
Story scene · practical task
Mission: the version Voss did not show
In the investigation room, Voss displays the current register with your name. Imani hands Mara S100, an older snapshot ID. In the story you have minutes to prepare a comparison before Voss demands a decision. The exercise itself has no timer.
Your task
- Explain what S100 and S101 represent and what time travel does.
- List the old and new authorization values and commands.
- Write a limited conclusion about the register change.
- Name what must be retained to keep the comparison checkable.
How to know you have succeeded
- Snapshots correctly described as retained coherent states.
- False → true and added OPEN-18 identified.
- Change demonstrated, writer not identified by snapshots alone.
- IDs, metadata, queries, exports, and retention documented.
Try code or SQL and keep a local draft. The mission questions are checked separately below.
See the worked answer
- S100 and S101 are coherent Iceberg table states. Time travel can read S100 while its metadata and files remain available.
- S100: false and OPEN-17. S101: true, OPEN-17, and OPEN-18. OPEN-18 is newly present.
- The register changed between versions, weakening a claim that S101 was already the old state. This comparison does not prove who wrote it.
- Keep snapshot IDs, source table, commit times, queries, and verified exports. Protect S100 from expiration until authorized archiving is complete.
You recovered what the register said before it changed. The next lesson shows how to add fields without breaking readers of older versions.
Before you leave
Remember this
- Iceberg describes table versions through metadata; a snapshot refers to a consistent state, not a screenshot.
- Time travel reads a retained old version without overwriting current state.
- For SHELL-02, S100 has
authorized_by_recruit=falseand OPEN-17; S101 hastrueand OPEN-18 too. - Change is visible between states, but snapshots alone reveal neither the writer nor exactly when each field changed.
- An older state is readable only while its snapshot, metadata, and files remain available.
- Preserve IDs, source table, commits, queries, and verifiable exports before expiration removes S100.
Continue with the integrated lessons
After the lesson and its mission, work through the additional lessons below in order. Each workshop supplies its own fictional data: do not merge identifiers or times from separate exercises into the story timeline.
Part of the lesson · keep nearby
New words, explained
These are the names of ideas used in the lesson above. Return here whenever a word feels unfamiliar.
- Iceberg table
- A table whose data and metadata track coherent versions.
- Snapshot
- A reference to one consistent table state after an operation.
- Metadata
- Information describing the table, its versions, and which files to read.
- Time travel
- Reading a retained old version using a snapshot or point in time.
- Current state
- The version the table normally presents now.
- Difference
- A visible change between two states, such as false becoming true.
- Snapshot identifier
- A number or label that identifies the exact version read.
- Expiration
- Planned removal of old snapshots that may make a past version unreadable.
Approfondissements de ce cours
Comprendre les quorums et la réparation de lecture
Si chaque réplica a une probabilité p d’être indisponible et si les pannes sont indépendantes, la probabilité que les n réplicas soient tous indisponibles vaut p^n, tandis que celle d’en avoir au moins un indisponible vaut 1−(1−p)^n. Ajouter des copies dégrade donc la disponibilité d’un système qui exige toutes les réponses, mais peut améliorer un système tolérant certaines absences. L’indépendance est une approximation : alimentation, réseau, logiciel et procédures peuvent provoquer des fautes communes.
Pour p=0,01, une copie a 1 % de risque d’absence. Avec trois copies, toutes absentes vaut 10^-6, au moins une vaut environ 2,97 % et une majorité absente vaut environ 0,0298 %. Avec cinq copies, toutes absentes vaut 10^-10 et au moins une environ 4,90 %. Les chiffres minuscules obtenus pour cent copies indépendantes ne sont pas des garanties réalistes de service ; ils illustrent surtout l’importance du modèle de panne et du seuil requis.
Écrire seulement sur B puis lire seulement sur A peut faire relire une valeur ancienne. La cohérence read-your-writes exige qu’un client retrouve sa dernière écriture ou une version qui l’a remplacée, pas nécessairement son contenu exact si un autre écrivain l’a modifié ensuite. Exiger les deux réponses sur deux réplicas élimine ce cas simple mais rend l’opération indisponible dès qu’un réplica manque.
Avec n réplicas, une écriture attend w accusés et une lecture r réponses. Si r+w>n, les ensembles s’intersectent : au moins un répondant à la lecture a vu une écriture complétée sur le quorum. Les versions jointes permettent de choisir la plus récente parmi les réponses. La majorité stricte vaut n//2+1 : deux sur trois, trois sur cinq, mais aussi trois sur quatre. Une lecture supporte n−r absences et une écriture n−w. Il existe d’autres constructions de quorums que les majorités ; le raisonnement fondamental porte sur leurs intersections.
Une copie peut toujours manquer une mise à jour. L’anti-entropie la propage entre réplicas ; la réparation de lecture permet aussi au client de renvoyer une version récente vers les répondants anciens, voire vers une copie qui n’a pas répondu. On conserve son timestamp original, puisque c’est une retransmission et non une nouvelle écriture. Cette famille est souvent appelée Dynamo-style, mais les algorithmes de quorums et de mémoire répliquée sont antérieurs au Dynamo d’Amazon. L’intersection seule ne garantit pas la linéarisabilité de toutes les opérations concurrentes.
Exemple appliqué aux données
from itertools import combinations
from math import comb
nœuds = set('ABCDE')
quorums = [set(q) for q in combinations(nœuds, 3)]
assert all(a & b for a in quorums for b in quorums)
p = 0.01
majorité_absente = sum(comb(3,k)*p**k*(1-p)**(3-k) for k in range(2,4))
assert abs(majorité_absente - 0.000298) < 1e-12
assert abs((1-(1-p)**3) - 0.029701) < 1e-12
Simulation Python locale à exécuter séparément. Les assertions vérifient les cas présentés ; ce code ne constitue pas une implémentation distribuée de production.
À toi de jouer
Énumère toutes les paires de quorums de taille trois sur cinq nœuds et vérifie leur intersection. Calcule combien de nœuds peuvent être absents pour r=2,w=4,n=5 ; indique le compromis obtenu.
Voir la correction expliquée
Deux ensembles de trois sur cinq ne peuvent être disjoints, car ils demanderaient six nœuds distincts. Avec r=2,w=4, r+w=6>5 ; les lectures tolèrent trois absences et les écritures une seule. Les seuils favorisent donc la lecture au prix d’une plus faible disponibilité en écriture, sous les hypothèses de versions et de protocole retenues.
Références : Notes originales de Martin Kleppmann — Cambridge 2025/26.
Adapté de Distributed Systems — notes de cours 2025/26, Martin Kleppmann, University of Cambridge, pages 54–57. Consulter le PDF source et ses illustrations · Provenance. Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) — adaptation française et exemples modifiés
Reconnaître une histoire linéarisable
La linéarisabilité décrit le comportement observable d’un objet concurrent comme s’il n’existait qu’une copie et que chaque opération prenait effet en un instant compris entre son appel et son retour. Elle peut s’appliquer à un registre get/set ou à d’autres objets. Le terme « cohérence forte » est trop vague pour remplacer ce contrat précis. Des accès mémoire sur une machine multicœur demandent eux aussi des garanties et mécanismes adaptés ; les caches ne rendent pas automatiquement tout programme linéarisable.
Pour une écriture terminée avant le début d’une lecture, la lecture doit retourner cette valeur ou une écriture plus récente dans l’histoire autorisée. Si lecture et écriture se chevauchent, la lecture peut voir l’ancienne ou la nouvelle valeur selon le point de linéarisation choisi. Il faut trouver une seule histoire séquentielle expliquant tous les résultats, tout en conservant l’ordre réel des opérations qui ne se chevauchent pas.
Cet ordre réel n’est pas happens-before : deux clients peuvent ne s’être jamais parlé et avoir néanmoins des opérations non chevauchantes. Le modèle utilise un observateur global hypothétique pour définir les intervalles ; une horloge parfaite n’a pas besoin d’exister physiquement pour que la propriété soit définie. Le contrôle d’une trace réelle doit cependant tenir compte de l’incertitude des observations et ne pas déduire un ordre plus précis que les mesures disponibles.
La sérialisabilité porte sur l’effet équivalent des transactions à une exécution séquentielle, sans imposer nécessairement l’ordre temporel réel. La sérialisabilité stricte combine la sérialisabilité avec cet ordre réel des transactions. La linéarisabilité d’une opération isolée ne garantit pas automatiquement l’atomicité d’un ensemble arbitraire de plusieurs opérations ; définir la frontière de l’objet ou de la transaction compte.
Même r+w>n peut laisser une histoire non linéarisable. Une écriture encore en cours atteint seulement A. Une première lecture de quorum A,B voit la nouvelle valeur, puis une seconde lecture, commencée après la première, consulte B,C et ne voit que l’ancienne. La nouvelle valeur observée puis perdue ne peut pas s’expliquer par une unique copie sans écriture intermédiaire. Ce contre-exemple justifie une étape supplémentaire à la lecture.
À toi de jouer
Une écriture de 9 est encore en cours ; une lecture retourne 9, puis une autre lecture non chevauchante retourne 4, l’ancienne valeur, sans autre écriture. Cette histoire peut-elle être linéarisable ?
Voir la correction expliquée
Non : pour expliquer la première lecture, l’écriture de 9 doit déjà avoir pris effet dans l’ordre abstrait. La seconde lecture, postérieure, ne peut revenir à 4 sans opération qui l’écrive. Une simple visibilité de quorum pendant une écriture partielle n’offre donc pas le contrat recherché.
Références : Notes originales de Martin Kleppmann — Cambridge 2025/26.
Adapté de Distributed Systems — notes de cours 2025/26, Martin Kleppmann, University of Cambridge, pages 63–66. Consulter le PDF source et ses illustrations · Provenance. Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) — adaptation française et exemples modifiés
Construire un registre atomique avec ABD
L’algorithme ABD, nommé d’après Attiya, Bar-Noy et Dolev, fournit un registre get/set linéarisable au moyen de quorums. Pour commencer, supposons un seul écrivain, qui associe à chaque écriture une version croissante, l’envoie aux réplicas et attend un quorum d’accusés. Chaque réplica conserve la plus grande version connue. La lecture interroge un quorum et choisit la plus grande version parmi les réponses.
La lecture ne retourne pas immédiatement cette valeur : elle la réécrit avec sa version d’origine et attend qu’un quorum la possède. Cette seconde phase ressemble à la réparation de lecture mais fait partie de la condition de retour, plutôt qu’une optimisation facultative en arrière-plan. Quand une lecture ou écriture se termine, la version observée est donc présente sur un quorum ; toute opération suivante doit intersecter cet ensemble et observer une version au moins aussi récente.
Avec plusieurs écrivains, chaque écriture commence par lire les versions d’un quorum. Elle choisit un compteur supérieur au maximum obtenu et le combine à une identité d’écrivain unique, pour départager deux propositions concurrentes. Elle écrit ce couple ordonné et la valeur vers un quorum. Les opérations non chevauchantes respectent ainsi un ordre de versions compatible avec le temps réel. La sélection du maximum doit être identique sur tous les nœuds.
ABD supporte des écritures aveugles : set remplace la valeur sans tester son contenu précédent. Deux écrivains peuvent se remplacer selon l’ordre choisi et certaines intentions concurrentes disparaître. Un compare-and-swap, ou CAS, doit au contraire remplacer x par new seulement si sa valeur est encore old, et retourner un succès ou un échec cohérent. Appliquer un test sur un quorum avec des ordres d’arrivée différents ne suffit pas à donner ce CAS atomique.
Une machine à états au-dessus d’une diffusion en ordre total peut fournir get et CAS : diffuser la demande, attendre sa livraison, lire ou tester/modifier l’état local déterministement, puis retourner le résultat correspondant à cette demande. Toutes les copies exécutent les opérations dans le même ordre. L’algorithme ABD est asynchrone pour ses lectures/écritures tant qu’un quorum peut répondre ; le CAS linéarisable nécessite des hypothèses supplémentaires liées au consensus. Ne pas attribuer à ABD un pouvoir qu’il n’a pas.
Exemple appliqué aux données
# Simulation d'un get ABD : lecture puis écriture de retour avant réponse.
réplicas = {'A': ((1,'a'), 9), 'B': ((0,'a'), 4), 'C': ((0,'a'), 4)}
lu = max(réplicas[n] for n in ['A','B'])
for n in ['A','B']:
réplicas[n] = max(réplicas[n], lu)
# A et B forment le quorum durable simulé avant le retour au client.
assert max(réplicas[n] for n in ['B','C'])[1] == 9
# Les communications, crashs et écritures disque ne sont pas simulés ici.
Simulation Python locale à exécuter séparément. Les assertions vérifient les cas présentés ; ce code ne constitue pas une implémentation distribuée de production.
À toi de jouer
Écris les étapes d’un get ABD et d’un set multi-écrivain. Puis analyse : set(0) est suivi d’un CAS(0,3) qui retourne faux, sans écriture concurrente ni autre modification.
Voir la correction expliquée
get : lire un quorum, choisir max(version), réécrire cette paire sur un quorum, puis retourner la valeur. set : lire les versions d’un quorum, créer (max_compteur+1,id_unique), écrire sur un quorum, puis terminer. Dans le scénario sans chevauchement ni autre changement, le CAS doit réussir car la valeur est 0 ; retourner faux viole le contrat. En présence d’autres opérations, il faut chercher une histoire complète plutôt qu’inspecter une ligne isolée.
Références : Notes originales de Martin Kleppmann — Cambridge 2025/26.
Adapté de Distributed Systems — notes de cours 2025/26, Martin Kleppmann, University of Cambridge, pages 66–68. Consulter le PDF source et ses illustrations · Provenance. Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) — adaptation française et exemples modifiés