diff --git a/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql index d341642f9..2100f7de6 100644 --- a/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql +++ b/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql @@ -182,13 +182,13 @@ BEGIN END IF; END IF; END IF; -/* IF transaction_duplicate + IF transaction_duplicate OR transaction_duplicate2 THEN CLOSE curs_transaction_exist; ROLLBACK; RETURN; - END IF;*/ + END IF; CLOSE curs_transaction_exist; RETURN; END $$; diff --git a/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql index e2ab133bd..15d8ef6ff 100644 --- a/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql +++ b/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql @@ -249,16 +249,17 @@ BEGIN END IF; k=k+1; END LOOP; -/* IF transaction_duplicate + + IF transaction_duplicate OR transaction_duplicate2 OR transaction_duplicate3 OR transaction_duplicate4 THEN RAISE EXCEPTION 'Reserve did not exist, but INSERT into reserves_in gave conflict'; - + ROLLBACK; CLOSE curs_transaction_exist; RETURN; - END IF;*/ + END IF; CLOSE curs_transaction_exist; RETURN; diff --git a/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql index 2c61bfedf..6076f3299 100644 --- a/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql +++ b/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql @@ -421,7 +421,7 @@ BEGIN END IF; k=k+1; END LOOP; -/* IF transaction_duplicate + IF transaction_duplicate OR transaction_duplicate2 OR transaction_duplicate3 OR transaction_duplicate4 @@ -433,7 +433,7 @@ BEGIN CLOSE curs_transaction_existed; ROLLBACK; RETURN; - END IF;*/ + END IF; CLOSE curs_transaction_existed; RETURN; END $$; diff --git a/src/exchangedb/exchange_do_batch_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch_reserves_in_insert.sql index 7c11bee83..4ae7f68a2 100644 --- a/src/exchangedb/exchange_do_batch_reserves_in_insert.sql +++ b/src/exchangedb/exchange_do_batch_reserves_in_insert.sql @@ -94,9 +94,9 @@ transaction_duplicate= TRUE; RETURN; ELSE -- Unhappy... --- RAISE EXCEPTION 'Reserve did not exist, but INSERT into reserves_in gave conflict'; + RAISE EXCEPTION 'Reserve did not exist, but INSERT into reserves_in gave conflict'; transaction_duplicate = TRUE; --- ROLLBACK; + ROLLBACK; RETURN; END IF; RETURN; diff --git a/src/exchangedb/pg_batch2_reserves_in_insert.c b/src/exchangedb/pg_batch2_reserves_in_insert.c index 90848e0e6..34c15d1da 100644 --- a/src/exchangedb/pg_batch2_reserves_in_insert.c +++ b/src/exchangedb/pg_batch2_reserves_in_insert.c @@ -764,6 +764,8 @@ TEH_PG_batch2_reserves_in_insert (void *cls, t_duplicate |= transaction_duplicate[i+1]; t_duplicate |= transaction_duplicate[i+2]; t_duplicate |= transaction_duplicate[i+3]; + // fprintf(stdout, "%ld %ld c:%d t:%d %d %d %d\n", reserve_uuid[i], reserve_uuid[i+1], conflicts[i], t_duplicate, t_duplicate, transaction_duplicate[i+2], transaction_duplicate[i+3]); + i += 4; break; case 3: @@ -791,7 +793,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls, t_duplicate |= transaction_duplicate[i]; t_duplicate |= transaction_duplicate[i+1]; - //fprintf(stdout, "%ld %ld c:%d t:%d\n", reserve_uuid[i], reserve_uuid[i+1], conflicts[i], transaction_duplicate[i]); i += 2; break; case 1: @@ -835,13 +836,19 @@ TEH_PG_batch2_reserves_in_insert (void *cls, return cs; } } - if (! need_update) { goto exit; } + /* fprintf(stdout, "t : %d", t_duplicate); if (t_duplicate) - goto exit; + { + GNUNET_break (0); + TEH_PG_rollback (pg); + return GNUNET_DB_STATUS_HARD_ERROR; + } + */ + // begin serializable { if (GNUNET_OK != @@ -864,7 +871,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls, { if (! conflicts[i]) continue; - // fprintf(stdout, "%d\n", conflicts[i]); { bool duplicate; struct GNUNET_PQ_QueryParam params[] = { @@ -889,7 +895,7 @@ TEH_PG_batch2_reserves_in_insert (void *cls, if (qs3<0) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Failed to update (%d)\n", + "Failed to update reserves (%d)\n", qs3); results[i] = qs3; return qs3; diff --git a/src/exchangedb/test_exchangedb_populate_table.c b/src/exchangedb/test_exchangedb_populate_table.c index ae1d5bdfa..d67d1307a 100644 --- a/src/exchangedb/test_exchangedb_populate_table.c +++ b/src/exchangedb/test_exchangedb_populate_table.c @@ -538,7 +538,6 @@ run (void *cls) plugin->insert_refund (plugin->cls, &ref)); }*/ - } result = 0;