()
| 68 | } |
| 69 | |
| 70 | func init() { |
| 71 | Debug.Cmd = &cobra.Command{ |
| 72 | Use: "debug", |
| 73 | Short: "Debug Dgraph instance", |
| 74 | Run: func(cmd *cobra.Command, args []string) { |
| 75 | run() |
| 76 | }, |
| 77 | Annotations: map[string]string{"group": "debug"}, |
| 78 | } |
| 79 | Debug.Cmd.SetHelpTemplate(x.NonRootTemplate) |
| 80 | |
| 81 | flag := Debug.Cmd.Flags() |
| 82 | flag.BoolVar(&opt.itemMeta, "item", true, "Output item meta as well. Set to false for diffs.") |
| 83 | flag.BoolVar(&opt.vals, "vals", false, "Output values along with keys.") |
| 84 | flag.BoolVar(&opt.noKeys, "nokeys", false, |
| 85 | "Ignore key_. Only consider amount when calculating total.") |
| 86 | flag.StringVar(&opt.jepsen, "jepsen", "", "Disect Jepsen output. Can be linear/binary.") |
| 87 | flag.Uint64Var(&opt.readTs, "at", math.MaxUint64, "Set read timestamp for all txns.") |
| 88 | flag.BoolVarP(&opt.readOnly, "readonly", "o", true, "Open in read only mode.") |
| 89 | flag.StringVarP(&opt.predicate, "pred", "r", "", "Only output specified predicate.") |
| 90 | flag.StringVarP(&opt.prefix, "prefix", "", "", "Uses a hex prefix.") |
| 91 | flag.StringVarP(&opt.keyLookup, "lookup", "l", "", "Hex of key to lookup.") |
| 92 | flag.StringVar(&opt.rollupKey, "rollup", "", "Hex of key to rollup.") |
| 93 | flag.BoolVarP(&opt.keyHistory, "history", "y", false, "Show all versions of a key.") |
| 94 | flag.StringVarP(&opt.pdir, "postings", "p", "", "Directory where posting lists are stored.") |
| 95 | flag.BoolVar(&opt.sizeHistogram, "histogram", false, |
| 96 | "Show a histogram of the key and value sizes.") |
| 97 | flag.BoolVar(&opt.onlySummary, "only-summary", false, |
| 98 | "If true, only show the summary of the p directory.") |
| 99 | |
| 100 | // Flags related to WAL. |
| 101 | flag.StringVarP(&opt.wdir, "wal", "w", "", "Directory where Raft write-ahead logs are stored.") |
| 102 | flag.Uint64VarP(&opt.wtruncateUntil, "truncate", "t", 0, |
| 103 | "Remove data from Raft entries until but not including this index.") |
| 104 | flag.StringVarP(&opt.wsetSnapshot, "snap", "s", "", |
| 105 | "Set snapshot term,index,readts to this. Value must be comma-separated list containing"+ |
| 106 | " the value for these vars in that order.") |
| 107 | flag.StringVar(&opt.parseKey, "parse_key", "", "Parse hex key.") |
| 108 | x.RegisterEncFlag(flag) |
| 109 | } |
| 110 | |
| 111 | func toInt(o *pb.Posting) int { |
| 112 | from := types.Val{ |
nothing calls this directly
no test coverage detected