]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1891] (unrelated) regression fix: make sure multiple updates after rollback.
authorJINMEI Tatuya <jinmei@isc.org>
Tue, 17 Apr 2012 23:37:28 +0000 (16:37 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Tue, 17 Apr 2012 23:37:28 +0000 (16:37 -0700)
this is a fix to the similar bug as the one fixed in the previous commit,
but for the rollback case.

src/lib/datasrc/sqlite3_accessor.cc
src/lib/datasrc/tests/sqlite3_accessor_unittest.cc

index a81a80e86874c03d257117f82791e1b91850d687..12955bd3372d6e8759835ae4b99d1606009675fb 100644 (file)
@@ -1104,6 +1104,7 @@ SQLite3Accessor::rollback() {
     StatementProcessor(*dbparameters_, ROLLBACK,
                        "rollback an SQLite3 transaction").exec();
     dbparameters_->in_transaction = false;
+    dbparameters_->updating_zone = false;
     dbparameters_->updated_zone_id = -1;
 }
 
index c2e8418bd61f0ce03e889204a8a1f18ef18707f6..8e8e9140584b3a5a8fa917b341f7dac45bccb0dd 100644 (file)
@@ -1026,7 +1026,11 @@ TEST_F(SQLite3Update, addThenRollback) {
     expected_stored.push_back(new_data);
     checkRecords(*accessor, zone_id, "newdata.example.com.", expected_stored);
 
+    // Rollback the transaction, and confirm the zone reverts to the previous
+    // state.  We also start another update to check if the accessor can be
+    // reused for a new update after rollback.
     accessor->rollback();
+    zone_id = accessor->startUpdateZone("example.com.", false).second;
     checkRecords(*accessor, zone_id, "newdata.example.com.", empty_stored);
 }