Skip to content

mv exiry iter bug

Matthew Von-Maszewski edited this page Aug 22, 2016 · 2 revisions

Status

  • merged to master - August 21, 2016
  • code complete - August 19, 2016
  • development started - August 18, 2016

History / Context

Testing of the Riak Time Series product uncovered that expiry was not working for query / iterator operations. The existing unit tests validated several interface and underlying code APIs. The unit tests did not explicitly test database level Iterator operations. Adding such a test confirmed the product level bug.

The API DBImpl::NewIterator() in db/db_impl.cc did not populate the new, but optional, parameter of the NewDBIterator constructor. The missing parameter was the expiry module pointer. Everything works as expected upon adding the expiry module pointer to this call.

Branch description

db/db_impl.cc

DBImpl::NewIterator() (db/db_impl.cc) creates a new database iterator object. It returns this object's pointer to the caller as an opaque pointer. The routine calls NewDBIterator() to create the opaque pointer. NewDBIterator() was previously updated to accept an optional sixth parameter, an expiry module pointer. DBImpl::NewIterator() was not previously updated to pass the expiry module pointer. This fix adds the sixth parameter, the expiry module pointer.

leveldb_os/expiry_os_test.cc

This source file is using the Google supplied test harness for leveldb. The new class ExpiryDBTester is based upon the existing ExpiryManifestTester class. This class wraps each TEST(param1, param2) where the "param1" is "ExpiryDBTester". Today only one test exists, TEST(ExpiryDBTester, Simple). The Simple test

  • sets a 2 minute default expiry policy,
  • writes 5 records to the database,
  • validates all 5 records exist via the Get and Iterator interfaces,
  • shifts the clock forward 10 minutes,
  • validates all 5 records do NOT exist via Get and Iterator interfaces,
  • shifts clock back to original time,
  • forces 5 records out of write buffer and into an .sst table file,
  • validates all 5 records exist via the Get and Iterator interfaces,
  • shifts the clock forward 10 minutes,
  • validates all 5 records do NOT exist via Get and Iterator interfaces,
  • forces a compaction that should physically remove records (clock still forward 10 minutes),
  • shift clock back to original time (so original records would be valid if physically available),
  • validate all 5 records do NOT exist via Get and Iterator interfaces.

Both after shift tests of the Iterator interface failed prior to this bug fix.

Clone this wiki locally