use of com.eightkdata.mongowp.exceptions.CommandNotFoundException in project torodb by torodb.
the class OplogOperationApplier method applyCmd.
@SuppressWarnings("unchecked")
private void applyCmd(DbCmdOplogOperation op, ExclusiveWriteMongodTransaction trans, ApplierContext applierContext) throws OplogApplyingException {
LibraryEntry librayEntry = library.find(op.getRequest());
if (librayEntry == null) {
throw new OplogApplyingException(new CommandNotFoundException(op.getRequest().isEmpty() ? "?" : op.getRequest().getFirstEntry().getKey()));
}
Command command = librayEntry.getCommand();
if (command == null) {
BsonDocument document = op.getRequest();
if (document.isEmpty()) {
throw new OplogApplyingException(new CommandNotFoundException("Empty document query"));
}
String firstKey = document.getFirstEntry().getKey();
throw new OplogApplyingException(new CommandNotFoundException(firstKey));
}
Object arg;
try {
arg = command.unmarshallArg(op.getRequest(), librayEntry.getAlias());
} catch (MongoException ex) {
throw new OplogApplyingException(ex);
}
Status executionResult = executeReplCommand(op.getDatabase(), command, arg, trans.getTorodTransaction());
if (!executionResult.isOk()) {
throw new OplogApplyingException(new MongoException(executionResult));
}
}
Aggregations