Skip to content

Commit

Permalink
feat: sqlite became default now
Browse files Browse the repository at this point in the history
  • Loading branch information
ohager committed Dec 22, 2024
1 parent 4870973 commit 11e9986
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ you don't want to connect to the database while running the node. Furthermore, t
__Sqlite__ is just like H2 a file based (embedded) database. Signum Node builds up the entire database out of the box and does not require any further set up.
This makes Sqlite an interesting choice especially for less-technical users who just want to start and/or run a local (not publicly accessible) node. Choose this, if you want to run just a local node without public exposure.
Furthermore, the resulting database file is easily shareable, such others can use a snapshot and sync from there.
Sqlite is still experimental, and considered as a substitute for H2.
Sqlite is considered as a replacement for H2.

__MariaDB__ and __PostgreSQL__ on the other hand require an additional set-up. It is the better choice for publicly accessible nodes,
as they are considered more stable, especially under higher load.
Expand All @@ -93,15 +93,15 @@ The performance hit for MariaDB and PostgreSQL is related to the TCP/IP connecti
Due to that model concurrent access is possible, i.e. one can run an additional service against the same database, which is not possible with H2, as the file gets locked.

| | Stability | Speed | Setup | Backup | Concurrency | Purpose |
|------------|-----------|------|-------|--------|-------------|----------------------------------|
| H2 | - (1) | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ || Local Node |
| Sqlite | ⭐⭐ (2) | ⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ | ✅ (3) | Local Node |
| MariaDB | ⭐⭐ ||||| Public Node, Additional Services |
| PostgreSQL | ⭐⭐ (2) ||||| Public Node, Additional Services |
|------------|----------|-------|-------|--------|-------------|----------------------------------|
| ~~H2~~ | - (1) | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ || Local Node [DEPRECATED] |
| Sqlite | ⭐⭐ | ⭐⭐* | ⭐⭐⭐ | ⭐⭐⭐ | ✅ (3) | Local Node |
| MariaDB | ⭐⭐ | |||| Public Node, Additional Services |
| PostgreSQL | ⭐⭐ (2) | |||| Public Node, Additional Services |

> (1) H2 - even with updated Version 2 - has proven to be unstable and causing database issues - mostly File I/O exceptions, and data inconsistencies.
> (1) DEPRECATED - H2 - even with updated Version 2 - has proven to be unstable and causing database issues - mostly File I/O exceptions, OOM and data inconsistencies. It will be removed with 3.9, so move to sqlite
> (2) PostgreSQL and Sqlite support is still experimental. So, stability needs to be proven over time, but in general Postgres itself is as least stable/reliable as MariaDB.
> (2) PostgreSQL support is still experimental. So, stability needs to be proven over time, but in general Postgres itself is as least stable/reliable as MariaDB.
> (3) Sqlite supports concurrent reading. Writing is still limited to one writer at a time.
----
Expand Down Expand Up @@ -146,9 +146,9 @@ Note: the example ID above `8952122635653861124` is the [SNA](https://www.sna.si

The cash-back is paid from block `1,029,000.`

**H2/MariaDB**
**SQLite/MariaDB**

By default Signum Node is using H2 (file based) as database.
By default Signum Node is using SQLite (file based) as database.
If you like to use MariaDB you will need to adjust your `conf/node.properties`:

```properties
Expand Down
3 changes: 1 addition & 2 deletions src/brs/props/Props.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ public class Props {

// DB options
public static final Prop<Boolean> DB_SKIP_CHECK = new Prop<>("DB.SkipCheck", false);
// TODO: change this when SQLITE turns out to be stable
public static final Prop<String> DB_URL = new Prop<>("DB.Url", "jdbc:h2:file:./db/signum-v2;DB_CLOSE_ON_EXIT=FALSE");
public static final Prop<String> DB_URL = new Prop<>("DB.Url", "jdbc:sqlite:file:./db/signum.sqlite.db");
public static final Prop<String> DB_USERNAME = new Prop<>("DB.Username", "");
public static final Prop<String> DB_PASSWORD = new Prop<>("DB.Password", "");
public static final Prop<Integer> DB_CONNECTIONS = new Prop<>("DB.Connections", 30);
Expand Down
5 changes: 2 additions & 3 deletions src/signum/net/MockNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ public MockNetwork() {
setProperty(Props.PK2_BLOCK_HEIGHT, "0");
setProperty(Props.SMART_ALIASES_HEIGHT, "0");
setProperty(Props.DEV_NEXT_FORK_BLOCK_HEIGHT, "0");

setProperty(Props.BRS_CHECKPOINT_HEIGHT, "-1");
setProperty(Props.BRS_CHECKPOINT_HASH, "");

setProperty(Props.DB_URL, "jdbc:h2:file:./db/signum-mock;DB_CLOSE_ON_EXIT=FALSE");
setProperty(Props.DB_URL, "jdbc:sqlite:file:./db/signum.sqlite-mock.db");
}
}
4 changes: 1 addition & 3 deletions src/signum/net/TestnetNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public TestnetNetwork() {

setProperty(Props.P2P_USE_PEERS_DB, "false");
setProperty(Props.P2P_SAVE_PEERS, "false");

setProperty(Props.DB_URL, "jdbc:h2:file:./db/signum-testnet-v2;DB_CLOSE_ON_EXIT=FALSE");

setProperty(Props.DB_URL, "jdbc:sqlite:file:./db/signum.sqlite-testnet.db");
}
}

0 comments on commit 11e9986

Please sign in to comment.