diff options
| author | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2024-12-06 13:56:55 -0500 |
|---|---|---|
| committer | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2024-12-06 13:56:55 -0500 |
| commit | e2b81a2d311470d503edae93e68e82791f6bb17c (patch) | |
| tree | eec2a5eba14be2986af39d3fdd5d651e61f8f4b3 | |
| parent | 9fe305c7d28e993e55c55427f377ae7e3251ea4f (diff) | |
| download | dynamic-extension-e2b81a2d311470d503edae93e68e82791f6bb17c.tar.gz | |
Warning fixes
| -rw-r--r-- | benchmarks/include/file_util.h | 24 | ||||
| -rw-r--r-- | benchmarks/vldb/fst_bench.cpp | 5 | ||||
| -rw-r--r-- | benchmarks/vldb/fst_bsm_bench.cpp | 6 | ||||
| m--------- | external/m-tree | 0 | ||||
| -rw-r--r-- | include/framework/DynamicExtension.h | 2 | ||||
| -rw-r--r-- | include/framework/structure/ExtensionStructure.h | 9 | ||||
| -rw-r--r-- | include/util/types.h | 2 | ||||
| -rw-r--r-- | tests/include/concurrent_extension.h | 4 | ||||
| -rw-r--r-- | tests/include/dynamic_extension.h | 4 | ||||
| -rw-r--r-- | tests/vptree_tests.cpp | 1 |
10 files changed, 34 insertions, 23 deletions
diff --git a/benchmarks/include/file_util.h b/benchmarks/include/file_util.h index 1a40a78..01aaa1a 100644 --- a/benchmarks/include/file_util.h +++ b/benchmarks/include/file_util.h @@ -40,13 +40,13 @@ static std::vector<QP> read_lookup_queries(std::string fname, double selectivity } template <typename QP> -static std::vector<QP> generate_string_lookup_queries(std::vector<std::unique_ptr<char[]>> &strings, size_t cnt, gsl_rng *rng) { +static std::vector<QP> generate_string_lookup_queries(std::vector<char *> &strings, size_t cnt, gsl_rng *rng) { std::vector<QP> queries; for (size_t i=0; i<cnt; i++) { auto idx = gsl_rng_uniform_int(rng, strings.size()); QP q; - q.search_key = strings[idx].get(); + q.search_key = strings[idx]; queries.push_back(q); } @@ -95,8 +95,8 @@ static std::vector<QP> read_binary_knn_queries(std::string fname, size_t k, size } - int32_t dim; - int32_t cnt; + uint32_t dim; + uint32_t cnt; file.read((char*) &(cnt), sizeof(cnt)); file.read((char*) &(dim), sizeof(dim)); @@ -245,8 +245,8 @@ static std::vector<R> read_binary_vector_file(std::string &fname, size_t n) { std::vector<R> records; records.reserve(n); - int32_t dim; - int32_t cnt; + uint32_t dim; + uint32_t cnt; file.read((char*) &(cnt), sizeof(cnt)); file.read((char*) &(dim), sizeof(dim)); @@ -269,7 +269,7 @@ static std::vector<R> read_binary_vector_file(std::string &fname, size_t n) { return records; } -[[maybe_unused]] static std::vector<std::unique_ptr<char[]>>read_string_file(std::string fname, size_t n=10000000) { +[[maybe_unused]] static std::vector<char *> read_string_file(std::string fname, size_t n=10000000) { std::fstream file; file.open(fname, std::ios::in); @@ -279,16 +279,22 @@ static std::vector<R> read_binary_vector_file(std::string &fname, size_t n) { exit(EXIT_FAILURE); } - std::vector<std::unique_ptr<char[]>> strings; + std::vector<char *> strings; strings.reserve(n); size_t i=0; std::string line; while (i < n && std::getline(file, line, '\n')) { - strings.emplace_back(std::unique_ptr<char[]>(strdup(line.c_str()))); + strings.emplace_back(strdup(line.c_str())); i++; psudb::progress_update((double) i / (double) n, "Reading file:"); } return strings; } + +[[maybe_unused]] static void destroy_string_file_data(std::vector<char *> &data) { + for (size_t i=0; i<data.size(); i++) { + delete data[i]; + } +} diff --git a/benchmarks/vldb/fst_bench.cpp b/benchmarks/vldb/fst_bench.cpp index e4b5bf6..fb5ed59 100644 --- a/benchmarks/vldb/fst_bench.cpp +++ b/benchmarks/vldb/fst_bench.cpp @@ -5,8 +5,6 @@ #define ENABLE_TIMER #define TS_TEST -#include <thread> - #include "framework/DynamicExtension.h" #include "shard/FSTrie.h" #include "query/pointlookup.h" @@ -47,7 +45,7 @@ int main(int argc, char **argv) { std::vector<Rec> data; for (size_t i=0; i<strings.size(); i++) { - data.push_back({strings[i].get(), i, strlen(strings[i].get())}); + data.push_back({strings[i], i, strlen(strings[i])}); } std::vector<size_t> to_delete(n * delete_proportion); @@ -95,6 +93,7 @@ int main(int argc, char **argv) { gsl_rng_free(rng); delete extension; + destroy_string_file_data(strings); fflush(stderr); } diff --git a/benchmarks/vldb/fst_bsm_bench.cpp b/benchmarks/vldb/fst_bsm_bench.cpp index b0be115..c1e6d17 100644 --- a/benchmarks/vldb/fst_bsm_bench.cpp +++ b/benchmarks/vldb/fst_bsm_bench.cpp @@ -5,8 +5,6 @@ #define ENABLE_TIMER #define TS_TEST -#include <thread> - #include "framework/DynamicExtension.h" #include "shard/FSTrie.h" #include "query/pointlookup.h" @@ -47,7 +45,7 @@ int main(int argc, char **argv) { std::vector<Rec> data; for (size_t i=0; i<strings.size(); i++) { - data.push_back({strings[i].get(), i, strlen(strings[i].get())}); + data.push_back({strings[i], i, strlen(strings[i])}); } std::vector<size_t> to_delete(n * delete_proportion); @@ -95,6 +93,8 @@ int main(int argc, char **argv) { gsl_rng_free(rng); delete extension; + + destroy_string_file_data(strings); fflush(stderr); } diff --git a/external/m-tree b/external/m-tree -Subproject 68fc861ecb92219e126d669b0e04fbcf85594c7 +Subproject e64837a0a30b4f3bef8bd5fd56cf81233b49704 diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h index 16cbb0e..5a95679 100644 --- a/include/framework/DynamicExtension.h +++ b/include/framework/DynamicExtension.h @@ -565,7 +565,7 @@ private: vers->reconstruction(args->merges[0]); } } else { - for (ssize_t i = 0; i < args->merges.size(); i++) { + for (size_t i = 0; i < args->merges.size(); i++) { vers->reconstruction(args->merges[i].target, args->merges[i].sources[0]); } diff --git a/include/framework/structure/ExtensionStructure.h b/include/framework/structure/ExtensionStructure.h index 2728246..c81ad05 100644 --- a/include/framework/structure/ExtensionStructure.h +++ b/include/framework/structure/ExtensionStructure.h @@ -19,6 +19,7 @@ #include "framework/util/Configuration.h" #include "psu-util/timer.h" +#include "util/types.h" namespace de { @@ -427,7 +428,7 @@ public: auto new_level = InternalLevel<ShardType, QueryType>::reconstruction( levels, task.target); - if (task.target >= m_levels.size()) { + if (task.target >= (level_index) m_levels.size()) { m_current_state.push_back({new_level->get_record_count(), calc_level_record_capacity(task.target), 1, 1}); @@ -461,7 +462,7 @@ public: level_index incoming_level) { size_t shard_capacity = (L == LayoutPolicy::LEVELING) ? 1 : m_scale_factor; - if (base_level >= m_levels.size()) { + if (base_level >= (level_index) m_levels.size()) { m_levels.emplace_back( std::shared_ptr<InternalLevel<ShardType, QueryType>>( new InternalLevel<ShardType, QueryType>(base_level, @@ -583,7 +584,7 @@ private: return -1; size_t incoming_rec_cnt = state[idx].reccnt; - for (level_index i = idx + 1; i < state.size(); i++) { + for (level_index i = idx + 1; i < (level_index) state.size(); i++) { if (can_reconstruct_with(i, incoming_rec_cnt, state)) { return i; } @@ -661,7 +662,7 @@ private: */ inline bool can_reconstruct_with(level_index idx, size_t incoming_rec_cnt, state_vector &state) { - if (idx >= state.size()) { + if (idx >= (level_index) state.size()) { return false; } diff --git a/include/util/types.h b/include/util/types.h index b8a1343..c225857 100644 --- a/include/util/types.h +++ b/include/util/types.h @@ -80,7 +80,7 @@ typedef ssize_t level_index; typedef struct ReconstructionTask { std::vector<level_index> sources; level_index target; - size_t reccnt; + size_t reccnt = 0; void add_source(level_index source, size_t cnt) { sources.push_back(source); diff --git a/tests/include/concurrent_extension.h b/tests/include/concurrent_extension.h index 02bd694..d99cd23 100644 --- a/tests/include/concurrent_extension.h +++ b/tests/include/concurrent_extension.h @@ -217,7 +217,9 @@ START_TEST(t_tombstone_merging_01) std::sample(to_delete.begin(), to_delete.end(), std::back_inserter(del_vec), 3, std::mt19937{std::random_device{}()}); for (size_t i=0; i<del_vec.size(); i++) { - R dr = {del_vec[i].first, del_vec[i].second}; + R dr = {}; + dr.key = del_vec[i].first; + dr.value = del_vec[i].second; while (!test_de->erase(dr)) { _mm_pause(); } diff --git a/tests/include/dynamic_extension.h b/tests/include/dynamic_extension.h index 90c6906..326bb72 100644 --- a/tests/include/dynamic_extension.h +++ b/tests/include/dynamic_extension.h @@ -201,7 +201,9 @@ START_TEST(t_tombstone_merging_01) std::sample(to_delete.begin(), to_delete.end(), std::back_inserter(del_vec), 3, std::mt19937{std::random_device{}()}); for (size_t i=0; i<del_vec.size(); i++) { - R dr = {del_vec[i].first, del_vec[i].second}; + R dr = {}; + dr.key = del_vec[i].first; + dr.value = del_vec[i].second; test_de->erase(dr); to_delete.erase(del_vec[i]); deleted.insert(del_vec[i]); diff --git a/tests/vptree_tests.cpp b/tests/vptree_tests.cpp index faa704f..7e9e79e 100644 --- a/tests/vptree_tests.cpp +++ b/tests/vptree_tests.cpp @@ -10,6 +10,7 @@ */ +#include <algorithm> #include "include/testing.h" #include "shard/VPTree.h" #include "query/knn.h" |