- Testing Done:
-
+ Ran existing unit tests. These only test the backwards compatibility though, and don't test parent diffs.
+ Ran fill-database and all data was hashed accordingly. Manually posted reviews and posted parent diffs. All tests passed.
Reduce diff storage by hashing diff uploads
Review Request #2618 — Created Sept. 25, 2011 and submitted
Reduce diff storage by hashing diff uploads Diff files that already exist in the database will no longer be double-stored. Diffs are now hashed on upload and correspond to a new hash->binary table. Existing table data is not hashed and will remain for backwards compatibility. Evolutions have been made to create the new table and rename existing fields, so that model-logic can override fields. Test data has also been modified for new field name compatibility.
Ran fill-database and all data was hashed accordingly. Manually posted reviews and posted parent diffs. Created a unit test to check if hashes match.
Description | From | Last Updated |
---|---|---|
These are both built-in Python modules, so no blank line. |
|
|
I'm not really sure "Binary" is quite the term we want. FileDiffData might be better. Then "hash" and "data" fields. |
|
|
Docstrings are in the format of: """One-line summary Option multi-line description. """ It should always be a proper sentence, punctuation … |
|
|
Alignment problem. There's no need for \, since the parens take care of it. |
|
|
Same here. |
|
|
Blank line between these. A comment describing the next block of code should be separated. Also, comments should have proper … |
|
|
This can be: self.diff_hash, is_new = \ FileDiffBinary.objects.get_or_create(binary_hash=hashkey, defaults={ 'binary': diff }) |
|
|
Same logic can be applied here for the get_or_create. |
|
|
I?think that there should a corresponding py file for that? |
ZH zhenli | |
For consistencies sake, can we call that "kwargs"? |
|
|
Space after the if block |
|
|
Managers go in managers.py. |
|
|
It'd be nice to pull defaults out, so you don't repeat yourself (and also, don't assume defaults is set): defaults … |
|
|
Space before \ |
|
|
Put the comment inside the else: |
|
|
Two blank lines here |
|
|
Imports should be alphabetized. |
|
-
-
-
I'm not really sure "Binary" is quite the term we want. FileDiffData might be better. Then "hash" and "data" fields.
-
Docstrings are in the format of: """One-line summary Option multi-line description. """ It should always be a proper sentence, punctuation and all.
-
-
-
Blank line between these. A comment describing the next block of code should be separated. Also, comments should have proper punctuation (period at the end).
-
This can be: self.diff_hash, is_new = \ FileDiffBinary.objects.get_or_create(binary_hash=hashkey, defaults={ 'binary': diff })
-
- Change Summary:
-
Removed the AutoKey from FileDiffData and added a custom manager for the Base64Field AutoKey workaround
- Diff:
-
Revision 4 (+361 -134)
- Change Summary:
-
Removed the AutoKey from FileDiffData and added a custom manager for the Base64Field AutoKey workaround (Disregard revision 4)
- Change Summary:
-
Moved FileDiffDataManager to managers.py, added a unit test for hashes, cleaned up tests.py with pep8.
- Testing Done:
-
~ Ran existing unit tests. These only test the backwards compatibility though, and don't test parent diffs.
~ Ran fill-database and all data was hashed accordingly. Manually posted reviews and posted parent diffs. Created a unit test to check if hashes match.
- Ran fill-database and all data was hashed accordingly. Manually posted reviews and posted parent diffs. All tests passed.