Corda is an open source blockchain project, designed for business from the start. Only Corda allows you to build interoperable blockchain networks that transact in strict privacy. Corda's smart contract technology allows businesses to transact directly, with value.
Go to file
Kyriakos Tharrouniatis 4507b55857
CORDA-3725 Fix SQL deadlocks coming from soft locking states (#6287)
Adding to the query -explicitly- the flow's locked states resolved the SQL Deadlocks in SQL server. The SQL Deadlocks would come up  from `softLockRelease` when only the `lockId` was passed in as argument. In that case the query optimizer would use `lock_id_idx(lock_id, state_status)` to search and update entries in `VAULT_STATES` table. 

However, all rest of the queries would follow the opposite direction meaning they would use PK's `index(output_index, transaction_id)` but they would also update the `lock_id` column and therefore the `lock_id_idx` as well, because `lock_id` is a part of it. That was causing a circular locking among the different transactions (SQL processes) within the database.

To resolve this, whenever a flow attempts to reserve soft locks using their flow id (remember the flow id is always the flow id for the very first flow in the flow stack), we then save these states to the fiber. Then, upon releasing soft locks the fiber passes that set to the release soft locks query. That way the database query optimizer will use the primary key index of VAULT_STATES table, instead of lock_id_idx in order to search rows to update. That way the query will be aligned with the rest of the queries that are following that route as well (i.e. making use of the primary key), and therefore its locking order of resources within the database will be aligned with the rest queries' locking orders (solving SQL deadlocks).

* Fixed SQL deadlocks caused from softLockRelease, by saving locked states per fiber; NodeVaultService.softLockRelease query then uses VAULT_STATES PK index instead of lock_id_idx

Speed up SQL server by breaking down queries with > 16 elements in their IN clause, into sub queries with 16 elements max in their IN clauses

* Allow softLockedStates to remove states

* Add to softLockedStates only states soft locked under our flow id

* Fix softLockRelease not to take into account flowStateMachineImpl.softLockedStates when using lockId != ourFlowId

* Moved CriteriaBuilder.executeUpdate at the bottom of the file
2020-05-29 12:35:05 +01:00
.ci INFRA-311 new jdk11 jenkinsfile (#6194) 2020-04-30 09:59:35 +01:00
.github Changed frequency of Github Actions for sync between GH and Jira (#6148) 2020-04-14 10:17:44 +01:00
.idea Merge remote-tracking branch 'origin/release/os/4.3' into my_merge_branch 2019-11-04 17:48:15 +00:00
client Revert "NOTICK Ignore JUnit time threads in RPCStabilityTests (#6201)" (#6204) 2020-04-30 13:17:40 +01:00
common CORDA-3490 Add option to start node without starting checkpointed flows (#6136) 2020-05-19 16:27:41 +01:00
confidential-identities Merge branch 'release/os/4.4' into chrisr3-44-merge 2020-03-04 16:27:44 +00:00
config EG-71 - Changed the default file limit in the log4j2 configuration (#5996) 2020-03-02 09:26:46 +00:00
core CORDA-3490 Add option to start node without starting checkpointed flows (#6136) 2020-05-19 16:27:41 +01:00
core-deterministic CORDA-3715: Check contract classes hav… (#6155) 2020-04-30 08:57:37 +01:00
core-tests NOTICK Fix kill flow tests due to storing failed flows 2020-05-06 10:02:40 +01:00
detekt-plugins NOTICK: Update Gradle files for DeteKt plugins. (#5970) 2020-02-16 08:21:05 +00:00
docker Bump OS release version 4.6 2020-05-04 12:07:27 +01:00
docs EG-1404 - Retired the rst doc source structure under /docs and update… (#6147) 2020-04-23 09:56:57 +01:00
experimental [NOTICK] - Enable check in detekt for unused imports (#6106) 2020-03-26 15:46:33 +00:00
finance CORDA-3698: Require no classifier for Open Core and DJVM-related modules. (#6132) 2020-04-06 11:00:40 +01:00
gradle/wrapper use proxied gradle to prevent slow lorrising due to too many requests (#6056) 2020-03-12 08:15:28 +00:00
isolated CORDA-2893 Upgrade Corda to use Gradle 5.4.1 (Take 2) (#5137) 2019-05-20 14:26:42 +01:00
jdk8u-deterministic CORDA-3523: DJVM custom serializers and whitelists (#5858) 2020-01-16 17:48:15 +00:00
lib fix merge conflicts due to changes in Signed test cordapp creation 2019-11-05 17:42:38 +00:00
node CORDA-3725 Fix SQL deadlocks coming from soft locking states (#6287) 2020-05-29 12:35:05 +01:00
node-api [MERGE] Fix detekt issues 2020-04-29 11:57:37 +01:00
node-api-tests Merge branch 'release/os/4.6' into dan/4.6-into-checkpoint-feature-branch-2020-05-05 2020-05-05 17:05:23 +01:00
release-tools CORDA-3017 - Fix release tooling when product name != jira project (#5229) 2019-06-21 09:28:07 +01:00
samples Merge branch 'release/os/4.6' into dan/4.6-into-checkpoint-feature-branch-2020-05-05 2020-05-05 17:05:23 +01:00
serialization CORDA-3750: Delete unwanted methods from the deterministic artifacts. (#6208) 2020-05-04 11:33:06 +01:00
serialization-deterministic NOTICK: Fix more Gradle technical debt. (#5989) 2020-02-20 17:01:24 +00:00
serialization-djvm CORDA-3745: Modify DJVM serializers to support Enum Evolution. (#6189) 2020-04-30 14:59:10 +01:00
serialization-tests ENT-5043 separate out test utils (#5998) 2020-03-03 15:55:17 +00:00
testing CORDA-3490 Add option to start node without starting checkpointed flows (#6136) 2020-05-19 16:27:41 +01:00
tools [NOTICK] Fix a test error to allow tests to pass in Jenkins (#6202) 2020-04-30 10:57:47 +01:00
.dockerignore WIP Kubenetes parallel build (#5396) 2019-09-03 15:40:08 +00:00
.gitignore ENT-4595 Add git based version (#5799) 2019-12-11 17:50:27 +00:00
build.gradle Corda 3675 update netty (#6146) 2020-04-14 12:31:02 +01:00
BUILD.md add a shared memory port allocator to allow multiple processes to sha… (#5223) 2019-07-02 18:38:33 +00:00
buildCacheSettings.gradle Explicitly disable remote gradle build cache when building locally. (#4095) 2018-10-19 16:40:06 +01:00
constants.properties Bump OS release version 4.6 2020-05-04 12:07:27 +01:00
CONTRIBUTING.md Combines all contributing info in one place. Clean-up. (#4266) 2018-11-20 18:17:11 +00:00
CONTRIBUTORS.md Contract tutorial update and Contributors list update (#5338) 2019-07-30 14:51:34 +01:00
detekt-baseline-config.yml TM-45 Make detektBaseline pass (#5561) 2019-10-15 15:49:31 +01:00
detekt-baseline.xml CORDA-3726: Remove memory leaks when many InProcess nodes started (#6169) 2020-04-23 08:53:51 +01:00
detekt-config.yml [NOTICK] - Enable check in detekt for unused imports (#6106) 2020-03-26 15:46:33 +00:00
deterministic.gradle CORDA-2876: Ensure that sandboxable byte-code is compiled for Java 8. 2019-11-14 16:22:28 +00:00
gradle.properties Revert "Merge pull request #5145 from corda/jdk11-migration-gradle5-upgrade" (#5146) 2019-05-20 16:16:49 +01:00
gradlew CORDA-2893 Upgrade Corda to use Gradle 5.4.1 (Take 2) (#5137) 2019-05-20 14:26:42 +01:00
gradlew.bat CORDA-2893 Upgrade Corda to use Gradle 5.4.1 (Take 2) (#5137) 2019-05-20 14:26:42 +01:00
java8.gradle CORDA-3698: Require no classifier for Open Core and DJVM-related modules. (#6132) 2020-04-06 11:00:40 +01:00
Jenkinsfile INFRA-284 switching from local k8s label (#6156) 2020-04-17 15:53:10 +01:00
LICENSE Use full Apache 2.0 license so GitHub recognizes it 2019-08-23 12:24:37 +02:00
README.md Update README.md (#6144) 2020-04-09 15:31:19 +01:00
SECURITY.md CORDA-2958 Security policy for corda 2019-06-03 10:38:13 +02:00
settings.gradle [EG-440] Add some error codes and the error resource generation tool (#6192) 2020-04-29 11:21:50 +01:00
sizing.sh add a shared memory port allocator to allow multiple processes to sha… (#5223) 2019-07-02 18:38:33 +00:00
TRADEMARK Updated URL link to R3 trademark policy 2017-07-13 11:43:41 +01:00

Corda

License

Corda

Corda is an open source blockchain project, designed for business from the start. Only Corda allows you to build interoperable blockchain networks that transact in strict privacy. Corda's smart contract technology allows businesses to transact directly, with value.

Features

  • Smart contracts that can be written in Java and other JVM languages
  • Flow framework to manage communication and negotiation between participants
  • Peer-to-peer network of nodes
  • "Notary" infrastructure to validate uniqueness and sequencing of transactions without global broadcast
  • Enables the development and deployment of distributed apps called CorDapps
  • Written in Kotlin, targeting the JVM

Getting started

  1. Read the Getting Started documentation
  2. Run the Example CorDapp
  3. Read about Corda's Key Concepts
  4. Follow the Hello, World! tutorial

Contributing

Corda is an open-source project and contributions are welcome!

To find out how to contribute, please see our contributing docs.

License

Apache 2.0

Acknowledgements

YourKit

YourKit supports open source projects with its full-featured Java Profiler.

YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.