Skip to content

Commit

Permalink
sync with dizzyd:leveldb/portable@04a80d. fix #5.
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 04a80d05e5aadacabab6c5f9699e639d3b05d8bf
Author: Carter Thaxton <carter.thaxton@gmail.com>
Date:   Tue May 24 14:45:27 2011 -0700

    Additional changes to build under Mac OS X 10.5.8, using i686-apple-darwin9-gcc-4.0.1, which ships with XCode for Leopard

    Using macros to handle nested friend access; avoid use of variadic macros for portablity.

commit 9dd5fd4216aee79970191af5336af89d6a770c72
Author: Dave Smith <dizzyd@dizzyd.com>
Date:   Mon May 23 11:02:37 2011 -0600

    Fix incorrect function signature on test class

commit 5688327fe4910534792ecd865ab0c3415c26a89f
Merge: 54d2ad8 a5b4129
Author: Dave Smith <dizzyd@dizzyd.com>
Date:   Mon May 23 10:57:00 2011 -0600

    Merge branch 'master' into portable

commit a5b4129c0a8c01158cde2244a5811f15b9d45ec0
Author: dgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Sat May 21 02:17:43 2011 +0000

    sync with upstream @ 21409451

    Check the NEWS file for details of what changed.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@28 62dab493-f737-651d-591e-8d6aee1b9529

commit 54d2ad8e5462554ba2e69642ab9929979778ccb3
Author: Dave Smith <dizzyd@dizzyd.com>
Date:   Thu May 12 20:50:52 2011 -0600

    Ignore generated files

commit bb3a6be419495e6ad64aee07d3f0d3b12c786413
Author: Dave Smith <dizzyd@dizzyd.com>
Date:   Thu May 12 20:49:47 2011 -0600

    Enable construction of .a file from lib files

commit 93d9060598faed01ce26760cd1190b4347cafa46
Author: Dave Smith <dizzyd@dizzyd.com>
Date:   Tue May 10 23:22:54 2011 -0600

    Use more traditional ext/hash_set include for "std" port

commit 05ca41465bcb37c32a3f981e6618cc859d264dd1
Author: Dave Smith <dizzyd@dizzyd.com>
Date:   Tue May 10 23:22:13 2011 -0600

    Enable use of "std" port and generate necessary defines via platform.env

commit 239489ebcc4b0745dc4b821484ce1367e3f57cf3
Author: Dave Smith <dizzyd@dizzyd.com>
Date:   Tue May 10 23:21:39 2011 -0600

    Add a "std" port which doesn't require C++0x

commit 10be62f4cc87972f4d296881725cd931926d663c
Author: Dave Smith <dizzyd@dizzyd.com>
Date:   Tue May 10 23:20:38 2011 -0600

    Ignore generated build/build_config.h

commit b23364d194e6ef70409b8af25eea32b634f6304b
Author: Dave Smith <dizzyd@dizzyd.com>
Date:   Tue May 10 23:19:01 2011 -0600

    Adding necessary cross-platform files from Chromium

commit 2b55d44e07d10d09da7b0c5ad67f252ac263764f
Author: dgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Tue May 3 03:10:59 2011 +0000

    make windows include /Iport\win in dependent projects

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@27 62dab493-f737-651d-591e-8d6aee1b9529

commit e16e59a48dea1925299763c2707981be02d92d6d
Author: dgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Thu Apr 21 01:54:51 2011 +0000

    pull in hans' mac build fix

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@26 62dab493-f737-651d-591e-8d6aee1b9529

commit e50d37879a15b8bbda1c962038a6f0569f9a980a
Author: dgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Wed Apr 20 22:50:04 2011 +0000

    fix build on at least linux

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@25 62dab493-f737-651d-591e-8d6aee1b9529

