-
Notifications
You must be signed in to change notification settings - Fork 165
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
Bug fixes, documentation (source level), and general cleanup #135
Conversation
Add free space tracking to a database file that does not have it when calling Group::commit(). In Group::verify(), do not asssert that free space versioning is present just because it is opened in shared mode.
…er Group::commit()
…() in the non-transactional case. Eliminate the risk of extending byte size of Group::m_free_positions in GroupWriter::commit() after using its exact size in a calculation. Eliminate unnecessary free space fragmentation by stopping GroupWriter::reserve_free_space() from adjusting the size of the identified chunk when it is different from the requested size. GroupWriter::get_fre_space() and Group::Writer::reserve_free_space() now share searching code, and therefore, both skip the first part of the list when searching for a chunk that is larger than 1024 bytes. Fixed an undetected free-space leak when deleting free-space version tracking in GroupWriter::commit(). More documentation. Many other improvements.
…f the list of free space hunks, look in the first half
…SharedGRoup::end_read(). Avoid function local statics as they are not necessarily thread-safe.
On Windows: test\testshared.cpp:904: error: Failure in Shared_MixedWithNonShared: Unhandled exception: CreateFile() failed: The system cannot find the path specified. |
|
||
TEST(Shared_MixedWithNonShared) | ||
{ | ||
File::try_remove("/tmp/x.tightdb"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/tmp can not be recommended as directory on Windows.
In general I think we should have a define/const for the path, and then use it in general. With this the files will be placed in two locations. For now it would be better to just skip "/tmp/"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Fixed!
It was never my intention to use a path here. Slipped through from earlier experimentation.
Would it not be possible to configure Visual Studio such that it also runs the test suite with "/test/" as the current working directory?
That's a lot.... I recommend Lasse/Alexander review the Array and Group changes. I have not done that in detail. |
Note that my tests on Windows are conducted under Virtual Box with zero SSE support enabled. |
Please note that the bulk of the changes revolve around the robustness of Group::commit(), and to a lesser extent, around the robustness of SharedGroup::commit(). In both cases, the robustness is already tested as much as it can be within the context of trivial unit testing. Here is how:
|
…nting down memory and thread synchronization bugs
return const_cast<Group*>(this)->get_table_ptr<T>(name); | ||
TIGHTDB_STATIC_ASSERT(IsBasicTable<T>::value, "Invalid table type"); | ||
const Table* table = get_table_ptr(name); // Throws | ||
TIGHTDB_ASSERT(table || T::matches_dynamic_spec(&table->get_spec())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be an && here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find. Actually it should have been "!table || ...". this is fixed in my upcoming commit.
Does not build on Xcode. File 'thread.cpp' is only member of 'libtightdb ios' and not 'libtightdb'. So you get errors from the linker for missing symbols. Fixing that makes it build, but when trying to run the unit tests, it crashes on startup. Call stack: #0 0x000000010022d475 in tightdb::Array::create_empty_array(tightdb::Array::Type, tightdb::Array::WidthType, tightdb::Allocator&) at /Users/alexanderstigsen/Documents/Dev/tightdb/src/tightdb/array.cpp:1206 Seems like a linking problem. |
…e + some documentation
…was recently eliminated due to problem reports from Valgrind. The problem with not using function local statics, is that the order ot initialization of regular globals is undefined by the C++ standard.
Problem fixed: https://github.com/kspangsege/tightdb/commit/62b712fa7353511fb8da0d9ee62393bed6010454 On Tue, Aug 27, 2013 at 11:42 PM, astigsen notifications@github.com wrote:
|
+1 BTW: Awesome that you included test results in the pull request. That should be done more often. It would be nice in the future if big changes like that could be broken up in smaller pull requests. Then they could be reviewed faster and the whole process speeded up a bit. |
Bug fixes, documentation (source level), and general cleanup
Finn, I a agree that the idiom would work, but I am reluctant towards introducing Pthread stuff outside the context of shared groups. It would be nice if one could take everything but SharedGroup and compile it on a platform without any threads support. I think we should look a little further into the thread-safety of function local statics. |
Reduce number of threads used on Windows and Android
\cc @bmunkholm @astigsen