Skip to content

Commit 1f744f9

Browse files
committed
remove the setting, there are enough already
1 parent a6b8443 commit 1f744f9

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

custom/conf/app.example.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ USER = root
313313
;DB_TYPE = sqlite3
314314
;PATH= ; defaults to data/gitea.db
315315
;SQLITE_TIMEOUT = ; Query timeout defaults to: 500
316-
;SQLITE_JOURNAL_MODE = ; defaults to DELETE, can be used to enable WAL mode. https://www.sqlite.org/pragma.html#pragma_journal_mode
317316
;;
318317
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
319318
;;

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ The following configuration set `Content-Type: application/vnd.android.package-a
382382
- `verify-ca`: Enable TLS with verification of the database server certificate against its root certificate.
383383
- `verify-full`: Enable TLS and verify the database server name matches the given certificate in either the `Common Name` or `Subject Alternative Name` fields.
384384
- `SQLITE_TIMEOUT`: **500**: Query timeout for SQLite3 only.
385-
- `SQLITE_JOURNAL_MODE`: on windows & linux: **WAL**, otherwise **DELETE**: Change journal mode for SQlite3. See [SQlite3 docs](https://www.sqlite.org/pragma.html#pragma_journal_mode) for possible values.
386385
- `ITERATE_BUFFER_SIZE`: **50**: Internal buffer size for iterating.
387386
- `CHARSET`: **utf8mb4**: For MySQL only, either "utf8" or "utf8mb4". NOTICE: for "utf8mb4" you must use MySQL InnoDB > 5.6. Gitea is unable to check this.
388387
- `PATH`: **data/gitea.db**: For SQLite3 only, the database file path.

modules/setting/database.go

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ var (
4040
LogSQL bool
4141
Charset string
4242
Timeout int // seconds
43-
SQliteJournalMode string
4443
UseSQLite3 bool
4544
UseMySQL bool
4645
UseMSSQL bool
@@ -90,24 +89,10 @@ func InitDBConfig() {
9089
if Database.UseMySQL && defaultCharset != "utf8mb4" {
9190
log.Error("Deprecated database mysql charset utf8 support, please use utf8mb4 or convert utf8 to utf8mb4.")
9291
}
93-
9492
if Database.UseSQLite3 {
9593
Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "gitea.db"))
9694
Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500)
97-
98-
// WAL mode is preferred for better concurent write performance, but needs special VFS driver features,
99-
// which are guaranteed to be available for unix & windows OSes
100-
var defaultJournalMode string
101-
switch runtime.GOOS {
102-
// probably the BSDs are supported too, but i found no information on this - better safe than sorry.
103-
case "windows", "linux": // "darwin", "freebsd", "openbsd", "netbsd":
104-
defaultJournalMode = "WAL"
105-
default:
106-
defaultJournalMode = "DELETE"
107-
}
108-
Database.SQliteJournalMode = sec.Key("SQLITE_JOURNAL_MODE").MustString(defaultJournalMode)
10995
}
110-
11196
Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2)
11297
if Database.UseMySQL {
11398
Database.ConnMaxLifetime = sec.Key("CONN_MAX_LIFETIME").MustDuration(3 * time.Second)
@@ -153,8 +138,17 @@ func DBConnStr() (string, error) {
153138
if err := os.MkdirAll(path.Dir(Database.Path), os.ModePerm); err != nil {
154139
return "", fmt.Errorf("Failed to create directories: %v", err)
155140
}
141+
142+
// WAL mode is preferred for better concurent write performance, but needs special VFS driver features,
143+
// which are guaranteed to be available for unix & windows OSes: https://www.sqlite.org/wal.html
144+
journalMode := "DELETE"
145+
switch runtime.GOOS {
146+
// probably the BSDs are supported too, but i found no information on this - better safe than sorry.
147+
case "windows", "linux": // "darwin", "freebsd", "openbsd", "netbsd":
148+
journalMode = "WAL"
149+
}
156150
connStr = fmt.Sprintf("file:%s?cache=shared&mode=rwc&_busy_timeout=%d&_txlock=immediate&_journal_mode=%s",
157-
Database.Path, Database.Timeout, Database.SQliteJournalMode)
151+
Database.Path, Database.Timeout, journalMode)
158152
default:
159153
return "", fmt.Errorf("Unknown database type: %s", Database.Type)
160154
}

0 commit comments

Comments
 (0)