commit 1511be6edb54b6ade2bfad94256f76bc191e92ec
Author: dgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Wed Apr 20 22:48:11 2011 +0000

    @20776309
    * env_chromium.cc should not export symbols.
    * Fix MSVC warnings.
    * Removed large value support.
    * Fix broken reference to documentation file

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@24 62dab493-f737-651d-591e-8d6aee1b9529

commit 80d4a4601a20e75a6c4245244e3cac2cf444e012
Author: dgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Tue Apr 19 23:11:15 2011 +0000

    reverting disastrous MOE commit, returning to r21

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@23 62dab493-f737-651d-591e-8d6aee1b9529

commit 8540066c2705c6d2a0595d468a6ab041e4fc72fa
Author: dgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Tue Apr 19 23:01:25 2011 +0000

    Revision created by MOE tool push_codebase.
    MOE_MIGRATION=

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@22 62dab493-f737-651d-591e-8d6aee1b9529

commit e5d186b89ea9c2a8b6ff1d687370e70787eea9d8
Author: dgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Mon Apr 18 23:15:58 2011 +0000

    chmod a-x

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@21 62dab493-f737-651d-591e-8d6aee1b9529

commit 95e21f32367748825123e382172ecbfd492ddb23
Author: dgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Tue Apr 12 19:38:58 2011 +0000

    @20602303.  Default file permission is now 755.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@20 62dab493-f737-651d-591e-8d6aee1b9529

commit 1ca60b12c68a71aac695b15e329b2a76a63cbb0a
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Wed Mar 30 18:49:03 2011 +0000

    Fix last commit

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@19 62dab493-f737-651d-591e-8d6aee1b9529

commit fbd97aa4c5325eace57d24b89845b9581bac9324
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Wed Mar 30 18:35:40 2011 +0000

    Move include files into a leveldb subdir.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@18 62dab493-f737-651d-591e-8d6aee1b9529

commit c2dc30f8224d3f84b917abb6d9657ca2c7c9b2a5
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Tue Mar 29 22:41:11 2011 +0000

    Upstream change.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@17 62dab493-f737-651d-591e-8d6aee1b9529

commit f85ede82f8c27a00c3120f67fbab89b2a89fe987
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Mon Mar 28 20:43:44 2011 +0000

    Upstream changes.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@16 62dab493-f737-651d-591e-8d6aee1b9529

commit 225a272621a5517a1a8dec8956457a121786d7c4
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Fri Mar 25 20:27:43 2011 +0000

    Upstream changes

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@15 62dab493-f737-651d-591e-8d6aee1b9529

commit 07f3bcfb9764be2a339cc02cf0a0d6edb151defb
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Tue Mar 22 23:24:02 2011 +0000

    Pull from upstream.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@14 62dab493-f737-651d-591e-8d6aee1b9529

commit dbbc21b601732980df7a6e877e75a31e9ec1e42b
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Tue Mar 22 19:07:54 2011 +0000

    Make GetTestDirectory threadsafe within Chromium and make it work on Windows.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@13 62dab493-f737-651d-591e-8d6aee1b9529

commit b887f640bae906abfb77fdf418be63350b4c5e1f
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Tue Mar 22 18:32:49 2011 +0000

    More changes from upstream.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@12 62dab493-f737-651d-591e-8d6aee1b9529

commit 8e30874b0cc959ac51e32e2f42387eadc5375b3c
Author: gabor@google.com <gabor@google.com@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Mon Mar 21 23:10:11 2011 +0000

    Removing unneeded build files

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@11 62dab493-f737-651d-591e-8d6aee1b9529

commit 87c528b30a91689078728c5c7c03772c7ce0201b
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Mon Mar 21 21:06:49 2011 +0000

    more upstream changes

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@10 62dab493-f737-651d-591e-8d6aee1b9529

commit 84744ee8e3e568ca5b24eabf31be706d69d80c4d
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Mon Mar 21 19:40:57 2011 +0000

    Sync in bug fixes

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@9 62dab493-f737-651d-591e-8d6aee1b9529

