Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index: add receive hook #1644

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MichaHoffmann
Copy link
Member

This removes the need for the cond + replica storage configuration and hooks up the index and its backing storage using the blobhub. Also fixed a bug where serverinit installs a wrapper instead of the storage which causes the receive hooks to be fired for the wrapper but not for the storage itself causing us to mix sync and index for it.

@MichaHoffmann MichaHoffmann force-pushed the mhoffm-add-receiveblob-hook-for-indexer branch 2 times, most recently from 6caa695 to 4463073 Compare January 8, 2023 22:32
@MichaHoffmann
Copy link
Member Author

MichaHoffmann commented Jan 8, 2023

Windows failures seem genuine, but i dont understand them yet.

Edit:

2023/01/09 21:23:48 Client error: Error receiving blob sha224-ea0ba9068820cc128e993b20d0511de736febc62fbd430d17bba9792: rename C:\Users\RUNNER~1\AppData\Local\Temp\perkeep-test-227401532\sha224\ea\0b\sha224-ea0ba9068820cc128e993b20d0511de736febc62fbd430d17bba9792.dat.tmp3900146689 C:\Users\RUNNER~1\AppData\Local\Temp\perkeep-test-227401532\sha224\ea\0b\sha224-ea0ba9068820cc128e993b20d0511de736febc62fbd430d17bba9792.dat: Access is denied.

ignoring EACCESS kinda fixes the issue, im not sure what happens though, something may have a handle to the file open while somethign else attempts the rename.

@MichaHoffmann MichaHoffmann force-pushed the mhoffm-add-receiveblob-hook-for-indexer branch 7 times, most recently from edc931b to 36edc4a Compare January 14, 2023 19:59
This removes the need for the `cond` storage and hooks up the index
and its backing storage using the blobhub. Also fixed a bug where
serverinit installs a wrapper instead of the storage which causes
the receive hooks to be fired for the wrapper but not for the storage
itself causing us to mix sync and index for it.
@MichaHoffmann MichaHoffmann force-pushed the mhoffm-add-receiveblob-hook-for-indexer branch from 36edc4a to 8c9aafc Compare January 14, 2023 21:04
@@ -28,9 +28,9 @@ import (

const maxRemovesPerRequest = 1000

func CreateRemoveHandler(storage blobserver.Storage) http.Handler {
func CreateRemoveHandler(storage blobserver.Storage, config *blobserver.Config) http.Handler {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add docs to these methods? how's this config used? send separately?

@@ -29,22 +29,17 @@ import (
"perkeep.org/pkg/blobserver/protocol"
)

func CreateStatHandler(storage blobserver.BlobStatter) http.Handler {
func CreateStatHandler(storage blobserver.BlobStatter, config *blobserver.Config) http.Handler {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -35,13 +36,13 @@ type BlobHub interface {
//
// If any synchronous receive hooks are registered, they're run before
// NotifyBlobReceived returns and their error is returned.
NotifyBlobReceived(blob.SizedRef) error
NotifyBlobReceived(context.Context, blob.SizedRef) error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send all this context plumbing in its own PR(s)?

Comment on lines 44 to +45
// NotifyBlobReceived will only return one of the errors.
AddReceiveHook(func(blob.SizedRef) error)
AddReceiveHook(func(context.Context, blob.SizedRef) error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and some docs on how the context is used?

Comment on lines +36 to 48
found := false
for _, errno := range []error{
syscall.ERROR_ALREADY_EXISTS,
syscall.ERROR_ACCESS_DENIED,
} {
if errors.Is(linkErr, errno) {
found = true
break
}
}
if !found {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send separately with a test? document/justify the access denied on rename thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants