Skip to content

Commit

Permalink
Merge pull request erlang#7593 from jchristgit/mnesia-implementation-…
Browse files Browse the repository at this point in the history
…figures

mnesia: Add figures for implementation documentation
  • Loading branch information
dgud authored Sep 21, 2023
2 parents 4b63185 + a1d7b84 commit 61dc52c
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions lib/mnesia/doc/misc/implementation_async_transaction.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@startuml
hide footbox
title Asynchronous transaction commit protocol

box "Local node" #LightBlue
participant Client
participant mnesia_tm as LocalTM
end box

box "Remote nodes"
participant mnesia_locker as RemoteLocker
participant mnesia_tm as RemoteTM
end box

Client -> LocalTM: Ask for transaction ID
Client <- LocalTM: Transaction ID & Store
activate Client
Client -> RemoteLocker: Acquire read lock
activate RemoteLocker #EEBBBB
Client <- RemoteLocker: Value or instruction to restart transaction
Client <- Client: Patch value against transaction store
Client -> RemoteLocker: Acquire write locks on all nodes
activate RemoteLocker #DarkSalmon
Client <- RemoteLocker: "ok" or instruction to restart transaction
Client <- Client: Read and patch data into transaction\nstore, and collect every update done in it
Client -> RemoteTM: Ask nodes with table copies for commit
activate RemoteTM
Client <- RemoteTM: "ok" for commit
Client -> RemoteTM: Instruct to commit
deactivate RemoteTM
Client <- Client: Log commit decision, commit locally,\nupdate SNMP, indices and checkpoints,\nnotify subscribers
Client -> RemoteLocker: Release locks
deactivate RemoteLocker
deactivate RemoteLocker
Client -> LocalTM: Release transaction
deactivate Client
@enduml
150 changes: 150 additions & 0 deletions lib/mnesia/doc/misc/implementation_table_loading.fig
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#FIG 3.2 Produced by xfig version 3.2.8b
Landscape
Center
Inches
Letter
100.00
Single
-2
1200 2
0 32 #c6b797
0 33 #eff8ff
0 34 #dccba6
0 35 #404040
0 36 #808080
0 37 #c0c0c0
0 38 #e0e0e0
0 39 #8e8f8e
0 40 #aaaaaa
0 41 #555555
0 42 #c7c3c7
0 43 #565151
0 44 #8e8e8e
0 45 #d7d7d7
0 46 #85807d
0 47 #d2d2d2
0 48 #3a3a3a
0 49 #4573aa
0 50 #aeaeae
0 51 #7b79a5
0 52 #444444
0 53 #73758c
0 54 #f7f7f7
0 55 #414541
0 56 #635dce
0 57 #bebebe
0 58 #515151
0 59 #e7e3e7
0 60 #000049
0 61 #797979
0 62 #303430
0 63 #414141
0 64 #c7b696
0 65 #c2c2c2
0 66 #6e6e6e
0 67 #717171
0 68 #333333
0 69 #949395
0 70 #747075
0 71 #b3b3b3
0 72 #c3c3c3
0 73 #6d6d6d
0 74 #454545
0 75 #9c0000
0 76 #8c8c8c
0 77 #424242
0 78 #8c8c8c
0 79 #424242
0 80 #8c8c8c
0 81 #424242
0 82 #8c8c8c
0 83 #424242
0 84 #8c8c8c
0 85 #424242
0 86 #8c8c8c
0 87 #424242
0 88 #c9c9c9
0 89 #dfd8df
0 90 #f7f3f7
5 1 0 2 0 7 50 -1 -1 0.000 0 1 0 0 249.423 3937.500 -1200 3300 -1330 4050 -1200 4575
5 1 0 2 0 7 50 -1 -1 0.000 0 0 0 0 1325.577 3937.500 2775 3300 2905 4050 2775 4575
6 3000 2850 8550 3450
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 220.91 331.36
8550 3300 3000 3300
4 1 0 50 -1 4 19 0.0000 0 225 1770 5775 3150 Send init info\001
-6
6 3000 7200 8550 7800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 220.91 331.36
8550 7650 3000 7650
4 1 0 50 -1 4 19 0.0000 0 300 2025 5775 7500 Send no_more\001
-6
6 1997 4710 9553 6840
6 1997 4710 9553 6840
6 1997 4710 9553 6840
2 2 2 3 0 11 49 -1 20 6.000 0 0 7 0 0 5
2012 4725 9538 4725 9538 6825 2012 6825 2012 4725
2 1 0 1 0 7 47 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 219.97 329.95
8533 5700 3017 5700
2 1 0 1 0 7 47 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 219.97 329.95
3017 6450 8533 6450
4 1 0 44 -1 4 18 0.0000 0 210 2025 5774 5550 Send table data\001
4 1 0 45 -1 4 18 0.0000 0 270 3510 5775 6300 Acknowledge data regularly\001
-6
4 1 48 45 -1 4 13 0.0000 0 210 1455 5774 5025 table copy loop\001
-6
-6
6 7350 600 9750 1800
2 4 0 1 0 29 50 -1 20 0.000 0 0 7 0 0 5
9750 1800 7350 1800 7350 600 9750 600 9750 1800
4 0 0 45 -1 2 28 0.0000 0 315 1395 7852 1357 Sender\001
-6
6 3000 2325 8550 2925
2 1 0 1 0 7 50 -1 -1 0.000 0 0 7 1 0 2
1 1 3.00 220.91 331.36
3000 2775 8550 2775
4 1 0 50 -1 4 19 0.0000 0 300 3015 5775 2625 Queue sender request\001
-6
6 8700 7800 11745 8550
4 0 0 48 -1 4 19 0.0000 0 225 2040 8700 8025 Grab read lock\001
4 0 0 48 -1 4 19 0.0000 0 300 3045 8700 8475 Update metadata info\001
-6
6 -1185 3390 2700 4590
4 2 0 48 -1 16 19 0.0000 4 300 3885 2700 4515 Create table (ETS or DETS)\001
4 2 0 48 -1 16 19 0.0000 4 225 3720 2700 4065 Grab schema lock for table\001
4 2 0 48 -1 16 19 0.0000 4 300 2715 2700 3615 Spawn real receiver\001
-6
6 555 2025 2925 2700
4 2 0 48 -1 16 19 0.0000 4 225 2370 2925 2700 Find sender node\001
4 2 0 48 -1 16 19 0.0000 4 300 1305 2925 2250 Spawned\001
-6
6 8700 3375 13575 4500
4 0 0 48 -1 4 19 0.0000 0 225 2835 8700 3600 Grab table write lock\001
4 0 0 48 -1 4 19 0.0000 0 300 4875 8700 4050 Subscribe receiver to table updates\001
4 0 0 48 -1 4 19 0.0000 0 225 3240 8700 4500 Release table write lock\001
-6
6 3000 8925 8550 9525
2 1 0 1 0 7 50 -1 -1 0.000 0 0 7 1 0 2
1 1 3.00 220.91 331.36
3000 9375 8550 9375
4 1 0 50 -1 4 19 0.0000 0 300 2025 5775 9225 Send no_more\001
-6
6 1800 600 4350 1800
2 4 0 1 0 51 50 -1 20 0.000 0 0 7 0 0 5
4350 1800 1800 1800 1800 600 4350 600 4350 1800
4 0 0 45 -1 2 28 0.0000 0 315 1740 2205 1357 Receiver\001
-6
2 1 1 1 0 7 48 -1 -1 4.000 0 0 -1 0 0 3
8550 1800 8550 8775 8550 9450
2 1 1 2 0 7 48 -1 -1 4.000 0 0 -1 0 0 3
3000 1800 3000 8700 3000 9525
4 0 0 48 -1 16 19 0.0000 4 300 1305 8700 3000 Spawned\001
4 0 0 50 -1 0 12 0.0000 4 195 2385 -300 4725 for all tables except schema\001
4 2 0 48 -1 4 19 0.0000 0 300 4005 2850 8100 Apply subscription messages\001
4 2 0 48 -1 4 19 0.0000 0 300 2565 2850 8550 Store copy on disk\001
4 2 0 48 -1 4 19 0.0000 0 300 3195 2850 9000 (Create indices, SNMP,\001
4 2 0 48 -1 4 19 0.0000 0 300 2355 2850 9375 and checkpoints)\001
4 0 0 48 -1 4 19 0.0000 0 225 1740 8700 9525 Release lock\001
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 61dc52c

Please sign in to comment.