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

Further work on checksums #1020

Merged
merged 5 commits into from
Apr 12, 2013
Merged

Further work on checksums #1020

merged 5 commits into from
Apr 12, 2013

Conversation

mtbc
Copy link
Member

@mtbc mtbc commented Apr 11, 2013

To test, try importing and suchlike to make sure that imports and viewing still work as before, and watch the originalfile table in the database to ensure that its hash and hasher columns are properly populated.

@@ -415,7 +432,7 @@ public String toString() {
}
}
} else {
ofile.setHash(sha1());
Copy link
Member

Choose a reason for hiding this comment

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

Should hasher be set here as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't actually have easily to hand a useful value it could set it with. With the codepaths as they are I think I satisfied myself that the PublicRepository file method accessing new files (probably?) wasn't a problem in this regard, and in RepositoryDaoImpl.createOriginalFile that does now have the relevant information so hasher gets set there instead.

If the story were less simple, though, then I'd be inclined toward a refactoring of CheckedPath and its clients that has it cache with which CheckedAlgorithm instance it was created; perhaps that is a direction we will go in anyway someday.

Copy link
Member

Choose a reason for hiding this comment

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

If it's happening later in processing, then no worries. Don't now if you want a TBD/TODO here to remind us, or if it will just happen naturally when we refactor. Up to you.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it'll happen naturally: given what we'll have to look at, it'll be hard not to notice.

@joshmoore
Copy link
Member

This certainly looks sounds:

omero=# select id, path, name, hasher, hash from originalfile order by id desc limit 1;
 id |               path                |           name           | hasher |                   hash
----+-----------------------------------+--------------------------+--------+------------------------------------------
 69 | user-1_8/2013-04/12/10-40-55.363/ | 1020.fake                |      6 | 0849a69d3e92fe43ef3d3bf48c0ba76cca6242cb
(1 row)

omero=# \q
omero@gretzky:~/OMERO-CURRENT$ shasum 1020.fake
0849a69d3e92fe43ef3d3bf48c0ba76cca6242cb  1020.fake

@joshmoore
Copy link
Member

Attaching a file in the web client to 1020.fake above produced:

 id |               path                |           name           | hasher |                   hash
----+-----------------------------------+--------------------------+--------+------------------------------------------
 70 | test.xml                          | test.xml                 |        | pending

@mtbc
Copy link
Member Author

mtbc commented Apr 12, 2013

Oooh, I didn't even know we could attach files in the web client. Fix that as a separate PR? (I assume this one doesn't actually change that behavior at all.)

@joshmoore
Copy link
Member

So this is likely a hold over from your last round of fixes of "fake" hash values? If so, no real harm. The culprit is likely:

$ git grep -E "[\"\']pending" mark/trac-10338 -- components/tools/Omero{Py,Web}
mark/trac-10338:components/tools/OmeroPy/test/integration/delete.py:            oFile.setHash(omero.rtypes.rstring("pending"));
mark/trac-10338:components/tools/OmeroPy/test/integration/tickets3000.py:        oFile.setHash(rstring("pending"));
mark/trac-10338:components/tools/OmeroWeb/omeroweb/webclient/controller/container.py:        oFile.setHash(rstring("pending"));

/cc @bpindelski: these are the type of other upload code paths I was mentioning.

@mtbc
Copy link
Member Author

mtbc commented Apr 12, 2013

Thanks for the pointer -- yes, I'd simply missed it before through not knowing of that upload path.

@joshmoore
Copy link
Member

Couple of todos under 10338 and 2581, but generally sound. Merging so @bpindelski's next PR can be rebased on top.

joshmoore added a commit that referenced this pull request Apr 12, 2013
Further work on checksums
@joshmoore joshmoore merged commit 1658e87 into ome:develop Apr 12, 2013
@mtbc mtbc deleted the trac-10338 branch April 12, 2013 12:37
@joshmoore
Copy link
Member

--no-rebase

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

Successfully merging this pull request may close these issues.

2 participants