commit 1a1b4538c3a33cadb3096e755416664af209270d
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Mon Mar 21 19:09:55 2011 +0000

    Changes to get Snappy working

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@8 62dab493-f737-651d-591e-8d6aee1b9529

commit c50fe91cf36ed8e0281b9d3d338dfd80508d5a03
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Mon Mar 21 18:13:39 2011 +0000

    Oops, another file that didn't upload correctly.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@7 62dab493-f737-651d-591e-8d6aee1b9529

commit 73ed1a70a58d33b5d2cc158addf3e57ddcfb629a
Author: hans@chromium.org <hans@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Mon Mar 21 17:30:49 2011 +0000

    Set mime-type to text/css on doc/doc.css files.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@6 62dab493-f737-651d-591e-8d6aee1b9529

commit 3702994a92d22d1ed8556dff4fd745a1e8781926
Author: hans@chromium.org <hans@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Mon Mar 21 17:22:12 2011 +0000

    Set mime-type to text/html on .html files.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@5 62dab493-f737-651d-591e-8d6aee1b9529

commit 828515533f6cfe28ab1ae39d1cd8b915052f919f
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Fri Mar 18 23:03:49 2011 +0000

    Fix typo in Makefile.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@4 62dab493-f737-651d-591e-8d6aee1b9529

commit 22cc5453bada623b7e525e71d9c4268dabb16613
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Fri Mar 18 22:47:28 2011 +0000

    Directory paths were off a bit.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@3 62dab493-f737-651d-591e-8d6aee1b9529

commit 179be588c25dccaa963df9c9c104fc6229435483
Author: jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Fri Mar 18 22:37:00 2011 +0000

    Initial checkin.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@2 62dab493-f737-651d-591e-8d6aee1b9529

commit 9eee8b817c471f433eae5bde1fd801777e2c1c08
Author: (no author) <(no author)@62dab493-f737-651d-591e-8d6aee1b9529>
Date:   Wed Mar 2 17:37:17 2011 +0000

    Initial directory structure.

    git-svn-id: http://leveldb.googlecode.com/svn/trunk@1 62dab493-f737-651d-591e-8d6aee1b9529
  • Loading branch information
tilgovi committed May 25, 2011
1 parent 8361893 commit 8d98463
Show file tree
Hide file tree
Showing 40 changed files with 960 additions and 414 deletions.
5 changes: 5 additions & 0 deletions deps/leveldb/.gitignore
@@ -0,0 +1,5 @@
build/build_config.h
*.o
*.a
*_test
db_bench
2 changes: 1 addition & 1 deletion deps/leveldb/Makefile
Expand Up @@ -81,7 +81,7 @@ check: $(TESTS)
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done

clean:
rm -f $(PROGRAMS) */*.o */*.a
rm -f $(PROGRAMS) */*.o */*.a build/build_config.h

db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
$(CC) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@
Expand Down
4 changes: 2 additions & 2 deletions deps/leveldb/base/atomicops_internals_x86_macosx.h
Expand Up @@ -100,7 +100,7 @@ inline Atomic32 Release_Load(volatile const Atomic32 *ptr) {
return *ptr;
}

#ifdef __LP64__
#ifdef ARCH_CPU_64_BITS

// 64-bit implementation on 64-bit platform

Expand Down Expand Up @@ -190,7 +190,7 @@ inline Atomic64 Release_Load(volatile const Atomic64 *ptr) {
return *ptr;
}

#endif // defined(__LP64__)
#endif // defined(ARCH_CPU_64_BITS)

} // namespace base::subtle
} // namespace base
Expand Down
10 changes: 10 additions & 0 deletions deps/leveldb/base/port.h
Expand Up @@ -52,4 +52,14 @@
#define API_CALL
#endif

