* return a bool for checkMaybeCorrupt
* store plumbing for SetCorruptedAt
* debug
* move to markIfCorrupted + test
* add additional checks for repo corruption
* add test cases for server repo corruption detection
* add corrupted_at field for sql mapping
* fix err not being returned
* ensure corrupted at gets mapped
* test cases to ensure corrupted at gets cleared
* add migration
* update types for CorrruptedAt
* fix sql query and remove field for now
* run go generate
* Update internal/database/gitserver_repos_test.go
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Update internal/database/gitserver_repos_test.go
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Update cmd/gitserver/server/cleanup.go
Co-authored-by: Erik Seliger <erikseliger@me.com>
* review comments
* review feedback
- check for err
- remove reason
- set default timestamp to 0 value
* tests pass 🎉
* reset stiched migration graph
* go gen magic
* move docstring
* check for err in corruption check
* fix tests 🤞
* add corruption_lod column and rename migration
* fix migration scripts
* go gen
* change corruption_log column type to jsonb
* update db mocks
* add logCorruption method
- log repo corruption into a JSON array
- limit repo corruption log to 10 elements
- db tests
* fix wording and remove test
* add CorruptionLog to ignored fields
* add more ignores
* remove comment
* review feedback
* log git corrupt stderr
* cap corruption reason to 1mb
* rename CorruptionLog -> CorruptionLogs
* rename corruption_log -> corruption_logs
* Update internal/database/gitserver_repos_test.go
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
* Fixes
Fix rename in cmp IgnoreFields
Fix malformed SQL
* fix test
* add comment to trigger sonar cloud analysis
* review comments
append to json array in postgres
* add comment about json query
* comments and fixes
* Update cmd/gitserver/server/server_test.go
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
* Fix indentation
* review feedback
- Make corrupted_at column nullable
- Check err returned from LogCorruption call
- Add condition to make sure we only log more
repo corruptions if there repo isn't currently
corrupt.
- Run sg generate
* Fix test
- update corrupted_at also when using GitserverRepo store update
- clear corrupted_at status during batch sync update
* Update cmd/gitserver/server/server_test.go
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
* store plumbing for SetCorruptedAt
* debug
* move to markIfCorrupted + test
* add additional checks for repo corruption
* add test cases for server repo corruption detection
* add migration
* update types for CorrruptedAt
* fix sql query and remove field for now
* review comments
* review feedback
- check for err
- remove reason
- set default timestamp to 0 value
* reset stiched migration graph
* add corruption_lod column and rename migration
* go gen
* add logCorruption method
- log repo corruption into a JSON array
- limit repo corruption log to 10 elements
- db tests
* fix wording and remove test
* Fix more indentation 🤦🏻
* review feedback: update test
* run sg generate again
* test fixes
- warn instead of return an error during cleanup
- delete repos so that the name can be reused
* fix bug
- repo was corrupt but did not set the reason so the repo never got
cleaned up
* review feedback
- sql query indentation
* review feedback
- use assert module
* do not clear corruption status on err
* add test for LastError and corruptedAt
- fix SQL issue on LastError
Co-authored-by: Erik Seliger <erikseliger@me.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>