(final TSDB tsdb,
final byte[] table,
final short idwidth,
final boolean ignorecase,
final String[] args)
| 139 | } |
| 140 | |
| 141 | private static int runCommand(final TSDB tsdb, |
| 142 | final byte[] table, |
| 143 | final short idwidth, |
| 144 | final boolean ignorecase, |
| 145 | final String[] args) { |
| 146 | final int nargs = args.length; |
| 147 | if (args[0].equals("grep")) { |
| 148 | if (2 <= nargs && nargs <= 3) { |
| 149 | try { |
| 150 | return grep(tsdb.getClient(), table, ignorecase, args); |
| 151 | } catch (HBaseException e) { |
| 152 | return 3; |
| 153 | } |
| 154 | } else { |
| 155 | usage("Wrong number of arguments"); |
| 156 | return 2; |
| 157 | } |
| 158 | } else if (args[0].equals("assign")) { |
| 159 | if (nargs < 3) { |
| 160 | usage("Wrong number of arguments"); |
| 161 | return 2; |
| 162 | } |
| 163 | return assign(tsdb, table, idwidth, args); |
| 164 | } else if (args[0].equals("rename")) { |
| 165 | if (nargs != 4) { |
| 166 | usage("Wrong number of arguments"); |
| 167 | return 2; |
| 168 | } |
| 169 | return rename(tsdb.getClient(), table, idwidth, args); |
| 170 | } else if (args[0].equals("delete")) { |
| 171 | if (nargs != 3) { |
| 172 | usage("Wrong number of arguments"); |
| 173 | return 2; |
| 174 | } |
| 175 | |
| 176 | try { |
| 177 | return delete(tsdb, table, args); |
| 178 | } catch (Exception e) { |
| 179 | LOG.error("Unexpected exception", e); |
| 180 | return 4; |
| 181 | } |
| 182 | } else if (args[0].equals("fsck")) { |
| 183 | boolean fix = false; |
| 184 | boolean fix_unknowns = false; |
| 185 | if (args.length > 1) { |
| 186 | for (String arg : args) { |
| 187 | if (arg.equals("fix")) { |
| 188 | fix = true; |
| 189 | } else if (arg.equals("delete_unknown")) { |
| 190 | fix_unknowns = true; |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | return fsck(tsdb.getClient(), table, fix, fix_unknowns); |
| 195 | } else if (args[0].equals("metasync")) { |
| 196 | // check for the data table existence and initialize our plugins |
| 197 | // so that update meta data can be pushed to search engines |
| 198 | try { |
no test coverage detected