// Some compilers do not provide access to nested classes of a declared friend class
// Defining PUBLIC_NESTED_FRIEND_ACCESS will cause those declarations to be made public as a workaround
#ifdef PUBLIC_NESTED_FRIEND_ACCESS
#define USED_BY_NESTED_FRIEND(a) public: a; private:
#define USED_BY_NESTED_FRIEND2(a,b) public: a,b; private:
#else
#define USED_BY_NESTED_FRIEND(a) a;
#define USED_BY_NESTED_FRIEND2(a,b) a,b;
#endif

#endif // BASE_PORT_H_
66 changes: 55 additions & 11 deletions deps/leveldb/db/db_bench.cc
Expand Up @@ -24,9 +24,10 @@
// overwrite -- overwrite N values in random key order in async mode
// fillsync -- write N/100 values in random key order in sync mode
// fill100K -- write N/1000 100K values in random order in async mode
// readseq -- read N values sequentially
// readreverse -- read N values in reverse order
// readrandom -- read N values in random order
// readseq -- read N times sequentially
// readreverse -- read N times in reverse order
// readrandom -- read N times in random order
// readhot -- read N times in random order from 1% section of DB
// crc32c -- repeated crc32c of 4K of data
// Meta operations:
// compact -- Compact the entire DB
Expand Down Expand Up @@ -54,6 +55,9 @@ static const char* FLAGS_benchmarks =
// Number of key/values to place in database
static int FLAGS_num = 1000000;

// Number of read operations to do. If negative, do FLAGS_num reads.
static int FLAGS_reads = -1;

// Size of each value
static int FLAGS_value_size = 100;

Expand All @@ -72,6 +76,14 @@ static int FLAGS_write_buffer_size = 0;
// Negative means use default settings.
static int FLAGS_cache_size = -1;

// Maximum number of files to keep open at the same time (use default if == 0)
static int FLAGS_open_files = 0;

// If true, do not destroy the existing database. If you set this
// flag and also specify a benchmark that wants a fresh database, that
// benchmark will fail.
static bool FLAGS_use_existing_db = false;

