Skip to content

Commit

Permalink
Ledger DB lock improvements (#74)
Browse files Browse the repository at this point in the history
# Description

Rework the locking logic for the ledger DB RAW lock. There are mainly 4 places where locking happens:
- background thread that flushes regularly: uses a **write** lock while writing the differences only.
- background thread that creates snapshots: holds a **read** lock for the duration of the snapshot
- forging loop: **quick read** locking to acquire a ledger db and a value handle to get a snapshot
- queries: **quick read** locking to acquire a ledger db and a value handle

This should reduce locking issues.

There are also some side effects in the PR:
- the forging loop is again a `WithEarlyExit` block
- getting a snapshot can no longer fail s you provide the chlog and the value handle
- new policy function `onDiskShouldFlush`

Closes #43
  • Loading branch information
jasagredo committed Jun 2, 2023
2 parents 57489d3 + e9fbac6 commit b9088f9
Show file tree
Hide file tree
Showing 392 changed files with 6,676 additions and 5,724 deletions.
11 changes: 2 additions & 9 deletions .gitattributes
@@ -1,11 +1,4 @@
# GitHub Linguist annotations.
# Hide nix/.stack.nix/*.nix
# That is stuff that is generated by nix-tools stack-to-nix
# https://github.com/github-linguist/linguist/blob/master/docs/overrides.md

nix/.stack.nix/*.nix linguist-generated=true
.stack-to-nix.cache linguist-generated=true
nix/.stack-pkgs.nix linguist-generated=true

ouroboros-consensus-byron-test/test/golden/**/* linguist-generated=true
ouroboros-consensus-shelley-test/test/golden/**/* linguist-generated=true
ouroboros-consensus-cardano-test/test/golden/**/* linguist-generated=true
ouroboros-consensus-cardano/golden/**/* linguist-generated=true
60 changes: 0 additions & 60 deletions .github/workflows/cabal.project.local.Windows

This file was deleted.

68 changes: 65 additions & 3 deletions .github/workflows/checks.yml
Expand Up @@ -6,15 +6,15 @@ concurrency:

on:
pull_request:
branches:
- main
merge_group:

jobs:
consensus-changelog:

name: Changelog sanity check

if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}

runs-on: ubuntu-latest

defaults:
Expand All @@ -29,7 +29,69 @@ jobs:

- uses: actions/checkout@v3
with:
ref: ${{ env.GITHUB_BASE_REF }}
ref: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }}
path: 'main'

- run: CI=1 ./this-pr/scripts/ci/check-changelogs.sh main this-pr

check-cabal-files:
runs-on: ubuntu-latest

steps:
- name: Install Haskell
uses: input-output-hk/setup-haskell@v1
id: setup-haskell
with:
cabal-version: "3.10.1.0"

- uses: actions/checkout@v3

- name: Cabal check
run: ./scripts/ci/check-cabal-files.sh

# Enabling the assertions results in an error in IO-Sim.
# https://github.com/input-output-hk/io-sim/issues/94
# Until it is fixed, re-enabling this will only lead to blocked CI.

# cabal-project-asserts:

# name: Cabal project asserts

# runs-on: ubuntu-latest

# defaults:
# run:
# shell: bash

# env:

# # current ref from: 27.02.2022
# SECP256K1_REF: ac83be33d0956faf6b7f61a60ab524ef7d6a473a

# SECP_CACHE_VERSION: "2023-04-27"

# steps:

# - uses: actions/checkout@v3

# - name: Install Haskell
# uses: input-output-hk/setup-haskell@v1
# id: setup-haskell
# with:
# cabal-version: "3.10.1.0"
# ghc-version: "9.2.7"

# - name: Install build environment
# run: |
# sudo apt-get update
# sudo apt-get -y install libsodium-dev

# - name: Install secp256k1
# uses: input-output-hk/setup-secp256k1@v1
# with:
# git-ref: ${{ env.SECP256K1_REF }}
# cache-version: ${{ env.SECP_CACHE_VERSION }}

# - run: |
# ./scripts/ci/regen-project-asserts.sh
# git --no-pager diff --exit-code

0 comments on commit b9088f9

Please sign in to comment.