Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqlite: add more locking to DBLayer methods #337

Merged
merged 1 commit into from
May 29, 2019
Merged

Conversation

rvl
Copy link
Contributor

@rvl rvl commented May 29, 2019

Relates to issue #154.

It seems to be best to put a big lock around all operations which use the SQLite connection.

I was getting the following failed test:

  λ> quickCheck (prop_parallel db)
  *** Failed! Exception: 'SQLite3 returned ErrorError while attempting to perform step: not an error' (after 5 tests and 3 shrinks):
  ParallelCommands
    { prefix = Commands { unCommands = [] }
    , suffixes =
        [ Pair
            { proj1 =
                Commands
                  { unCommands =
                      [ Command
                          (At (ReadTxHistory (Val (MWid "c"))))
                          (At (Resp (Right (TxHistory (fromList [])))))
                          []
                      ]
                  }
            , proj2 =
                Commands
                  { unCommands =
                      [ Command
                          (At (PutTxHistory (Val (MWid "a")) (fromList [])))
                          (At (Resp (Left (NoSuchWallet (Reference (Symbolic (Var 0)))))))
                          [ Var 0 ]
                      ]
                  }
            }
        ]
    }

It seems to be best to put a big lock around all operations which use
the SQLite connection.

I was getting the following failed test:

  λ> quickCheck (prop_parallel db)
  *** Failed! Exception: 'SQLite3 returned ErrorError while attempting to perform step: not an error' (after 5 tests and 3 shrinks):
  ParallelCommands
    { prefix = Commands { unCommands = [] }
    , suffixes =
        [ Pair
            { proj1 =
                Commands
                  { unCommands =
                      [ Command
                          (At (ReadTxHistory (Val (MWid "c"))))
                          (At (Resp (Right (TxHistory (fromList [])))))
                          []
                      ]
                  }
            , proj2 =
                Commands
                  { unCommands =
                      [ Command
                          (At (PutTxHistory (Val (MWid "a")) (fromList [])))
                          (At (Resp (Left (NoSuchWallet (Reference (Symbolic (Var 0)))))))
                          [ Var 0 ]
                      ]
                  }
            }
        ]
    }
@rvl rvl self-assigned this May 29, 2019
@KtorZ KtorZ merged commit 2d3fe41 into master May 29, 2019
@KtorZ KtorZ deleted the rvl/154/sqlite-locking branch May 29, 2019 08:41
@KtorZ KtorZ removed this from the SQLite implementation for the DB Layer milestone Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants