File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
ouroboros-consensus-cardano Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,38 @@ gnuplot -e "bench_data='ledger-ops-cost.csv'" \
245245The plot will be written to a file named ` results.png ` . See the script file for
246246more usage options.
247247
248+ #### Finding the intersection between two ChainDBs
249+
250+ Suppose that you have two ChainDBs containing different forks, and you want to
251+ find their intersection. This can be accomplished with db-analyser via the
252+ ` --show-slot-block-no ` analysis:
253+
254+ First, run the following command for both of your ChainDBs:
255+
256+ ```
257+ db-analyser --analyse-from 1234 --db /path/to/dbX --show-slot-block-no \
258+ cardano --config /path/to/config.json | cut -d ' ' -f 2- > dbX.log
259+ ```
260+
261+ Note that specificying ` --analyse-from ` is optional; it means that you are
262+ certain that both ChainDBs still were on the same fork in slot ` 1234 ` , in order
263+ to decrease the run time of the command.
264+
265+ Then, you can ` diff ` the resulting files to find the last common block, or the
266+ ` comm ` tool like this:
267+
268+ - Get the last few blocks in common (last one is the intersection):
269+ ``` console
270+ comm -1 -2 db0.log db1.log | tail
271+ ```
272+ - Get the first few blocks after the intersection:
273+ ``` console
274+ comm -3 db0.log db1.log | head
275+ ```
276+
277+ > It is possible to do this in logarithmic instead of linear time via a binary
278+ > search; however, this hasn't been necessary so far.
279+
248280## db-immutaliser
249281
250282Copy a specific chain from a volatile DB to an immutable DB, such that other
You can’t perform that action at this time.
0 commit comments