Skip to content

Commit

Permalink
Fix the issue when changing the meta DB
Browse files Browse the repository at this point in the history
  • Loading branch information
thamindumk committed Feb 24, 2025
1 parent 7f9f119 commit da04cef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions ddl/metadb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ INSERT INTO graph_status (idgraph_status, description) VALUES (2, 'OPERATIONAL')
INSERT INTO graph_status (idgraph_status, description) VALUES (3, 'DELETED');
INSERT INTO graph_status (idgraph_status, description) VALUES (4, 'NONOPERATIONAL');

INSERT INTO partitioning_algorithm (idalgorithm, algorithm_name) VALUES (1, 'HASH');
INSERT INTO partitioning_algorithm (idalgorithm, algorithm_name) VALUES (2, 'FENNEL');
INSERT INTO partitioning_algorithm (idalgorithm, algorithm_name) VALUES (3, 'LDG');
INSERT INTO partitioning_algorithm (idalgorithm, algorithm_name) VALUES (4, 'METIS');
INSERT INTO partitioning_algorithm (id_algorithm, algorithm_name) VALUES (1, 'HASH');
INSERT INTO partitioning_algorithm (id_algorithm, algorithm_name) VALUES (2, 'FENNEL');
INSERT INTO partitioning_algorithm (id_algorithm, algorithm_name) VALUES (3, 'LDG');
INSERT INTO partitioning_algorithm (id_algorithm, algorithm_name) VALUES (4, 'METIS');
14 changes: 7 additions & 7 deletions src/frontend/JasmineGraphFrontEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,10 +1078,10 @@ static void add_stream_kafka_command(int connFd, std::string &kafka_server_IP, c
return;

Check warning on line 1078 in src/frontend/JasmineGraphFrontEnd.cpp

View check run for this annotation

Codecov / codecov/patch

src/frontend/JasmineGraphFrontEnd.cpp#L1077-L1078

Added lines #L1077 - L1078 were not covered by tests
}
// Get user response.
string partitionAlgo = Utils::getFrontendInput(connFd);
string partitionAlgoInput = Utils::getFrontendInput(connFd);

if (partitionAlgo == "1" || partitionAlgo == "2" || partitionAlgo == "3") {
string partition_success_msg = "Set partition technique: " + partitionAlgo;
if (partitionAlgoInput == "1" || partitionAlgoInput == "2" || partitionAlgoInput == "3") {
string partition_success_msg = "Set partition technique: " + partitionAlgoInput;
result_wr = write(connFd, partition_success_msg.c_str(), partition_success_msg.length());
if (result_wr < 0) {
frontend_logger.error("Error writing to socket");
Expand All @@ -1094,9 +1094,9 @@ static void add_stream_kafka_command(int connFd, std::string &kafka_server_IP, c
*loop_exit_p = true;
return;

Check warning on line 1095 in src/frontend/JasmineGraphFrontEnd.cpp

View check run for this annotation

Codecov / codecov/patch

src/frontend/JasmineGraphFrontEnd.cpp#L1094-L1095

Added lines #L1094 - L1095 were not covered by tests
}
partitionAlgo = partitionAlgo;
partitionAlgo = partitionAlgoInput;
} else {
string errorMsg = "Error: invalid partition option: "+partitionAlgo;
string errorMsg = "Error: invalid partition option: "+partitionAlgoInput;
result_wr = write(connFd, errorMsg.c_str(), errorMsg.length());
if (result_wr < 0) {
frontend_logger.error("Error writing to socket");
Expand Down Expand Up @@ -1245,8 +1245,8 @@ static void add_stream_kafka_command(int connFd, std::string &kafka_server_IP, c
std::time_t time = chrono::system_clock::to_time_t(chrono::system_clock::now());

Check warning on line 1245 in src/frontend/JasmineGraphFrontEnd.cpp

View check run for this annotation

Codecov / codecov/patch

src/frontend/JasmineGraphFrontEnd.cpp#L1245

Added line #L1245 was not covered by tests
string uploadStartTime = ctime(&time);
string sqlStatement =
"INSERT INTO graph (idgraph,idalgorithm,name,upload_path, upload_start_time, upload_end_time,"
"graph_status_idgraph_status, vertexcount, centralpartitioncount, edgecount, isDirected) VALUES("+
"INSERT INTO graph (idgraph,id_algorithm,name,upload_path, upload_start_time, upload_end_time,"
"graph_status_idgraph_status, vertexcount, centralpartitioncount, edgecount, is_directed) VALUES("+
graphId+","+partitionAlgo+",\"" +topic_name_s + "\", \"" + path + "\", \"" +uploadStartTime+ "\", \"\",\"" +
to_string(Conts::GRAPH_STATUS::STREAMING) + "\", \"\","+ to_string(numberOfPartitions)+
", \"\",\"" +direction+"\")";
Expand Down
2 changes: 1 addition & 1 deletion src/util/dbinterface/DBInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ int DBInterface::getNextGraphId() {
}

Check warning on line 174 in src/util/dbinterface/DBInterface.cpp

View check run for this annotation

Codecov / codecov/patch

src/util/dbinterface/DBInterface.cpp#L173-L174

Added lines #L173 - L174 were not covered by tests

std::string DBInterface::getPartitionAlgoByGraphID(std::string graphID) {

Check warning on line 176 in src/util/dbinterface/DBInterface.cpp

View check run for this annotation

Codecov / codecov/patch

src/util/dbinterface/DBInterface.cpp#L176

Added line #L176 was not covered by tests
std::string query = "SELECT idalgorithm FROM graph WHERE idgraph = ?;";
std::string query = "SELECT id_algorithm FROM graph WHERE idgraph = ?;";
sqlite3_stmt* stmt;

if (sqlite3_prepare_v2(database, query.c_str(), -1, &stmt, NULL) != SQLITE_OK) {
Expand Down

0 comments on commit da04cef

Please sign in to comment.