-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Remobe old network_trace and use a view
Removing the old tables `network_trace` and `time_mapping` and introduces a new view `network_trace` that contains the combined information. I renamed some columns in the view since naming a column `from` in sql is fraught with danger. Also instead of using `at` we now use the `recv_logical_time` which in my mind is more expressive of what this time represents.
- Loading branch information
1 parent
3febbc3
commit eb79616
Showing
7 changed files
with
63 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
-- +migrate Up | ||
DROP TABLE IF EXISTS network_trace; | ||
DROP TABLE IF EXISTS time_mapping; | ||
|
||
CREATE VIEW IF NOT EXISTS network_trace AS | ||
SELECT | ||
json_extract(meta, '$.test-id') as test_id, | ||
json_extract(meta, '$.run-id') as run_id, | ||
json_extract(data, '$.message') as message, | ||
json_extract(data, '$.args') as args, | ||
json_extract(data, '$.from') as sender, | ||
json_extract(data, '$.to') as receiver, | ||
json_extract(data, '$.kind') as kind, | ||
json_extract(data, '$.sent-logical-time') as sent_logical_time, | ||
json_extract(data, '$.recv-logical-time') as recv_logical_time, | ||
json_extract(data, '$.recv-simulated-time') as recv_simulated_time, | ||
json_extract(data, '$.dropped') as dropped | ||
FROM event_log | ||
WHERE event like 'NetworkTrace'; | ||
|
||
-- +migrate Down | ||
|
||
DROP VIEW IF EXISTS network_trace; | ||
CREATE TABLE IF NOT EXISTS time_mapping (rowid INTEGER PRIMARY KEY) WITHOUT ROWID; | ||
|
||
-- we need to create this table fully since we have migrations that actually do stuff with | ||
-- this table... | ||
CREATE TABLE IF NOT EXISTS network_trace ( | ||
test_id INTEGER NOT NULL, | ||
run_id INTEGER NOT NULL, | ||
id INTEGER NOT NULL, | ||
message TEXT NOT NULL, | ||
args JSON NOT NULL, | ||
`from` TEXT NOT NULL, | ||
`to` TEXT NOT NULL, | ||
sent_logical_time INTEGER NOT NULL, | ||
at INTEGER NOT NULL, | ||
dropped INT2 NOT NULL, | ||
PRIMARY KEY(test_id, run_id, id), | ||
FOREIGN KEY(test_id) REFERENCES test(id), | ||
FOREIGN KEY(run_id) REFERENCES run(id)); |
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
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