diff --git a/models/actions/task.go b/models/actions/task.go index d7590407e7..e671a06079 100644 --- a/models/actions/task.go +++ b/models/actions/task.go @@ -50,7 +50,7 @@ type ActionTask struct { LogInStorage bool // read log from database or from storage LogLength int64 // lines count LogSize int64 // blob size - LogIndexes *LogIndexes `xorm:"BLOB"` // line number to offset + LogIndexes *LogIndexes `xorm:"LONGBLOB"` // line number to offset LogExpired bool // files that are too old will be deleted Created timeutil.TimeStamp `xorm:"created"` diff --git a/models/actions/utils.go b/models/actions/utils.go index c89628a6c8..5498742443 100644 --- a/models/actions/utils.go +++ b/models/actions/utils.go @@ -29,6 +29,20 @@ func generateSaltedToken() (string, string, string, string, error) { return token, salt, hash, token[:8], nil } +/* +LogIndexes is the index for mapping log line number to buffer offset. +Because it uses varint encoding, it is impossible to predict its size. +But we can make a simple estimate with an assumption that each log line has 200 byte, then: +| lines | file size | index size | +|-----------|---------------------|--------------------| +| 100 | 20 KiB(20000) | 258 B(258) | +| 1000 | 195 KiB(200000) | 2.9 KiB(2958) | +| 10000 | 1.9 MiB(2000000) | 34 KiB(34715) | +| 100000 | 19 MiB(20000000) | 386 KiB(394715) | +| 1000000 | 191 MiB(200000000) | 4.1 MiB(4323626) | +| 10000000 | 1.9 GiB(2000000000) | 47 MiB(49323626) | +| 100000000 | 19 GiB(20000000000) | 490 MiB(513424280) | +*/ type LogIndexes []int64 func (indexes *LogIndexes) FromDB(b []byte) error { diff --git a/models/migrations/v-dev.go b/models/migrations/v-dev.go index 26065238c0..408e59df0f 100644 --- a/models/migrations/v-dev.go +++ b/models/migrations/v-dev.go @@ -121,7 +121,7 @@ func addActionsTables(x *xorm.Engine) error { LogInStorage bool // read log from database or from storage LogLength int64 // lines count LogSize int64 // blob size - LogIndexes *[]int64 `xorm:"BLOB"` // line number to offset + LogIndexes *[]int64 `xorm:"LONGBLOB"` // line number to offset LogExpired bool // files that are too old will be deleted Created timeutil.TimeStamp `xorm:"created"`