-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Committed-by: xiaolei.zl from Dev container
- Loading branch information
1 parent
171c8aa
commit 4af9ba1
Showing
7 changed files
with
61 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
add_subdirectory(hqps) | ||
add_subdirectory(rt_mutable_graph) | ||
if (BUILD_KAFKA_WAL_WRITER) | ||
add_subdirectory(wal_writer) | ||
add_subdirectory(wal) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
add_executable(wal_writer_test ${CMAKE_CURRENT_SOURCE_DIR}/wal_writer_test.cc) | ||
target_link_libraries(wal_writer_test PUBLIC ${CppKafka_LIBRARIES} ${LIBGRAPELITE_LIBRARIES} flex_graph_db) | ||
|
||
add_executable(wal_reader_test ${CMAKE_CURRENT_SOURCE_DIR}/wal_reader_test.cc) | ||
target_link_libraries(wal_reader_test PUBLIC ${CppKafka_LIBRARIES} ${LIBGRAPELITE_LIBRARIES} flex_graph_db) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
#include "cppkafka/cppkafka.h" | ||
#include "librdkafka/rdkafka.h" | ||
|
||
#include <iostream> | ||
#include <string> | ||
#include "flex/engines/graph_db/database/wal.h" | ||
#include "grape/grape.h" | ||
|
||
int main(int argc, char** argv) { | ||
if (argc != 5) { | ||
std::cerr << "Usage: " << argv[0] | ||
<< "<kafka brokers> <local/kafka> <topic/directory> <thread_num>" | ||
<< std::endl; | ||
return 1; | ||
} | ||
std::string brokers = argv[1]; | ||
std::string type = argv[2]; | ||
std::string topic_name = argv[3]; | ||
int thread_num = std::stoi(argv[4]); | ||
|
||
double t = -grape::GetCurrentTime(); | ||
|
||
if (type == "local") { | ||
std::cout << "Consuming message from directory " << topic_name | ||
<< " thread num " << thread_num; | ||
std::vector<std::string> wals; | ||
for (const auto& entry : std::filesystem::directory_iterator(topic_name)) { | ||
wals.push_back(entry.path().string()); | ||
} | ||
std::unique_ptr<gs::IWalsParser> parser = | ||
std::make_unique<gs::LocalWalsParser>(wals); | ||
} else { | ||
std::cout << "Consuming message from topic " << topic_name << " thread num " | ||
<< thread_num; | ||
cppkafka::Configuration config = {{"metadata.broker.list", brokers}, | ||
{"group.id", "primary_group"}, | ||
// Disable auto commit | ||
{"enable.auto.commit", false}}; | ||
std::unique_ptr<gs::IWalsParser> parser = | ||
std::make_unique<gs::KafkaWalsParser>(config, topic_name); | ||
} | ||
|
||
t += grape::GetCurrentTime(); | ||
std::cout << "Consuming message took " << t << " seconds" << std::endl; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.