{"action":"created","issue":{"url":"https://api.github.com/repos/BitFunnel/BitFunnel/issues/256","repository_url":"https://api.github.com/repos/BitFunnel/BitFunnel","labels_url":"https://api.github.com/repos/BitFunnel/BitFunnel/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/BitFunnel/BitFunnel/issues/256/comments","events_url":"https://api.github.com/repos/BitFunnel/BitFunnel/issues/256/events","html_url":"https://github.com/BitFunnel/BitFunnel/issues/256","id":184595173,"number":256,"title":"system rows double counted","user":{"login":"danluu","id":157136,"avatar_url":"https://avatars.githubusercontent.com/u/157136?v=3","gravatar_id":"","url":"https://api.github.com/users/danluu","html_url":"https://github.com/danluu","followers_url":"https://api.github.com/users/danluu/followers","following_url":"https://api.github.com/users/danluu/following{/other_user}","gists_url":"https://api.github.com/users/danluu/gists{/gist_id}","starred_url":"https://api.github.com/users/danluu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danluu/subscriptions","organizations_url":"https://api.github.com/users/danluu/orgs","repos_url":"https://api.github.com/users/danluu/repos","events_url":"https://api.github.com/users/danluu/events{/privacy}","received_events_url":"https://api.github.com/users/danluu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-22T00:14:31Z","updated_at":"2016-10-22T03:01:35Z","closed_at":null,"body":"In TermTable.cpp\r\n\r\n~~~\r\n    void TermTable::SetFactCount(size_t factCount)\r\n    {\r\n        EnsureSealed(false);\r\n\r\n        // Fact rows include the SystemTerm rows and one row for each user\r\n        // defined fact.\r\n        m_factRowCount = factCount + SystemTerm::Count;\r\n    }\r\n~~~\r\n\r\n~~~\r\n    size_t TermTable::GetTotalRowCount(Rank rank) const\r\n    {\r\n        // System term rows and fact rows are included in Rank 0, but not other\r\n        // ranks.\r\n        return m_sharedRowCounts[rank] +\r\n            ((rank == 0) ? (SystemTerm::Count + m_factRowCount) : 0);\r\n    }\r\n~~~\r\n\r\nSystemTerm::Count is added to m_factRowCount already, but then we add it again to get TotalRowCount."},"comment":{"url":"https://api.github.com/repos/BitFunnel/BitFunnel/issues/comments/255503532","html_url":"https://github.com/BitFunnel/BitFunnel/issues/256#issuecomment-255503532","issue_url":"https://api.github.com/repos/BitFunnel/BitFunnel/issues/256","id":255503532,"user":{"login":"danluu","id":157136,"avatar_url":"https://avatars.githubusercontent.com/u/157136?v=3","gravatar_id":"","url":"https://api.github.com/users/danluu","html_url":"https://github.com/danluu","followers_url":"https://api.github.com/users/danluu/followers","following_url":"https://api.github.com/users/danluu/following{/other_user}","gists_url":"https://api.github.com/users/danluu/gists{/gist_id}","starred_url":"https://api.github.com/users/danluu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danluu/subscriptions","organizations_url":"https://api.github.com/users/danluu/orgs","repos_url":"https://api.github.com/users/danluu/repos","events_url":"https://api.github.com/users/danluu/events{/privacy}","received_events_url":"https://api.github.com/users/danluu/received_events","type":"User","site_admin":false},"created_at":"2016-10-22T03:01:35Z","updated_at":"2016-10-22T03:01:35Z","body":"On running this in valgrind, it immediately flags the bad write:\r\n\r\n~~~\r\n[----------] 1 test from Shard\r\n[ RUN      ] Shard.AddRemoveSlices\r\n==21774== Invalid write of size 8\r\n==21774==    at 0x4C3453F: memset (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)\r\n==21774==    by 0x5A2FE5: BitFunnel::RowTableDescriptor::Initialize(void*, BitFunnel::ITermTable const&) const (RowTableDescriptor.cpp:108)\r\n==21774==    by 0x5AE77A: BitFunnel::Slice::Slice(BitFunnel::Shard&) (Slice.cpp:48)\r\n==21774==    by 0x5A3FC2: BitFunnel::Shard::CreateNewActiveSlice() (Shard.cpp:132)\r\n==21774==    by 0x5A3EB6: BitFunnel::Shard::AllocateDocument(unsigned long) (Shard.cpp:114)\r\n==21774==    by 0x579EDE: BitFunnel::ShardTest::Shard_AddRemoveSlices_Test::TestBody() (ShardTest.cpp:72)\r\n==21774==    by 0x6174F9: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing:\r\n:Test::*)(), char const*) (in /home/leah/dev/BitFunnel/build-ninja/src/Index/test/IndexTest)\r\n==21774==    by 0x601A76: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Te\r\nst::*)(), char const*) (gtest.cc:2438)\r\n==21774==    by 0x5E623A: testing::Test::Run() (gtest.cc:2474)\r\n==21774==    by 0x5E71A0: testing::TestInfo::Run() (gtest.cc:2656)\r\n==21774==    by 0x5E7986: testing::TestCase::Run() (gtest.cc:2774)\r\n==21774==    by 0x5EFBF3: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:4649)\r\n==21774==  Address 0x5df2668 is 8 bytes after a block of size 576 alloc'd\r\n==21774==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)\r\n==21774==    by 0x588011: BitFunnel::TrackingSliceBufferAllocator::Allocate(unsigned long) (TrackingSliceBufferAllocator.cpp:54)\r\n==21774==    by 0x5A4193: BitFunnel::Shard::AllocateSliceBuffer() (Shard.cpp:126)\r\n==21774==    by 0x5AE681: BitFunnel::Slice::Slice(BitFunnel::Shard&) (Slice.cpp:36)\r\n==21774==    by 0x5A3FC2: BitFunnel::Shard::CreateNewActiveSlice() (Shard.cpp:132)\r\n==21774==    by 0x5A3EB6: BitFunnel::Shard::AllocateDocument(unsigned long) (Shard.cpp:114)\r\n==21774==    by 0x579EDE: BitFunnel::ShardTest::Shard_AddRemoveSlices_Test::TestBody() (ShardTest.cpp:72)\r\n==21774==    by 0x6174F9: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing:\r\n:Test::*)(), char const*) (in /home/leah/dev/BitFunnel/build-ninja/src/Index/test/IndexTest)\r\n==21774==    by 0x601A76: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Te\r\nst::*)(), char const*) (gtest.cc:2438)\r\n~~~"}}
{"actor":{"display_login":"danluu"}}