mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:09:09 +00:00
fix bugs
This commit is contained in:
@@ -109,7 +109,7 @@ func TestExplain(t *testing.T) {
|
|||||||
for _, v := range versions {
|
for _, v := range versions {
|
||||||
// For versions < 3.4 parsing "getmore" is not supported and returns error
|
// For versions < 3.4 parsing "getmore" is not supported and returns error
|
||||||
if ok, _ := Constraint("< 3.4", v); ok {
|
if ok, _ := Constraint("< 3.4", v); ok {
|
||||||
expectError["getmore_"+v] = "Cannot explain cmd: getMore"
|
expectError["getmore_"+v] = "Explain failed due to unknown command: getmore"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -224,9 +224,20 @@ func (self ExampleQuery) ExplainCmd() bson.D {
|
|||||||
case "getmore":
|
case "getmore":
|
||||||
if self.OriginatingCommand.Len() > 0 {
|
if self.OriginatingCommand.Len() > 0 {
|
||||||
cmd = self.OriginatingCommand
|
cmd = self.OriginatingCommand
|
||||||
|
for i := range cmd {
|
||||||
|
// drop $db param as it is not supported in MongoDB 3.0
|
||||||
|
if cmd[i].Name == "$db" {
|
||||||
|
if len(cmd)-1 == i {
|
||||||
|
cmd = cmd[:i]
|
||||||
|
} else {
|
||||||
|
cmd = append(cmd[:i], cmd[i+1:]...)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cmd = BsonD{
|
cmd = BsonD{
|
||||||
{Name: "getMore", Value: ""},
|
{Name: "getmore", Value: ""},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "command":
|
case "command":
|
||||||
|
@@ -413,8 +413,7 @@ func testAllOperationsTemplate(t *testing.T, data Data) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
ndocs := "165"
|
expected := `Profiler is disabled for the "test" database but there are \s*[0-9]+ documents in the system.profile collection.
|
||||||
expected := `Profiler is disabled for the "test" database but there are ` + ndocs + ` documents in the system.profile collection.
|
|
||||||
Using those documents for the stats
|
Using those documents for the stats
|
||||||
pt-mongodb-query-digest .+
|
pt-mongodb-query-digest .+
|
||||||
Host: ` + data.url + `
|
Host: ` + data.url + `
|
||||||
@@ -425,7 +424,7 @@ Skipping profiled queries on these collections: \[system\.profile\]
|
|||||||
# Ratio [0-9\.]+ \(docs scanned/returned\)
|
# Ratio [0-9\.]+ \(docs scanned/returned\)
|
||||||
# Attribute pct total min max avg 95% stddev median
|
# Attribute pct total min max avg 95% stddev median
|
||||||
# ================== === ======== ======== ======== ======== ======== ======= ========
|
# ================== === ======== ======== ======== ======== ======== ======= ========
|
||||||
# Count \(docs\) ` + ndocs + `\s
|
# Count \(docs\) (\s*[0-9]+)\s
|
||||||
# Exec Time ms (\s*[0-9]+){8}\s
|
# Exec Time ms (\s*[0-9]+){8}\s
|
||||||
# Docs Scanned (\s*[0-9\.]+){8}\s
|
# Docs Scanned (\s*[0-9\.]+){8}\s
|
||||||
# Docs Returned (\s*[0-9\.]+){8}\s
|
# Docs Returned (\s*[0-9\.]+){8}\s
|
||||||
|
Reference in New Issue
Block a user