Skip to content

Commit

Permalink
Fix multi part issues with sequence part
Browse files Browse the repository at this point in the history
  • Loading branch information
nimrod-becker committed Aug 5, 2015
1 parent 372b70b commit 1876665
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/api/object_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ module.exports = {
type: 'array',
items: 'string',
},
upload_part_number: {
type: 'integer',
},
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/api/object_driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ ObjectDriver.prototype.upload_stream_parts = function(params) {
key: params.key,
parts: _.map(parts, function(part) {
var p = _.pick(part, 'start', 'end');
p.upload_part_number = upload_part_number;
if (!part.dedup) {
p.block_ids = _.flatten(
_.map(part.fragments, function(fragment) {
Expand Down
5 changes: 4 additions & 1 deletion src/server/object_mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function allocate_object_parts(bucket, obj, parts) {
return {
start: part.start,
end: part.end,
upload_part_number: part.upload_part_number,
part_sequence_number: part.part_sequence_number
};
});
Expand Down Expand Up @@ -261,14 +262,16 @@ function allocate_object_parts(bucket, obj, parts) {
*/
function finalize_object_parts(bucket, obj, parts) {
var block_ids = _.flatten(_.map(parts, 'block_ids'));
dbg.log1('finalize_object_parts');
var chunks;
var upload_part_number = (parts[0].upload_part_number ? parts[0].upload_part_number : null);
dbg.log1('finalize_object_parts', upload_part_number);
return Q.all([

// find parts by start offset, deleted parts are handled later
db.ObjectPart
.find({
obj: obj.id,
upload_part_number: upload_part_number,
start: {
$in: _.map(parts, 'start')
}
Expand Down

0 comments on commit 1876665

Please sign in to comment.