New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: inline get_limit_at_size #2401

Merged
merged 5 commits into from Oct 26, 2017

Conversation

Projects
None yet
5 participants
@odeits
Contributor

odeits commented Oct 19, 2017

removes need to use Iterator::count and allows to not call Vec::truncate
if NO_LIMIT

Fixes tikv/tikv#2400

@sre-bot

This comment has been minimized.

Show comment
Hide comment
@sre-bot

sre-bot Oct 19, 2017

Collaborator

Hi contributor, thanks for your PR.

This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically.

Collaborator

sre-bot commented Oct 19, 2017

Hi contributor, thanks for your PR.

This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically.

Show outdated Hide outdated src/util/mod.rs
Show outdated Hide outdated src/util/mod.rs
Show outdated Hide outdated src/util/mod.rs
@siddontang

This comment has been minimized.

Show comment
Hide comment
@siddontang

siddontang Oct 22, 2017

Contributor

LGTM

Contributor

siddontang commented Oct 22, 2017

LGTM

@siddontang

This comment has been minimized.

Show comment
Hide comment
@siddontang

siddontang Oct 23, 2017

Contributor

PTAL @BusyJay

Contributor

siddontang commented Oct 23, 2017

PTAL @BusyJay

@BusyJay

This comment has been minimized.

Show comment
Hide comment
@BusyJay

BusyJay Oct 23, 2017

Contributor

LGTM, please format your code.

Contributor

BusyJay commented Oct 23, 2017

LGTM, please format your code.

@siddontang

This comment has been minimized.

Show comment
Hide comment
@siddontang

siddontang Oct 24, 2017

Contributor

Any update @odeits?

Contributor

siddontang commented Oct 24, 2017

Any update @odeits?

@odeits

This comment has been minimized.

Show comment
Hide comment
@odeits

odeits Oct 24, 2017

Contributor

I am having trouble compiling. I used the script https://github.com/pingcap/docs/blob/master/scripts/build_rocksdb.sh
to install rocksdb

error: failed to run custom build command for `librocksdb_sys v0.1.0 (https://github.com/pingcap/rust-rocksdb.git#229732cb)`
process didn't exit successfully: `/tikv/target/debug/build/librocksdb_sys-3713e0023fbb987f/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=rocksdb
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_x86_64-unknown-linux-gnu = None
CXX_x86_64_unknown_linux_gnu = None
HOST_CXX = None
CXX = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CXXFLAGS_x86_64-unknown-linux-gnu = None
CXXFLAGS_x86_64_unknown_linux_gnu = None
HOST_CXXFLAGS = None
CXXFLAGS = None
DEBUG = Some("true")
running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-std=c++11" "-Wall" "-Wextra" "-o" "/tikv/target/debug/build/librocksdb_sys-a40eeeb2edcbb581/out/crocksdb/c.o" "-c" "crocksdb/c.cc"
cargo:warning=crocksdb/c.cc:32:37: fatal error: rocksdb/utilities/debug.h: No such file or directory
cargo:warning= #include "rocksdb/utilities/debug.h"
cargo:warning=                                     ^
cargo:warning=compilation terminated.
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-std=c++11" "-Wall" "-Wextra" "-o" "/tikv/target/debug/build/librocksdb_sys-a40eeeb2edcbb581/out/crocksdb/c.o" "-c" "crocksdb/c.cc" with args "c++"
 did not execute successfully (status code exit code: 1).

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.0/src/lib.rs:1645
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:355
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:371
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:549
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:511
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:495
   7: cc::fail
             at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.0/src/lib.rs:1645
   8: cc::Build::compile
             at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.0/src/lib.rs:760
   9: build_script_build::main
             at ./build.rs:23
  10: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  11: std::rt::lang_start
             at /checkout/src/libstd/panicking.rs:433
             at /checkout/src/libstd/panic.rs:361
             at /checkout/src/libstd/rt.rs:59
  12: main
  13: __libc_start_main
  14: <unknown>

Build failed, waiting for other jobs to finish...
error: build failed
make: *** [test] Error 101
Contributor

odeits commented Oct 24, 2017

