storj/storagenode
Clement Sam 64e5fb7772 storagenode/collector: fix error check when file does not exist
The collector calls the Delete() method on the pieces
which returns an error which is wrapped by many error classes.
Delete() method is using Stat() from
1aec831d98/storage/filestore/dir.go (L328)
under the hood.
os.IsNotExist(errors.Unwrap(err) will always be false unless
errors.Unwrap(err) is called multiple times till it gets to
the core os.ErrNotExist. Here is a test case to explain better:

    func TestABC(t *testing.T) {
	classA := errs.Class("A")
	classB := errs.Class("B")

	wrappedError := classB.Wrap(classA.Wrap(os.ErrNotExist))

	require.True(t, os.IsNotExist(errs.Unwrap(wrappedError)))
	require.True(t, os.IsNotExist(errors.Unwrap(wrappedError)))
    }

Using errs.Is() seems to resolve this even without unwrapping the error:

    func TestABC(t *testing.T) {
	classA := errs.Class("A")
	classB := errs.Class("B")

	wrappedError := classB.Wrap(classA.Wrap(os.ErrNotExist))

	require.True(t, errs.Is(wrappedError, os.ErrNotExist))
	require.False(t, errs.Is(wrappedError, os.ErrExist))
	require.False(t, os.IsNotExist(wrappedError))
    }

Does not resolve the collector issue here but enhances it:
https://github.com/storj/storj/issues/4192

Change-Id: Ifb75dd15b54c1e1a5e23f6eba2d621d64874a5cc
2022-09-02 12:26:33 +00:00
..
apikeys multinode/payouts: estimated payouts added 2021-05-11 11:33:32 +00:00
bandwidth storagenode: add doc.go files for sno packages 2021-09-29 08:24:56 +00:00
collector storagenode/collector: fix error check when file does not exist 2022-09-02 12:26:33 +00:00
console storagenode/storageusage: add interval_end_time, rename interval_start to timestamp 2022-08-10 01:03:00 +00:00
contact storagenode: check if QUIC is properly configured 2022-01-20 12:04:04 +00:00
gracefulexit storagenode/gracefulexit: remove unused interface 2022-08-04 11:26:14 +03:00
healthcheck storagenode: accept HTTP calls on public port, listening for monitoring requests 2022-08-26 09:38:09 +00:00
inspector storagenode: add doc.go files for sno packages 2021-09-29 08:24:56 +00:00
internalpb all: fix linting issues 2022-03-21 15:26:42 +00:00
monitor storagenode: add doc.go files for sno packages 2021-09-29 08:24:56 +00:00
multinode storagenode/storageusage: add interval_end_time, rename interval_start to timestamp 2022-08-10 01:03:00 +00:00
nodestats storagenode/nodestats: retrieve storage usage starting from last day of previous month 2022-08-10 01:37:02 +00:00
notifications storagenode/console/consoleapi: use fixed time.Now() 2022-07-01 12:36:01 +03:00
operator storagenode: wallet features 2021-03-24 09:08:36 +00:00
orders storagenode: add doc.go files for sno packages 2021-09-29 08:24:56 +00:00
payouts storagenode/console/consoleapi: use fixed time.Now() 2022-07-01 12:36:01 +03:00
pieces storagenode/satellite: support different piece hash algorithms 2022-08-23 18:15:06 +00:00
piecestore storagenode/satellite: support different piece hash algorithms 2022-08-23 18:15:06 +00:00
piecetransfer mod: bump uplink 2021-05-06 14:48:36 +00:00
preflight storagenode/satellites: address added, caching satellite's addresses from trust 2021-07-08 15:38:23 +00:00
pricing all: golangci-lint v1.33.0 fixes (#3985) 2020-12-05 17:01:42 +01:00
reputation storagenode/reputation: clarify wording on suspension notification (#4921) 2022-06-20 22:07:12 +02:00
retain storagenode/satellite: support different piece hash algorithms 2022-08-23 18:15:06 +00:00
satellites Revert "storagenode/payouts: historical payouts use satellitesDB instead of trustPool" 2021-08-02 13:55:21 +03:00
storagenodedb storagenode/storagenodedb: fix null at_rest_total values for storage usage 2022-08-23 12:56:28 +00:00
storageusage storagenode/storagenodedb: fix null at_rest_total values for storage usage 2022-08-23 12:56:28 +00:00
trust all: reformat comments as required by gofmt 1.19 2022-08-10 18:24:55 +00:00
version storagenode/suspensions: added offline-suspension notificatio chore + tests 2020-10-29 19:44:22 +02:00
peer.go storagenode: accept HTTP calls on public port, listening for monitoring requests 2022-08-26 09:38:09 +00:00