a bug fix, reorganization and 0.5.1
Main LMDBAL workfow / Archlinux (push) Failing after 38s Details

This commit is contained in:
Blue 2023-10-21 16:41:41 -03:00
parent 6b348023bb
commit 0079f6e96e
Signed by: blue
GPG Key ID: 9B203B252A63EE38
22 changed files with 37 additions and 31 deletions

View File

@ -1,10 +1,13 @@
# Changelog # Changelog
## LMDBAL 0.5.1 (UNRELEASED) ## LMDBAL 0.5.1 (October 21, 2023)
### Improvements ### Improvements
- RAII transactions - RAII transactions
- reduced overhead for private transaction finctions - reduced overhead for private transaction finctions
### Bug fixes
- bug fix with cache fallthough
## LMDBAL 0.5.0 (October 15, 2023) ## LMDBAL 0.5.0 (October 15, 2023)
### New Features ### New Features
- duplicates support (only for table) - duplicates support (only for table)

View File

@ -74,10 +74,7 @@ if (BUILD_TESTS)
add_subdirectory(test) add_subdirectory(test)
endif () endif ()
target_include_directories(${PROJECT_NAME} PUBLIC target_include_directories(${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOW}>")
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOW}>"
)
target_include_directories(${PROJECT_NAME} PRIVATE ${Qt${QT_VERSION_MAJOR}_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME} PRIVATE ${Qt${QT_VERSION_MAJOR}_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME} PRIVATE ${Qt${QT_VERSION_MAJOR}Core_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME} PRIVATE ${Qt${QT_VERSION_MAJOR}Core_INCLUDE_DIRS})

View File

@ -14,25 +14,13 @@ set(HEADERS
cursor.hpp cursor.hpp
cache.h cache.h
cache.hpp cache.hpp
serializer.h
serializer.hpp
serializer_uint8.hpp
serializer_uint16.hpp
serializer_uint32.hpp
serializer_uint64.hpp
serializer_int8.hpp
serializer_int16.hpp
serializer_int32.hpp
serializer_int64.hpp
serializer_float.hpp
serializer_double.hpp
serializer_stdstring.hpp
serializer_qstring.hpp
serializer_qbytearray.hpp
operators.hpp operators.hpp
transaction.h transaction.h
) )
target_sources(${PROJECT_NAME} PRIVATE ${SOURCES}) target_sources(${PROJECT_NAME} PRIVATE ${SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
add_subdirectory(serializer)
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOW}) install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOW})

View File

@ -841,27 +841,23 @@ void LMDBAL::Cache<K, V>::handleTransactionEntry(const Entry& entry) {
std::pair<K, V>* pair = static_cast<std::pair<K, V>*>(entry.second); std::pair<K, V>* pair = static_cast<std::pair<K, V>*>(entry.second);
handleAddRecord(pair->first, pair->second); handleAddRecord(pair->first, pair->second);
delete pair; delete pair;
} } break;
break;
case Operation::remove: { case Operation::remove: {
K* key = static_cast<K*>(entry.second); K* key = static_cast<K*>(entry.second);
handleRemoveRecord(*key); handleRemoveRecord(*key);
delete key; delete key;
} } break;
break;
case Operation::change: { case Operation::change: {
std::pair<K, V>* pair = static_cast<std::pair<K, V>*>(entry.second); std::pair<K, V>* pair = static_cast<std::pair<K, V>*>(entry.second);
handleChangeRecord(pair->first, pair->second); handleChangeRecord(pair->first, pair->second);
delete pair; delete pair;
} } break;
case Operation::force: { case Operation::force: {
std::tuple<bool, K, V>* tuple = static_cast<std::tuple<bool, K, V>*>(entry.second); std::tuple<bool, K, V>* tuple = static_cast<std::tuple<bool, K, V>*>(entry.second);
const std::tuple<bool, K, V>& t = *tuple; const std::tuple<bool, K, V>& t = *tuple;
handleForceRecord(std::get<1>(t), std::get<2>(t), std::get<0>(t)); handleForceRecord(std::get<1>(t), std::get<2>(t), std::get<0>(t));
delete tuple; delete tuple;
} } break;
break;
case Operation::drop: case Operation::drop:
handleDrop(); handleDrop();
break; break;
@ -873,8 +869,7 @@ void LMDBAL::Cache<K, V>::handleTransactionEntry(const Entry& entry) {
const std::tuple<bool, SizeType, std::map<K, V>>& t = * tuple; const std::tuple<bool, SizeType, std::map<K, V>>& t = * tuple;
handleAddRecords(std::get<2>(t), std::get<0>(t), std::get<1>(t)); handleAddRecords(std::get<2>(t), std::get<0>(t), std::get<1>(t));
delete tuple; delete tuple;
} } break;
break;
} }
} }

View File

@ -0,0 +1,21 @@
set(HEADERS
serializer.h
serializer.hpp
serializer_uint8.hpp
serializer_uint16.hpp
serializer_uint32.hpp
serializer_uint64.hpp
serializer_int8.hpp
serializer_int16.hpp
serializer_int32.hpp
serializer_int64.hpp
serializer_float.hpp
serializer_double.hpp
serializer_stdstring.hpp
serializer_qstring.hpp
serializer_qbytearray.hpp
)
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOW})

View File

@ -12,7 +12,7 @@ add_executable(runUnitTests
duplicates.cpp duplicates.cpp
) )
target_compile_options(runUnitTests PRIVATE -fPIC) target_compile_options(runUnitTests PRIVATE -fPIC -Wall -Wextra -O0)
target_include_directories(runUnitTests PRIVATE ${CMAKE_SOURCE_DIR}/src) target_include_directories(runUnitTests PRIVATE ${CMAKE_SOURCE_DIR}/src)
target_include_directories(runUnitTests PRIVATE ${Qt${QT_VERSION_MAJOR}_INCLUDE_DIRS}) target_include_directories(runUnitTests PRIVATE ${Qt${QT_VERSION_MAJOR}_INCLUDE_DIRS})

View File

@ -181,6 +181,7 @@ TEST_F(StorageTransactionsTest, ConcurentModification) {
int pid = fork(); int pid = fork();
if (pid == 0) { // I am the child if (pid == 0) { // I am the child
usleep(1);
std::cout << "beggining second transaction" << std::endl; std::cout << "beggining second transaction" << std::endl;
LMDBAL::WriteTransaction txn2 = db->beginTransaction(); //<--- this is where the execution should pause LMDBAL::WriteTransaction txn2 = db->beginTransaction(); //<--- this is where the execution should pause
//and wait for the first transaction to get finished //and wait for the first transaction to get finished
@ -233,6 +234,7 @@ TEST_F(StorageTransactionsTest, RAIIResourceFree) {
int pid = fork(); int pid = fork();
if (pid == 0) { // I am the child if (pid == 0) { // I am the child
usleep(1);
std::cout << "beggining child transaction" << std::endl; std::cout << "beggining child transaction" << std::endl;
LMDBAL::WriteTransaction txn2 = db->beginTransaction(); //<--- this is where the execution should pause LMDBAL::WriteTransaction txn2 = db->beginTransaction(); //<--- this is where the execution should pause
//and wait for the first transaction to get finished //and wait for the first transaction to get finished