mongodb-d4 icon indicating copy to clipboard operation
mongodb-d4 copied to clipboard

Prune Empty Sessions + Operations

Open apavlo opened this issue 13 years ago • 2 comments
trafficstars

The SQL->Mongo workload traces sometimes contain sessions without any operations. We should just check when we're creating a session whether it actually has any operations and prune them if they don't.

From the epinions workload:

> db.sessions.findOne({'operations': {$size: 0}})
{ "_id" : ObjectId("4f9be5207ea57382dd0235ae"), 
  "ip2" : "10.0.1.2",
  "operations" : [ ], 
  "ip1" : "127.0.0.1",
  "uid" : 6018 }

There are also queries that don't have any content at all. I'm not sure whether this should be a full scan of the collection or whether it's just junk data:

> db.sessions.find({'operations.content.query': null}, {}).count()
2970

apavlo avatar Apr 28 '12 15:04 apavlo

There is a operation in the epinions workload that has a null WHERE clause for an update:

> db.sessions.findOne({"_id": ObjectId("4f9c68f67ea5738a7f022eed")})
{
        "_id" : ObjectId("4f9c68f67ea5738a7f022eed"),
        "ip2" : "192.168.63.1",
        "operations" : [
                {
                        "timestamp" : 1335551334,
                        "collection" : "item",
                        "content" : [
                                null,
                                {
                                        "jBbkw" : "j",
                                        "title" : ""
                                }
                        ],
                        "output" : [ ],
                        "type" : "$update",
                        "size" : 0
                }
        ],
        "ip1" : "127.0.0.1",
        "uid" : 4289
}

apavlo avatar Apr 29 '12 00:04 apavlo

The first issue of empty sessions has been resovled.

christopher-keith avatar Apr 29 '12 13:04 christopher-keith