@ -858,8 +858,8 @@ TEST(DBTest, WAL) {
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v1 " ) ) ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v1 " ) ) ;
Reopen ( ) ;
Reopen ( ) ;
ASSERT_EQ ( " NOT_FOUND " , Get ( " foo " ) ) ;
ASSERT_EQ ( " v1 " , Get ( " foo " ) ) ;
ASSERT_EQ ( " NOT_FOUND " , Get ( " bar " ) ) ;
ASSERT_EQ ( " v1 " , Get ( " bar " ) ) ;
writeOpt . disableWAL = false ;
writeOpt . disableWAL = false ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v2 " ) ) ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v2 " ) ) ;
@ -867,10 +867,9 @@ TEST(DBTest, WAL) {
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " foo " , " v2 " ) ) ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " foo " , " v2 " ) ) ;
Reopen ( ) ;
Reopen ( ) ;
// We garantee the 'bar' will be there
// Both value's should be present.
// because its put has WAL enabled.
// But 'foo' may or may not be there.
ASSERT_EQ ( " v2 " , Get ( " bar " ) ) ;
ASSERT_EQ ( " v2 " , Get ( " bar " ) ) ;
ASSERT_EQ ( " v2 " , Get ( " foo " ) ) ;
writeOpt . disableWAL = true ;
writeOpt . disableWAL = true ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v3 " ) ) ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v3 " ) ) ;
@ -878,9 +877,9 @@ TEST(DBTest, WAL) {
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " foo " , " v3 " ) ) ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " foo " , " v3 " ) ) ;
Reopen ( ) ;
Reopen ( ) ;
// 'foo' should be there because its put
// again both values should be present.
// has WAL enabled.
ASSERT_EQ ( " v3 " , Get ( " foo " ) ) ;
ASSERT_EQ ( " v3 " , Get ( " foo " ) ) ;
ASSERT_EQ ( " v3 " , Get ( " bar " ) ) ;
}
}
TEST ( DBTest , CheckLock ) {
TEST ( DBTest , CheckLock ) {
@ -895,13 +894,13 @@ TEST(DBTest, FLUSH) {
WriteOptions writeOpt = WriteOptions ( ) ;
WriteOptions writeOpt = WriteOptions ( ) ;
writeOpt . disableWAL = true ;
writeOpt . disableWAL = true ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " foo " , " v1 " ) ) ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " foo " , " v1 " ) ) ;
// this will not flush the last 2 writes
// this will now also flush the last 2 writes
dbfull ( ) - > Flush ( FlushOptions ( ) ) ;
dbfull ( ) - > Flush ( FlushOptions ( ) ) ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v1 " ) ) ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v1 " ) ) ;
Reopen ( ) ;
Reopen ( ) ;
ASSERT_EQ ( " v1 " , Get ( " foo " ) ) ;
ASSERT_EQ ( " v1 " , Get ( " foo " ) ) ;
ASSERT_EQ ( " NOT_FOUND " , Get ( " bar " ) ) ;
ASSERT_EQ ( " v1 " , Get ( " bar " ) ) ;
writeOpt . disableWAL = true ;
writeOpt . disableWAL = true ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v2 " ) ) ;
ASSERT_OK ( dbfull ( ) - > Put ( writeOpt , " bar " , " v2 " ) ) ;