Changeset 21463 for trunk/ippTools/src/faketool.c
- Timestamp:
- Feb 13, 2009, 8:51:50 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/faketool.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/faketool.c
r21402 r21463 41 41 static bool revertprocessedimfileMode(pxConfig *config); 42 42 static bool updateprocessedimfileMode(pxConfig *config); 43 static bool promoteexpMode(pxConfig *config); 43 44 static bool blockMode(pxConfig *config); 44 45 static bool maskedMode(pxConfig *config); … … 52 53 static bool topurgedimfileMode(pxConfig *config); 53 54 54 static bool fakeProcessedCompleteExp(pxConfig *config);55 56 55 # define MODECASE(caseName, func) \ 57 56 case caseName: \ … … 79 78 MODECASE(FAKETOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileMode); 80 79 MODECASE(FAKETOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileMode); 80 MODECASE(FAKETOOL_MODE_PROMOTEEXP, promoteexpMode); 81 81 MODECASE(FAKETOOL_MODE_BLOCK, blockMode); 82 82 MODECASE(FAKETOOL_MODE_MASKED, maskedMode); … … 520 520 } 521 521 522 // XXX I've decided to make the transaction cover the Exp migration as523 // well. Otherwise, if the last imfile in an exp is moved and the exp524 // migration fails then the data base is left in a satuation where the exp525 // migration can't happen.526 527 if (!fakeProcessedCompleteExp(config)) {528 // rollback529 if (!psDBRollback(config->dbh)) {530 psError(PS_ERR_UNKNOWN, false, "database error");531 }532 psError(PS_ERR_UNKNOWN, false, "database error");533 return false;534 }535 536 522 if (!psDBCommit(config->dbh)) { 537 523 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1062 1048 } 1063 1049 1064 static bool fakeProcessedCompleteExp(pxConfig *config)1050 static bool promoteexpMode(pxConfig *config) 1065 1051 { 1066 1052 PS_ASSERT_PTR_NON_NULL(config, false); 1053 1054 psMetadata *where = psMetadataAlloc(); 1055 PXOPT_COPY_S64(config->args, where, "-fake_id", "fake_id", "=="); 1056 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 1057 1058 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1067 1059 1068 1060 // look for completed fakePendingExp … … 1074 1066 } 1075 1067 1068 if (where && psListLength(where->list)) { 1069 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1070 psStringAppend(&query, " WHERE %s", whereClause); 1071 psFree(whereClause); 1072 } 1073 psFree(where); 1074 1075 // treat limit == 0 as "no limit" 1076 if (limit) { 1077 psString limitString = psDBGenerateLimitSQL(limit); 1078 psStringAppend(&query, " %s", limitString); 1079 psFree(limitString); 1080 } 1081 1076 1082 if (!p_psDBRunQuery(config->dbh, query)) { 1077 1083 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1096 1102 1097 1103 fakeRunRow *fakeRun = fakeRunObjectFromMetadata(row); 1104 if (!psDBTransaction(config->dbh)) { 1105 psError(PS_ERR_UNKNOWN, false, "database error"); 1106 return false; 1107 } 1108 1098 1109 // set fakeRun.state to 'full' 1099 1110 if (!pxfakeRunSetState(config, fakeRun->fake_id, "full")) { 1100 1111 psError(PS_ERR_UNKNOWN, false, "failed to change fakeRun.state for fake_id: %" PRId64, fakeRun->fake_id); 1112 if (!psDBRollback(config->dbh)) { 1113 psError(PS_ERR_UNKNOWN, false, "database error"); 1114 } 1101 1115 psFree(fakeRun); 1102 1116 psFree(output); … … 1104 1118 } 1105 1119 1106 // should we stop here or proceed on to the camstage?1120 // should we stop here or proceed on to the warp stage? 1107 1121 // NULL for end_stage means go as far as possible 1108 1122 if ((fakeRun->end_stage && psStrcasestr(fakeRun->end_stage, "fake")) || !fakeRun->tess_id) { 1109 1123 psFree(fakeRun); 1124 if (!psDBCommit(config->dbh)) { 1125 psError(PS_ERR_UNKNOWN, false, "database error"); 1126 return false; 1127 } 1110 1128 continue; 1111 1129 } 1112 1130 // else continue on... 1113 1131 1114 // camQueueFakeID() can only be run after fakeRun.state has been set to 1115 // stop 1132 // pxwarpQueueByFakeID() can only be run after fakeRun.state has been set to stop 1116 1133 if (!pxwarpQueueByFakeID(config, 1117 1134 fakeRun->fake_id, … … 1122 1139 fakeRun->end_stage 1123 1140 )) { 1124 psError(PS_ERR_UNKNOWN, false, "failed to queue camPendingExp"); 1141 psError(PS_ERR_UNKNOWN, false, "failed to queue warpRun"); 1142 if (!psDBRollback(config->dbh)) { 1143 psError(PS_ERR_UNKNOWN, false, "database error"); 1144 } 1125 1145 psFree(fakeRun); 1126 1146 psFree(output); 1147 return false; 1148 } 1149 if (!psDBCommit(config->dbh)) { 1150 psError(PS_ERR_UNKNOWN, false, "database error"); 1151 psFree(fakeRun); 1127 1152 return false; 1128 1153 }
Note:
See TracChangeset
for help on using the changeset viewer.
