Skip to content

cross operation on multi bulks result in additional records inserts #197

Closed
@qfrank

Description

say we have two bulk variables defined from different collections named "Bulk1" and "Bulk2". After running following code, collection "Bulk1" get 2 document inserted, but collection "Bulk2" also get 2 documents inserted! the reason for this is because actionPool defined in bulk.go is not safe in this situation. i just made a pull request to resolve this issue, hope it will get accepted, thanks

var blk = DB().C("Bulk1").Bulk()
var blk2 = DB().C("Bulk2").Bulk()
for i := 0; i < 2; i++ {
	blk.Insert(bson.M{})
	if i==0{
		blk.Run()
	}
}
blk2.Insert(bson.M{})
blk.Run()
blk2.Run()`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions