Revision 843738d8dcbf666701db265c2479827040c8b1d3 authored by sdong on 12 June 2018, 23:59:46 UTC, committed by sdong on 18 June 2018, 16:50:10 UTC
Summary:
A recent change pushed down the upper bound checking to child iterators. However, this causes the logic of following sequence wrong:
  Seek(key);
  if (!Valid()) SeekToLast();
Because !Valid() may be caused by upper bounds, rather than the end of the iterator. In this case SeekToLast() points to totally wrong places. This can cause wrong results, infinite loops, or segfault in some cases.
This sequence is called when changing direction from forward to backward. And this by itself also implicitly happen during reseeking optimization in Prev().

Fix this bug by using SeekForPrev() rather than this sequence, as what is already done in prefix extrator case.
Closes https://github.com/facebook/rocksdb/pull/3989

Differential Revision: D8385422

Pulled By: siying

fbshipit-source-id: 429e869990cfd2dc389421e0836fc496bed67bb4
1 parent cc0a65f
Raw File
.travis.yml
sudo: false
dist: trusty
language: cpp
os:
  - linux
  - osx
compiler:
  - clang
  - gcc
osx_image: xcode8.3
jdk:
  - oraclejdk7
cache:
  - ccache
  - apt

addons:
   apt:
      packages: ['zlib1g-dev', 'libbz2-dev', 'libsnappy-dev', 'curl', 'libgflags-dev', 'mingw-w64']
env:
  - TEST_GROUP=platform_dependent # 16-18 minutes
  - TEST_GROUP=1 # 33-35 minutes
  - TEST_GROUP=2 # 30-32 minutes
  - TEST_GROUP=3 # ? minutes - under development
  # Run java tests
  - JOB_NAME=java_test # 4-11 minutes
  # Build ROCKSDB_LITE
  - JOB_NAME=lite_build # 3-4 minutes
  # Build examples
  - JOB_NAME=examples # 5-7 minutes
  - JOB_NAME=cmake # 3-5 minutes
  - JOB_NAME=cmake-mingw # 3 minutes

matrix:
  exclude:
  - os: osx
    env: TEST_GROUP=1
  - os: osx
    env: TEST_GROUP=2
  - os: osx
    env: TEST_GROUP=3
  - os : osx
    env: JOB_NAME=cmake-mingw
  - os : linux
    compiler: clang
  - os : osx
    compiler: gcc

# https://docs.travis-ci.com/user/caching/#ccache-cache
install:
  - if [ "${TRAVIS_OS_NAME}" == osx ]; then
      brew install ccache;
      PATH=$PATH:/usr/local/opt/ccache/libexec;
    fi
  - if [[ "${JOB_NAME}" == cmake* ]] && [ "${TRAVIS_OS_NAME}" == linux ]; then
      mkdir cmake-dist && curl -sfSL https://cmake.org/files/v3.8/cmake-3.8.1-Linux-x86_64.tar.gz | tar --strip-components=1 -C cmake-dist -xz && export PATH=$PWD/cmake-dist/bin:$PATH;
    fi

before_script:
  # Increase the maximum number of open file descriptors, since some tests use
  # more FDs than the default limit.
  - ulimit -n 8192

script:
  - ${CXX} --version
  - if [ `command -v ccache` ]; then ccache -C; fi
  - if [ "${TEST_GROUP}" == 'platform_dependent' ]; then OPT=-DTRAVIS V=1 ROCKSDBTESTS_END=db_block_cache_test make -j4 all_but_some_tests check_some; fi
  - if [ "${TEST_GROUP}" == '1' ]; then OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=db_block_cache_test ROCKSDBTESTS_END=comparator_db_test make -j4 check_some; fi
  - if [ "${TEST_GROUP}" == '2' ]; then OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=comparator_db_test ROCKSDBTESTS_END=write_prepared_transaction_test make -j4 check_some; fi
  - if [ "${TEST_GROUP}" == '3' ]; then OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=write_prepared_transaction_test make -j4 check_some; fi
  - if [ "${JOB_NAME}" == 'java_test' ]; then OPT=-DTRAVIS V=1 make clean jclean && make rocksdbjava jtest; fi
  - if [ "${JOB_NAME}" == 'lite_build' ]; then OPT="-DTRAVIS -DROCKSDB_LITE" V=1 make -j4 static_lib tools; fi
  - if [ "${JOB_NAME}" == 'examples' ]; then OPT=-DTRAVIS V=1 make -j4 static_lib; cd examples; make -j4; fi
  - if [ "${JOB_NAME}" == 'cmake' ]; then mkdir build && cd build && cmake -DJNI=1 .. && make -j4 rocksdb rocksdbjni; fi
  - if [ "${JOB_NAME}" == 'cmake-mingw' ]; then mkdir build && cd build && cmake -DJNI=1 .. -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_SYSTEM_NAME=Windows && make -j4 rocksdb rocksdbjni; fi
notifications:
    email:
      - leveldb@fb.com
    webhooks:
      - https://buildtimetrend.herokuapp.com/travis
back to top