-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
T2.3 decission support tool #179
base: master
Are you sure you want to change the base?
Conversation
backend/db/jbson.c
Outdated
@@ -317,15 +317,22 @@ j_bson_iter_value(bson_iter_t* iter, JDBType type, JDBTypeValue* value, GError** | |||
|
|||
break; | |||
case J_DB_TYPE_SINT64: | |||
if (G_UNLIKELY(!BSON_ITER_HOLDS_INT64(iter))) | |||
if (G_UNLIKELY(!BSON_ITER_HOLDS_INT64(iter) && !BSON_ITER_HOLDS_INT32(iter))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bson
containing int32 should also be able to be parsed
if (client_program_name == NULL) | ||
{ | ||
client_program_name = "<unkown>"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different ways to get a program name, if there is a better way, please let me know.
} | ||
|
||
static guint32 | ||
count_keys_recursive(const bson_t* bson) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Number of keys in query bson
↔ complexity measure
lib/core/jtrace.c
Outdated
} | ||
else | ||
{ | ||
/// \TODO handle unknown backends |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning? panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning imo
ret = j_backend_db_schema_get(db_backend, batch, parts[NAME], schema, &error); | ||
g_array_append_val(bsons, schema); | ||
// schema do not exists | ||
if (error && error->code == 8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normal behavior is to check if i schema exists before creating a new one, therefore a schema does not exist
is no error to panic
lib/core/jtrace.c
Outdated
else if (strncmp(name, "backend_", 8) == 0) | ||
{ | ||
int type = 0; | ||
if (trace_thread->access.db.type == NULL) /// \TODO more precise checking? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by precise checking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is for loading the type
and config_path
of each backend, which cannot be done in the init
since the trace will be initialized before the backends.
Instead of checking db.type
, it could be checked more of null, but this would mean an invalid state .... so think the test is enough, and will remove the todo
lib/core/jtrace.c
Outdated
trace_thread->client.uid = va_arg(args, guint32); | ||
va_end(args); | ||
} | ||
else if (strncmp(name, "backend_", 8) == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a comment here to clarify that this line filters for trace calls with backend_
prefix.
lib/core/jtrace.c
Outdated
name += 8; | ||
if (strncmp(name, "kv_", 3) == 0) | ||
{ | ||
type = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those 'magic' numbers should probably be an enum for readability.
lib/core/jtrace.c
Outdated
|
||
j_configuration_unref(config); | ||
} | ||
name += 8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to catch should the prefix change later on.
Maybe add defines for the prefix and prefix length? This would still avoid pattern matching overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also used later on: is it feasible to split the string (even before the match against 'backend_') on '_' and compare parts instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot split at every _
because sometimes it appears in the name, like get_all
. And doing it before the check for backend_
seems like a lot of potential string comparing and allocating because the name is constant. Therefore, we cannot simply add \0
tools/access_replay.c
Outdated
goto end; | ||
} | ||
|
||
// j_trace_init("julea-replay"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be out-commented? Otherwise it is probably better to delete
}; | ||
|
||
static gboolean | ||
split(char* line, char* parts[ROW_LEN]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also g_strsplit
but I think I like your version better :)
tools/access_replay.c
Outdated
char* line = NULL; | ||
size_t len = 0; | ||
ssize_t read = 0; | ||
memset(memory_chunk, 0, memory_chunck_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should memory_chunk
be initialized with random values instead of only 0?
g_warning("unkown operation: '%s'", op); | ||
} | ||
return ret; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some empty lines for readability :)
Does it make sense to enfore |
I rewrote the doc file here. |
You could also use replays to test a configuration for its functionality. So, you do not need to run an expensive program or made up integration test, just re-run the data access. Also reduces dependencies for such cases. Since each |
Alright :) |
I get warnings during the build:
|
I worked through the examples given in the documentation and everything worked fine. As an addition it could be nice to mention the R package dependencies in the docs (probably as a command that install them?). I ran through a few iterations of trying to execute the R script and installing missing packages. |
This is fixed now. |
534bee5
to
7839ad2
Compare
ab1f9c6
to
6921602
Compare
Adding decision support to JULEA.
New:
access
which logs server backend operations.access-replay
which takes aJULEA_TRACE=access
trace and replays the backend operations of itscripts/decission-support.py
runsaccess-replay
multiple times for different configurations described in a config filescripts/decission-support.R
converts the output of ascripts/decission-support.py
to plots and tables, which can be viewed as text or webpagescripts/style.css
andscripts/interactive.js
for interactive and nice HTML page, where to put this file properly?Further documentation can be found in
doc/decission-support.md
Additional analytics possible on this data, but not yet implemented:
Added build option
julea_trace
to enable tracing also for release builds