Arik Hadas has posted comments on this change.

Change subject: engine : Command Executor should persist command before 
submitting to threadpool
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.ovirt.org/#/c/29219/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java:

Line 111: 
Line 112:     public Future<VdcReturnValueBase> executeAsyncCommand(final 
VdcActionType actionType,
Line 113:                                                           final 
VdcActionParametersBase parameters) {
Line 114:         final CommandBase<?> command = 
CommandsFactory.createCommand(actionType, parameters);
Line 115:         
command.persistCommand(command.getParameters().getParentCommand(), true);
> Hi Arik
Hi Ravi

the test you've done is good, but I want to verify that there's no flow that 
might be problematic which wasn't detected by the test.

I was looking at ThreadPoolExecutor#execute which is the return value of 
Executors#newFixedThreadPool:

public void execute(Runnable command) {
        if (command == null)
            throw new NullPointerException();

        int c = ctl.get();
        if (workerCountOf(c) < corePoolSize) {
            if (addWorker(command, true))
                return;
            c = ctl.get();
        }
        if (isRunning(c) && workQueue.offer(command)) {
            int recheck = ctl.get();
            if (! isRunning(recheck) && remove(command))
                reject(command);
            else if (workerCountOf(recheck) == 0)
                addWorker(null, false);
        }
        else if (!addWorker(command, false))
            reject(command);
    }

there are cases where the command gets rejected, we need to be sure we won't 
end up with commands in the DB that won't be fetched until the engine restart.

I know that's subjective because it's a design decision but I would really like 
not to submit the task from the caller thread but to persist it into a DB and 
to have a background job that retrieves the commands from the DB and submit the 
tasks
Line 116:         return executor.submit(new Callable<VdcReturnValueBase>() {
Line 117: 
Line 118:             @Override
Line 119:             public VdcReturnValueBase call() throws Exception {


-- 
To view, visit http://gerrit.ovirt.org/29219
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4d510836dc822a95198dc1db4a4f74206466f0c9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ravi Nori <[email protected]>
Gerrit-Reviewer: Arik Hadas <[email protected]>
Gerrit-Reviewer: Oved Ourfali <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to