Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Upstream
Gitea
Commits
93860af5
Unverified
Commit
93860af5
authored
5 years ago
by
guillep2k
Committed by
GitHub
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix SQLite concurrency problems by using BEGIN IMMEDIATE (#10368) (#10493)
parent
7bf5834f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
integrations/migration-test/migration_test.go
+1
-1
integrations/migration-test/migration_test.go
models/unit_tests.go
+1
-1
models/unit_tests.go
modules/setting/database.go
+1
-1
modules/setting/database.go
with
3 additions
and
3 deletions
+3
-3
integrations/migration-test/migration_test.go
View file @
93860af5
...
...
@@ -126,7 +126,7 @@ func restoreOldDB(t *testing.T, version string) bool {
err
:=
os
.
MkdirAll
(
path
.
Dir
(
setting
.
Database
.
Path
),
os
.
ModePerm
)
assert
.
NoError
(
t
,
err
)
db
,
err
:=
sql
.
Open
(
"sqlite3"
,
fmt
.
Sprintf
(
"file:%s?cache=shared&mode=rwc&_busy_timeout=%d"
,
setting
.
Database
.
Path
,
setting
.
Database
.
Timeout
))
db
,
err
:=
sql
.
Open
(
"sqlite3"
,
fmt
.
Sprintf
(
"file:%s?cache=shared&mode=rwc&_busy_timeout=%d
&_txlock=immediate
"
,
setting
.
Database
.
Path
,
setting
.
Database
.
Timeout
))
assert
.
NoError
(
t
,
err
)
defer
db
.
Close
()
...
...
This diff is collapsed.
Click to expand it.
models/unit_tests.go
View file @
93860af5
...
...
@@ -84,7 +84,7 @@ func MainTest(m *testing.M, pathToGiteaRoot string) {
func
createTestEngine
(
fixturesDir
string
)
error
{
var
err
error
x
,
err
=
xorm
.
NewEngine
(
"sqlite3"
,
"file::memory:?cache=shared"
)
x
,
err
=
xorm
.
NewEngine
(
"sqlite3"
,
"file::memory:?cache=shared
&_txlock=immediate
"
)
if
err
!=
nil
{
return
err
}
...
...
This diff is collapsed.
Click to expand it.
modules/setting/database.go
View file @
93860af5
...
...
@@ -124,7 +124,7 @@ func DBConnStr() (string, error) {
if
err
:=
os
.
MkdirAll
(
path
.
Dir
(
Database
.
Path
),
os
.
ModePerm
);
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Failed to create directories: %v"
,
err
)
}
connStr
=
fmt
.
Sprintf
(
"file:%s?cache=shared&mode=rwc&_busy_timeout=%d"
,
Database
.
Path
,
Database
.
Timeout
)
connStr
=
fmt
.
Sprintf
(
"file:%s?cache=shared&mode=rwc&_busy_timeout=%d
&_txlock=immediate
"
,
Database
.
Path
,
Database
.
Timeout
)
default
:
return
""
,
fmt
.
Errorf
(
"Unknown database type: %s"
,
Database
.
Type
)
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment