mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-15 07:55:51 +00:00
support getmore; support find with sort; cleanups
This commit is contained in:
@@ -73,38 +73,41 @@ type SystemProfile struct {
|
||||
} `bson:"acquireCount"`
|
||||
} `bson:"MMAPV1Journal"`
|
||||
} `bson:"locks"`
|
||||
Millis int `bson:"millis"`
|
||||
Nreturned int `bson:"nreturned"`
|
||||
Ns string `bson:"ns"`
|
||||
NumYield int `bson:"numYield"`
|
||||
Op string `bson:"op"`
|
||||
Protocol string `bson:"protocol"`
|
||||
Query BsonD `bson:"query"`
|
||||
UpdateObj BsonD `bson:"updateobj"`
|
||||
Command BsonD `bson:"command"`
|
||||
ResponseLength int `bson:"responseLength"`
|
||||
Ts time.Time `bson:"ts"`
|
||||
User string `bson:"user"`
|
||||
WriteConflicts int `bson:"writeConflicts"`
|
||||
Millis int `bson:"millis"`
|
||||
Nreturned int `bson:"nreturned"`
|
||||
Ns string `bson:"ns"`
|
||||
NumYield int `bson:"numYield"`
|
||||
Op string `bson:"op"`
|
||||
Protocol string `bson:"protocol"`
|
||||
Query BsonD `bson:"query"`
|
||||
UpdateObj BsonD `bson:"updateobj"`
|
||||
Command BsonD `bson:"command"`
|
||||
OriginatingCommand BsonD `bson:"originatingCommand"`
|
||||
ResponseLength int `bson:"responseLength"`
|
||||
Ts time.Time `bson:"ts"`
|
||||
User string `bson:"user"`
|
||||
WriteConflicts int `bson:"writeConflicts"`
|
||||
}
|
||||
|
||||
func NewExampleQuery(doc SystemProfile) ExampleQuery {
|
||||
return ExampleQuery{
|
||||
Ns: doc.Ns,
|
||||
Op: doc.Op,
|
||||
Query: doc.Query,
|
||||
Command: doc.Command,
|
||||
UpdateObj: doc.UpdateObj,
|
||||
Ns: doc.Ns,
|
||||
Op: doc.Op,
|
||||
Query: doc.Query,
|
||||
Command: doc.Command,
|
||||
OriginatingCommand: doc.OriginatingCommand,
|
||||
UpdateObj: doc.UpdateObj,
|
||||
}
|
||||
}
|
||||
|
||||
// ExampleQuery is a subset of SystemProfile
|
||||
type ExampleQuery struct {
|
||||
Ns string `bson:"ns" json:"ns"`
|
||||
Op string `bson:"op" json:"op"`
|
||||
Query BsonD `bson:"query,omitempty" json:"query,omitempty"`
|
||||
Command BsonD `bson:"command,omitempty" json:"command,omitempty"`
|
||||
UpdateObj BsonD `bson:"updateobj,omitempty" json:"updateobj,omitempty"`
|
||||
Ns string `bson:"ns" json:"ns"`
|
||||
Op string `bson:"op" json:"op"`
|
||||
Query BsonD `bson:"query,omitempty" json:"query,omitempty"`
|
||||
Command BsonD `bson:"command,omitempty" json:"command,omitempty"`
|
||||
OriginatingCommand BsonD `bson:"originatingCommand,omitempty" json:"originatingCommand,omitempty"`
|
||||
UpdateObj BsonD `bson:"updateobj,omitempty" json:"updateobj,omitempty"`
|
||||
}
|
||||
|
||||
func (self ExampleQuery) Db() string {
|
||||
@@ -218,6 +221,14 @@ func (self ExampleQuery) ExplainCmd() bson.D {
|
||||
{"insert", coll},
|
||||
}
|
||||
}
|
||||
case "getmore":
|
||||
if self.OriginatingCommand.Len() > 0 {
|
||||
cmd = self.OriginatingCommand
|
||||
} else {
|
||||
cmd = BsonD{
|
||||
{Name: "getMore", Value: ""},
|
||||
}
|
||||
}
|
||||
case "command":
|
||||
if cmd.Len() == 0 || cmd[0].Name != "group" {
|
||||
break
|
||||
|
Reference in New Issue
Block a user