Skip to content

Commit

Permalink
Apply suggested database changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishad-M-I-M committed Jul 28, 2024
1 parent d892038 commit 7094f0a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
30 changes: 20 additions & 10 deletions ddl/metadb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,27 @@ create table worker_has_partition
worker_idworker INTEGER
);

create table operation_timebound
create table operation
(
idgraph INTEGER NOT NULL,
operation VARCHAR,
timebound INTEGER
idoperation INTEGER not null primary key,
operation VARCHAR
)

create table graph_operation_time
(
idgraph INTEGER NOT NULL,
idoperation INTEGER NOT NULL,
time INTEGER
);

create index timebound_index
on operation_timebound (idgraph, operation);
create index graph_operation_time_index
on graph_operation_time (idgraph, idoperation);

INSERT INTO graph_status (idgraph_status, description)
VALUES (1, 'LOADING'),
(2, 'OPERATIONAL'),
(3, 'DELETED'),
(4, 'NONOPERATIONAL');

INSERT INTO graph_status (idgraph_status, description) VALUES (1, 'LOADING');
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 operation (idoperation, operation)
VALUES (1, 'trian');
6 changes: 3 additions & 3 deletions src/frontend/JasmineGraphFrontEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ static void triangles_command(std::string masterIP, int connFd, SQLiteDBInterfac

int threadPriority = std::atoi(priority.c_str());

string timebound_query = "SELECT timebound FROM operation_timebound WHERE idgraph=" + graph_id
string timebound_query = "SELECT time FROM graph_operation_time NATURAL JOIN operation WHERE idgraph=" + graph_id
+ " AND operation='trian'";

vector<vector<pair<string, string>>> result = sqlite->runSelect(timebound_query);
Expand Down Expand Up @@ -1487,8 +1487,8 @@ static void triangles_command(std::string masterIP, int connFd, SQLiteDBInterfac

if (result.empty()) {
// TODO (Ishad-M-I-M): Insert the timebound with the overaheads added
string insert_timebound_query = "INSERT INTO operation_timebound VALUES (" +
graph_id + ", trian, " + to_string(msDuration)+ ")";
string insert_timebound_query = "INSERT INTO graph_operation_time VALUES (" +
graph_id + ", 1, " + to_string(msDuration)+ ")";
sqlite->runInsert(insert_timebound_query);
}

Expand Down

0 comments on commit 7094f0a

Please sign in to comment.