I am having trouble compiling. I used the script https://github.com/pingcap/docs/blob/master/scripts/build_rocksdb.sh
to install rocksdb

error: failed to run custom build command for `librocksdb_sys v0.1.0 (https://github.com/pingcap/rust-rocksdb.git#229732cb)`
process didn't exit successfully: `/tikv/target/debug/build/librocksdb_sys-3713e0023fbb987f/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=rocksdb
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_x86_64-unknown-linux-gnu = None
CXX_x86_64_unknown_linux_gnu = None
HOST_CXX = None
CXX = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CXXFLAGS_x86_64-unknown-linux-gnu = None
CXXFLAGS_x86_64_unknown_linux_gnu = None
HOST_CXXFLAGS = None
CXXFLAGS = None
DEBUG = Some("true")
running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-std=c++11" "-Wall" "-Wextra" "-o" "/tikv/target/debug/build/librocksdb_sys-a40eeeb2edcbb581/out/crocksdb/c.o" "-c" "crocksdb/c.cc"
cargo:warning=crocksdb/c.cc:32:37: fatal error: rocksdb/utilities/debug.h: No such file or directory
cargo:warning= #include "rocksdb/utilities/debug.h"
cargo:warning=                                     ^
cargo:warning=compilation terminated.
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-std=c++11" "-Wall" "-Wextra" "-o" "/tikv/target/debug/build/librocksdb_sys-a40eeeb2edcbb581/out/crocksdb/c.o" "-c" "crocksdb/c.cc" with args "c++"
 did not execute successfully (status code exit code: 1).

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.0/src/lib.rs:1645
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:355
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:371
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:549
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:511
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:495
   7: cc::fail
             at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.0/src/lib.rs:1645
   8: cc::Build::compile
             at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.0/src/lib.rs:760
   9: build_script_build::main
             at ./build.rs:23
  10: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  11: std::rt::lang_start
             at /checkout/src/libstd/panicking.rs:433
             at /checkout/src/libstd/panic.rs:361
             at /checkout/src/libstd/rt.rs:59
  12: main
  13: __libc_start_main
  14: <unknown>

Build failed, waiting for other jobs to finish...
error: build failed
make: *** [test] Error 101
@BusyJay

This comment has been minimized.

Show comment
Hide comment
@BusyJay

BusyJay Oct 24, 2017

Contributor

I think just make format should fix CI. Please make sure you are using rustfmt 0.2.1-nightly. Or you can adjust your code manually according to the CI output.

Contributor

BusyJay commented Oct 24, 2017

I think just make format should fix CI. Please make sure you are using rustfmt 0.2.1-nightly. Or you can adjust your code manually according to the CI output.

@siddontang

This comment has been minimized.

Show comment
Hide comment
@siddontang

siddontang Oct 24, 2017

Contributor

@odeits

We don't use RocksDB 5.6.1 now, the building script is out of date, I will remove it later.

Contributor

siddontang commented Oct 24, 2017

@odeits

We don't use RocksDB 5.6.1 now, the building script is out of date, I will remove it later.

@siddontang

This comment has been minimized.

Show comment
Hide comment
@siddontang

siddontang Oct 25, 2017

Contributor

Hi @odeits

CI still failed, you can install rustfmt 0.2.1-nightly and run make format.

Contributor

siddontang commented Oct 25, 2017

Hi @odeits

CI still failed, you can install rustfmt 0.2.1-nightly and run make format.

util: inline get_limit_at_size
removes need to use Iterator::count and allows to not call Vec::truncate
if NO_LIMIT
@odeits

This comment has been minimized.

Show comment
Hide comment
@odeits

odeits Oct 25, 2017

Contributor

@siddontang Sorry I have been having trouble getting make format to work. Issues should be resolved now.

Contributor

odeits commented Oct 25, 2017

@siddontang Sorry I have been having trouble getting make format to work. Issues should be resolved now.

odeits and others added some commits Oct 25, 2017

@ngaut ngaut merged commit 3857ee6 into tikv:master Oct 26, 2017

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
jenkins-ci-tikv/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment