{"action":"created","issue":{"url":"https://api.github.com/repos/chrsmith/leveldb/issues/97","labels_url":"https://api.github.com/repos/chrsmith/leveldb/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/chrsmith/leveldb/issues/97/comments","events_url":"https://api.github.com/repos/chrsmith/leveldb/issues/97/events","html_url":"https://github.com/chrsmith/leveldb/issues/97","id":58996860,"number":97,"title":"empty key assert failure during compaction","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chrsmith/leveldb/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/leveldb/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/leveldb/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-26T00:37:26Z","updated_at":"2015-02-26T00:37:28Z","closed_at":null,"body":"```\nOn a clean build of: dd0d562b4d4fbd07db6a44f9e221f8d368fee8e4\n\n$ cat check.cc\n#include <set>\n#include <map>\n#include <string>\n#include \"leveldb/db.h\"\n#include \"leveldb/write_batch.h\"\n#include \"leveldb/slice.h\"\n#include <unistd.h>\n\nint main(int args, char **argv) {\n  leveldb::Options options;\n  leveldb::DB *_db;\n  leveldb::Status status = leveldb::DB::Open(options, argv[1], &_db);\n  while (1) {\n    sleep(1);\n  }\n}\n\n$ tar -xvf omap.tgz\n$ g++ -g2 -pthread -Ileveldb/include check.cc leveldb/libleveldb.a\n$ ./a.out omap\na.out: ./db/dbformat.h:96: leveldb::Slice leveldb::ExtractUserKey(const \nleveldb::Slice&): Assertion `internal_key.size() >= 8' failed.\nAborted\n\n$ gdb --args ./a.out omap\nGNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04\nCopyright (C) 2012 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\nThis GDB was configured as \"x86_64-linux-gnu\".\nFor bug reporting instructions, please see:\n<http://bugs.launchpad.net/gdb-linaro/>...\nReading symbols from /home/samuelj/a.out...done.\n(gdb) run\nStarting program: /home/samuelj/a.out omap\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library \"/lib/x86_64-linux-gnu/libthread_db.so.1\".\n[New Thread 0x7ffff6fef700 (LWP 1769)]\na.out: ./db/dbformat.h:96: leveldb::Slice leveldb::ExtractUserKey(const \nleveldb::Slice&): Assertion `internal_key.size() >= 8' failed.\n\nProgram received signal SIGABRT, Aborted.\n[Switching to Thread 0x7ffff6fef700 (LWP 1769)]\n0x00007ffff7320445 in raise () from /lib/x86_64-linux-gnu/libc.so.6\n(gdb) bt\n#0  0x00007ffff7320445 in raise () from /lib/x86_64-linux-gnu/libc.so.6\n#1  0x00007ffff7323bab in abort () from /lib/x86_64-linux-gnu/libc.so.6\n#2  0x00007ffff731910e in ?? () from /lib/x86_64-linux-gnu/libc.so.6\n#3  0x00007ffff73191b2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6\n#4  0x000000000040a5be in leveldb::ExtractUserKey (internal_key=...) at \n./db/dbformat.h:96\n#5  0x000000000042f1a3 in leveldb::InternalKeyComparator::Compare \n(this=0x658600, akey=..., bkey=...) at db/dbformat.cc:55\n#6  0x00000000004260f2 in leveldb::(anonymous \nnamespace)::MergingIterator::FindSmallest (this=0x7ffff0001ad0) at \ntable/merger.cc:162\n#7  0x0000000000425d18 in leveldb::(anonymous namespace)::MergingIterator::Next \n(this=0x7ffff0001ad0) at table/merger.cc:82\n#8  0x0000000000407479 in leveldb::DBImpl::DoCompactionWork (this=0x655390, \ncompact=0x7ffff0000bb0) at db/db_impl.cc:951\n#9  0x0000000000405f66 in leveldb::DBImpl::BackgroundCompaction (this=0x655390) \nat db/db_impl.cc:681\n#10 0x00000000004058b4 in leveldb::DBImpl::BackgroundCall (this=0x655390) at \ndb/db_impl.cc:611\n#11 0x0000000000405830 in leveldb::DBImpl::BGWork (db=0x655390) at \ndb/db_impl.cc:604\n#12 0x00000000004358f2 in leveldb::(anonymous namespace)::PosixEnv::BGThread \n(this=0x655030) at util/env_posix.cc:572\n#13 0x0000000000435603 in leveldb::(anonymous \nnamespace)::PosixEnv::BGThreadWrapper (arg=0x655030) at util/env_posix.cc:512\n#14 0x00007ffff76aee9a in start_thread () from \n/lib/x86_64-linux-gnu/libpthread.so.0\n#15 0x00007ffff73dc4bd in clone () from /lib/x86_64-linux-gnu/libc.so.6\n#16 0x0000000000000000 in ?? ()\n\n```\n\n-----\nOriginal issue reported on code.google.com by `rexludo...@gmail.com` on 14 Jun 2012 at 9:51\n\nAttachments:\n* [omap.tgz](https://storage.googleapis.com/google-code-attachments/leveldb/issue-97/comment-0/omap.tgz)\n"},"comment":{"url":"https://api.github.com/repos/chrsmith/leveldb/issues/comments/76098229","html_url":"https://github.com/chrsmith/leveldb/issues/97#issuecomment-76098229","issue_url":"https://api.github.com/repos/chrsmith/leveldb/issues/97","id":76098229,"user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"created_at":"2015-02-26T00:37:28Z","updated_at":"2015-02-26T00:37:28Z","body":"```\nJust as one more data point, we hit this problem too on an ext3 file system \nthat had a disk with a few bad sectors (which has since been replaced). Using \nSanjay's Table/TableBuilder pseudocode allows working around the corrupted \n*.sst with minimal data loss (which is great). Still, a fix in leveldb proper \nwould be great appreciated. :)\n```\n\n-----\nOriginal comment by `ahochh...@samegoal.com` on 19 Feb 2013 at 6:46"}}