namespace leveldb {

// Helper for quickly generating random data.
Expand Down Expand Up @@ -126,6 +138,7 @@ class Benchmark {
Cache* cache_;
DB* db_;
int num_;
int reads_;
int heap_counter_;
double start_;
double last_op_finish_;
Expand Down Expand Up @@ -298,6 +311,7 @@ class Benchmark {
: cache_(FLAGS_cache_size >= 0 ? NewLRUCache(FLAGS_cache_size) : NULL),
db_(NULL),
num_(FLAGS_num),
reads_(FLAGS_reads < 0 ? FLAGS_num : FLAGS_reads),
heap_counter_(0),
bytes_(0),
rand_(301) {
Expand All @@ -308,7 +322,9 @@ class Benchmark {
Env::Default()->DeleteFile("/tmp/dbbench/" + files[i]);
}
}
DestroyDB("/tmp/dbbench", Options());
if (!FLAGS_use_existing_db) {
DestroyDB("/tmp/dbbench", Options());
}
}

~Benchmark() {
Expand Down Expand Up @@ -355,11 +371,13 @@ class Benchmark {
ReadReverse();
} else if (name == Slice("readrandom")) {
ReadRandom();
} else if (name == Slice("readhot")) {
ReadHot();
} else if (name == Slice("readrandomsmall")) {
int n = num_;
num_ /= 1000;
int n = reads_;
reads_ /= 1000;
ReadRandom();
num_ = n;
reads_ = n;
} else if (name == Slice("compact")) {
Compact();
} else if (name == Slice("crc32c")) {
Expand Down Expand Up @@ -449,7 +467,7 @@ class Benchmark {
void Open() {
assert(db_ == NULL);
Options options;
options.create_if_missing = true;
options.create_if_missing = !FLAGS_use_existing_db;
options.block_cache = cache_;
options.write_buffer_size = FLAGS_write_buffer_size;
Status s = DB::Open(options, "/tmp/dbbench", &db_);
Expand All @@ -462,6 +480,10 @@ class Benchmark {
void Write(const WriteOptions& options, Order order, DBState state,
int num_entries, int value_size, int entries_per_batch) {
if (state == FRESH) {
if (FLAGS_use_existing_db) {
message_ = "skipping (--use_existing_db is true)";
return;
}
delete db_;
db_ = NULL;
DestroyDB("/tmp/dbbench", Options());
Expand Down Expand Up @@ -499,7 +521,7 @@ class Benchmark {
void ReadSequential() {
Iterator* iter = db_->NewIterator(ReadOptions());
int i = 0;
for (iter->SeekToFirst(); i < num_ && iter->Valid(); iter->Next()) {
for (iter->SeekToFirst(); i < reads_ && iter->Valid(); iter->Next()) {
bytes_ += iter->key().size() + iter->value().size();
FinishedSingleOp();
++i;
Expand All @@ -510,7 +532,7 @@ class Benchmark {
void ReadReverse() {
Iterator* iter = db_->NewIterator(ReadOptions());
int i = 0;
for (iter->SeekToLast(); i < num_ && iter->Valid(); iter->Prev()) {
for (iter->SeekToLast(); i < reads_ && iter->Valid(); iter->Prev()) {
bytes_ += iter->key().size() + iter->value().size();
FinishedSingleOp();
++i;
Expand All @@ -521,7 +543,7 @@ class Benchmark {
void ReadRandom() {
ReadOptions options;
std::string value;
for (int i = 0; i < num_; i++) {
for (int i = 0; i < reads_; i++) {
char key[100];
const int k = rand_.Next() % FLAGS_num;
snprintf(key, sizeof(key), "%016d", k);
Expand All @@ -530,6 +552,19 @@ class Benchmark {
}
}

void ReadHot() {
ReadOptions options;
std::string value;
const int range = (FLAGS_num + 99) / 100;
for (int i = 0; i < reads_; i++) {
char key[100];
const int k = rand_.Next() % range;
snprintf(key, sizeof(key), "%016d", k);
db_->Get(options, key, &value);
FinishedSingleOp();
}
}

void Compact() {
DBImpl* dbi = reinterpret_cast<DBImpl*>(db_);
dbi->TEST_CompactMemTable();
Expand Down Expand Up @@ -582,6 +617,8 @@ class Benchmark {

int main(int argc, char** argv) {
FLAGS_write_buffer_size = leveldb::Options().write_buffer_size;
FLAGS_open_files = leveldb::Options().max_open_files;

for (int i = 1; i < argc; i++) {
double d;
int n;
Expand All @@ -593,14 +630,21 @@ int main(int argc, char** argv) {
} else if (sscanf(argv[i], "--histogram=%d%c", &n, &junk) == 1 &&
(n == 0 || n == 1)) {
FLAGS_histogram = n;
} else if (sscanf(argv[i], "--use_existing_db=%d%c", &n, &junk) == 1 &&
(n == 0 || n == 1)) {
FLAGS_use_existing_db = n;
} else if (sscanf(argv[i], "--num=%d%c", &n, &junk) == 1) {
FLAGS_num = n;
} else if (sscanf(argv[i], "--reads=%d%c", &n, &junk) == 1) {
FLAGS_reads = n;
} else if (sscanf(argv[i], "--value_size=%d%c", &n, &junk) == 1) {
FLAGS_value_size = n;
} else if (sscanf(argv[i], "--write_buffer_size=%d%c", &n, &junk) == 1) {
FLAGS_write_buffer_size = n;
} else if (sscanf(argv[i], "--cache_size=%d%c", &n, &junk) == 1) {
FLAGS_cache_size = n;
} else if (sscanf(argv[i], "--open_files=%d%c", &n, &junk) == 1) {
FLAGS_open_files = n;
} else {
fprintf(stderr, "Invalid flag '%s'\n", argv[i]);
exit(1);
Expand Down

0 comments on commit 8d98463

Please sign in to comment.