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

xrootd : Checksum don't work after creation or update of a file #784

Open
kiderrien opened this issue Jul 23, 2020 · 3 comments
Open

xrootd : Checksum don't work after creation or update of a file #784

kiderrien opened this issue Jul 23, 2020 · 3 comments
Labels

Comments

@kiderrien
Copy link

Hello,

After creating or updating a file, I cannot get the checksum using query.checksum. However I get the checksum when it is not a new file or a file modified at the moment.

I get as a result:

Checksum:   �XJob scheduled.

or

Checksum:   �XJob scheduled.
panic: mux: cannot find data waiter for id [0 0]

I am using a local xrootd server with the adler32 checksum.

and I get the previously quoted errors with this code:

package main

import (

  "context"
  "fmt"
  "log"
  "time"

  "go-hep.org/x/hep/xrootd"
  "go-hep.org/x/hep/xrootd/xrdfs"
  "go-hep.org/x/hep/xrootd/xrdproto/query"


)
func main() {
  ctx := context.Background()
  client, err := xrootd.NewClient(ctx, "localhost", "gopher")
  if err != nil {
      log.Fatal(err)
  }
  defer client.Close()

  //file, err := client.FS().Open(ctx, "/tmp/test.txt", xrdfs.OpenModeOwnerRead|xrdfs.OpenModeOwnerWrite, xrdfs.OpenOptionsNew)
  file, err := client.FS().Open(ctx, "/tmp/test.txt", xrdfs.OpenModeOwnerRead|xrdfs.OpenModeOwnerWrite, xrdfs.OpenOptionsOpenUpdate)
  if err != nil {
      log.Fatal(err)
  }
  defer file.Close(ctx)

  if _, err := file.WriteAt([]byte("hello"), 0); err != nil {
      log.Fatal(err)
  }

  if err := file.Sync(ctx); err != nil {
      log.Fatal(err)
  }

  if err := file.Close(ctx); err != nil {
      log.Fatal(err)
  }

  time.Sleep(2 * time.Second)

  var (
    resp query.Response
    req = query.Request{
      Query: query.Checksum,
      Args:  []byte("/tmp/test.txt"),
    }
  )

  _, err = client.Send(ctx, &resp, &req)
  if err != nil {
    log.Fatalf("Checksum request error: %v", err)
  }

  fmt.Printf("Checksum: %v\n", string(resp.Data))

  if err := client.Close(); err != nil {
      log.Fatal(err)
  }
}

Is there something wrong with the way I use it?

@kiderrien kiderrien changed the title xrootd : Checksum error after creation or update of a file xrootd : Checksum don't work after creation or update of a file Jul 23, 2020
@sbinet
Copy link
Member

sbinet commented Aug 2, 2020

coming back from holidays.
I'll try to tackle this next week after clearing a bit of my backlog.

@sbinet
Copy link
Member

sbinet commented Aug 5, 2020

ok. the issue is that currently go-hep/xrootd doesn't handle async responses (ie: kXR_attn server responses) at all.
this needs "a bit" of code.

@kiderrien
Copy link
Author

Thank you for your reply.
I think we can close this ticket in this case.

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

No branches or pull requests

2 participants