Merge lp:~mandel/ubuntuone-client/fix_tritcask_windows into lp:ubuntuone-client

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 821
Merged at revision: 820
Proposed branch: lp:~mandel/ubuntuone-client/fix_tritcask_windows
Merge into: lp:ubuntuone-client
Diff against target: 13 lines (+3/-0)
1 file modified
ubuntuone/syncdaemon/tritcask.py (+3/-0)
To merge this branch: bzr merge lp:~mandel/ubuntuone-client/fix_tritcask_windows
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Guillermo Gonzalez Approve
Review via email: mp+47532@code.launchpad.net

Commit message

Ensure that an extra seek is used so that the write can be done in all platforms.

Description of the change

Ensure that an extra seek is used so that the write can be done in all platforms.

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

+1

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/syncdaemon/tritcask.py'
2--- ubuntuone/syncdaemon/tritcask.py 2011-01-12 14:29:37 +0000
3+++ ubuntuone/syncdaemon/tritcask.py 2011-01-26 14:26:14 +0000
4@@ -223,6 +223,9 @@
5 tstamp = time.time()
6 header = header_struct.pack(tstamp, key_sz, value_sz, row_type)
7 crc32 = crc32_struct.pack(zlib.crc32(header+key+value))
8+ # seek to end of file even if we are in append mode, but py2.x IO
9+ # in win32 is really buggy, see: http://bugs.python.org/issue3207
10+ self.fd.seek(0, os.SEEK_END)
11 self.fd.write(crc32+header)
12 self.fd.write(key)
13 value_pos = self.fd.tell()

Subscribers

People subscribed via source and target branches