Maor Lipchuk has posted comments on this change.
Change subject: engine : Fail tasks that dont have Vdsm Id
......................................................................
Patch Set 7: (6 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AsyncTaskManager.java
Line 89: Config.<Integer>
GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds),
TimeUnit.SECONDS);
Line 90: _cacheTimeInMinutes = Config.<Integer>
GetValue(ConfigValues.AsyncTaskStatusCachingTimeInMinutes);
Line 91: tasksInDbAfterRestart = new ConcurrentHashMap<Guid,
List<AsyncTasks>>();
Line 92: for (AsyncTasks task:
DbFacade.getInstance().getAsyncTaskDao().getAll()) {
Line 93: if (task.getVdsmTaskId().equals(NGuid.Empty)) {
NGuid.Empty.equals(task.getVdsmTaskId()) could be a better practice
Also I think a log here could be helpful
Line 94: failTaskWithoutVdsmId(task);
Line 95: continue;
Line 96: }
Line 97: tasksInDbAfterRestart.putIfAbsent(task.getStoragePoolId(),
new ArrayList<AsyncTasks>());
Line 182:
Line 183: public static void failTaskWithoutVdsmId(final AsyncTasks
task) {
Line 184: task.getTaskParameters().setTaskGroupSuccess(false);
Line 185: ExecutionHandler.endTaskStep(task.getStepId(),
JobExecutionStatus.FAILED);
Line 186: removeTaskFromDbByTaskId(task.getTaskId());
The remove task from DB is not in the same transaction which the end action
executes (line 199), is this ok?
If engine will restart at the end action phase, or fail to run it, we will not
have any task in the DB to retry the end action again, am I right?
Line 187: if (task.getTaskType() == AsyncTaskType.unknown) {
Line 188: return;
Line 189: }
Line 190: ThreadPoolUtil.execute(new Runnable() {
Line 184: task.getTaskParameters().setTaskGroupSuccess(false);
Line 185: ExecutionHandler.endTaskStep(task.getStepId(),
JobExecutionStatus.FAILED);
Line 186: removeTaskFromDbByTaskId(task.getTaskId());
Line 187: if (task.getTaskType() == AsyncTaskType.unknown) {
Line 188: return;
A log here might be helpful
Line 189: }
Line 190: ThreadPoolUtil.execute(new Runnable() {
Line 191: @SuppressWarnings("synthetic-access")
Line 192: @Override
Line 206:
Line 207: protected static void removeTaskFromDbByTaskId(Guid taskId) {
Line 208: try {
Line 209: if
(DbFacade.getInstance().getAsyncTaskDao().remove(taskId) != 0) {
Line 210: log.infoFormat("BaseAsyncTask::RemoveTaskFromDB:
Removed task {0} from DataBase", taskId);
BaseAsyncTask::RemoveTaskFromDB: can be removed
Line 211: }
Line 212: } catch (RuntimeException e) {
Line 213: log.error(String.format(
Line 214: "AsyncTaskManager::RemoveTaskFromDB: Removing
task %1$s from DataBase threw an exception.",
Line 210: log.infoFormat("BaseAsyncTask::RemoveTaskFromDB:
Removed task {0} from DataBase", taskId);
Line 211: }
Line 212: } catch (RuntimeException e) {
Line 213: log.error(String.format(
Line 214: "AsyncTaskManager::RemoveTaskFromDB: Removing
task %1$s from DataBase threw an exception.",
AsyncTaskManager::RemoveTaskFromDB: can be removed from the log
Line 215: taskId), e);
Line 216: }
Line 217: }
Line 218:
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
Line 329: }
Line 330:
Line 331: private void clearAsyncTasksWithOutVdsmId() {
Line 332: for (Guid asyncTaskId :
getReturnValue().getAsyncTaskIdList()) {
Line 333: AsyncTasks task =
DbFacade.getInstance().getAsyncTaskDao().get(asyncTaskId);
/s/DbFacade.getInstance().getAsyncTaskDao()/getAsyncTaskDao
Line 334: if (task.getVdsmTaskId().equals(NGuid.Empty)) {
Line 335: AsyncTaskManager.failTaskWithoutVdsmId(task);
Line 336: }
Line 337: }
--
To view, visit http://gerrit.ovirt.org/14368
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I110c483842027d1596f64dd8c3f635d62924a93f
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ravi Nori <[email protected]>
Gerrit-Reviewer: Arik Hadas <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches