store: All store functions now accept a store object.
That is, instead of operating on a global, shared instance.
That is, instead of operating on a global, shared instance.
store: Add wrapper functions to store an object in an arbitrary store.
core: Export the sdb_store, sdb_store_reader, sdb_store_writer types.
This is in preparation to more flexible store handling.
This is in preparation to more flexible store handling.
t/valgrind.suppress: Refine the suppression in the libc exit handler.
frontend: Use the plugin query interface instead of direct store access.
The built-in store is registered as a reader automatically at the moment.
The built-in store is registered as a reader automatically at the moment.
core: Add support for reader/query plugins.
A reader plugin can be used to query a data-store based on a query described
by an AST. The plugin module provides a generic function for this purpose.
At the moment, only a single reader plugin can be used at a time. Supporting
multiple readers requires a good merge strategy. The challenge is to handle
filters and query conditions correctly which may evaluate differently after
two stores have been merged.
A reader plugin can be used to query a data-store based on a query described
by an AST. The plugin module provides a generic function for this purpose.
At the moment, only a single reader plugin can be used at a time. Supporting
multiple readers requires a good merge strategy. The challenge is to handle
filters and query conditions correctly which may evaluate differently after
two stores have been merged.
t/valgrind.suppress: Add an invalid free in a libc exit handler.
plugin: Drop sdb_plugin prefix from private names.
store_exec: Remove unnecessary casts.
store: Let sdb_store_json_formatter_t inherit from sdb_object_t.
Drop sdb_store_get_host() from tests.
store: Drop unused sdb_store_has_host.
Replaced sdb_store_<type> with sdb_plugin_store_<type>.
That is, all store updates will now directly go through the plugin API and be
distributed to all store-writer plugins from there.
That is, all store updates will now directly go through the plugin API and be
distributed to all store-writer plugins from there.
Merged branch 'master' of git://git.tokkee.org/sysdb.
store: Register a store writer and handle all updates through the plugin API.
We still reference a global store object. This change further encapsulates the
store.
We still reference a global store object. This change further encapsulates the
store.
plugin: sdb_plugin_store_* now return >0 if the new value was too old.
That is, the return values now mean the same as for the sdb_store_* functions.
That is, the return values now mean the same as for the sdb_store_* functions.
store: Reordered some functions to group by general purpose.
Fix an uninitialized value warnings caused by clang not knowing about fail().
store: Make the actual store a separate object.
That'll allow us to use different store objects in multiple places in the
future.
That'll allow us to use different store objects in multiple places in the
future.
store: Drop sdb_ prefix from private symbols.
data: Use a predefined format for sdb_strftime().
Also, print the nanosecond fraction of a second.
Also, print the nanosecond fraction of a second.
t/: Use ck_assert() instead of assert() in all tests.
sysdbql(7): Document 'value' and 'timeseries' fields.
parser: Add support for metric timeseries fields.
store: Add the timeseries field to metrics.
This is a boolean field that specifies whether a timeseries for the metric is
known to SysDB.
This is a boolean field that specifies whether a timeseries for the metric is
known to SysDB.
parser: Skip context-specific checks if the context is unspecified.
Else, the analyzer may reject valid queries. It's up to the caller to run the
analyzer using the right context once it's known.
Else, the analyzer may reject valid queries. It's up to the caller to run the
analyzer using the right context once it's known.
store: Remove (now unused) sdb_store_parse_*() helpers.
store: Remove (now unused) sdb_store_nin_matcher().
sysdbql(7): Document IS [NOT] TRUE / FALSE.
parser: Add support for <expr> IS [NOT] TRUE / FALSE queries.
store: Add support for unary IS TRUE / IS FALSE matchers.
store: Drop the special IS-NOT-NULL matcher.
In the AST world, this is NOT(IS-NULL).
In the AST world, this is NOT(IS-NULL).
utils/proto: Support boolean values.
They are encoded as a single byte on the wire.
They are encoded as a single byte on the wire.
data: Add basic support for a boolean type.
This change breaks backward compatibility of the network protocol because it
changes the encoding of a datum. I felt this is still acceptable (given the
current (non-)compatibility promise) and it made the order of types feel more
natural ;-)
This change breaks backward compatibility of the network protocol because it
changes the encoding of a datum. I felt this is still acceptable (given the
current (non-)compatibility promise) and it made the order of types feel more
natural ;-)
Drop the old frontend parser.
It's fully replaced by the new parser module now.
It's fully replaced by the new parser module now.
store: Add sdb_store_query_prepare_matcher().
This prepares a logical expression described by an AST for execution as a
store matcher. This is useful for anything that uses the lower level store
lookup functions.
This prepares a logical expression described by an AST for execution as a
store matcher. This is useful for anything that uses the lower level store
lookup functions.
frontend: Drop sdb_fe_store_* in favor of sdb_store_query_execute.
Instead, build a temporary AST to represent the command to be executed.
Instead, build a temporary AST to represent the command to be executed.
frontend: Drop sdb_fe_exec_* in favor of sdb_store_query_execute.
Instead, build a temporary AST to represent the command to be executed.
Instead, build a temporary AST to represent the command to be executed.
Remove (now) usued sdb_fe_exec_timeseries().
frontend/query_test: Add tests for the lower level functions.
frontend/query: Split AST execution into a separate function.
store: Use a separate type for prepared querys.
It's sufficiently different from the general matchers/filters approach to not
benefit from sharing a base type.
It's sufficiently different from the general matchers/filters approach to not
benefit from sharing a base type.
store, frontend: Add sdb_store_query_execute use it instead of sdb_fe_exec.
This new function executes a generic QUERY matcher as returned by
sdb_store_query_prepare and writes the reply to a string buffer.
This new function executes a generic QUERY matcher as returned by
sdb_store_query_prepare and writes the reply to a string buffer.
Merged branch 'master' of git://git.tokkee.org/sysdb.
frontend/query_test: Test various QUERY functions.
These will, in turn, call the sdb_fe_exec_<CMD> functions, thus guaranteeing
good test coverage.
These will, in turn, call the sdb_fe_exec_<CMD> functions, thus guaranteeing
good test coverage.
frontend: Fixed reply from STORE command.
store: Fixed a memory leak in fetch_timeseries().
frontend, parser: Allow typed access to host objects from any context.
That is, even from the "generic" or "filter" contexts.
That is, even from the "generic" or "filter" contexts.
store: Add sdb_store_query_prepare().
This function prepares a query, represented by its AST, for execution in a
store by generating a store matcher.
This function prepares a query, represented by its AST, for execution in a
store by generating a store matcher.
store: Store a service/metric's parent hostname as an attribute.
store: Fixed handling of metric store values.
- Call sdb_plugin_store_metric() even if store=NULL (don't return early).
- Don't drop old values if strdup failed when storing store type/id.
- Fixed a segfault in sdb_plugin_store_metric() when using store=NULL.
- Call sdb_plugin_store_metric() even if store=NULL (don't return early).
- Don't drop old values if strdup failed when storing store type/id.
- Fixed a segfault in sdb_plugin_store_metric() when using store=NULL.
parser/analyzer: Fixed iterator type checks.
Also, added some more test-cases covering affected cases.
Also, added some more test-cases covering affected cases.
t/coverage: Ignore parser/scanner and parser/grammar.
t/Makefile: Update EXTRA_DIST based on recent changes.
parser/analyzer: Migrate value expression checks.
The new parser and analyzer now pass the full test-suite of frontend/parser.
The new parser and analyzer now pass the full test-suite of frontend/parser.
parser/analyzer: Migrate type and iterator checks.
parser: Add support for analyzing conditional and arithmetic expressions.
Let all parser functions call the respective analyzer. For now, this is only
used to propagate data-type information but it will later ensure a certain
amount of semantical correctness. Note that the new analyzers usually don't
have any context information, so they might accept expressions that are not
right for their later target use case. If that matters, the caller will have
to check again providing the right context.
Let all parser functions call the respective analyzer. For now, this is only
used to propagate data-type information but it will later ensure a certain
amount of semantical correctness. Note that the new analyzers usually don't
have any context information, so they might accept expressions that are not
right for their later target use case. If that matters, the caller will have
to check again providing the right context.
parser: Convert AST op types to data op types when necessary.
parser: Determine the data-type of each node.
For now, we only use this for arithmetic expressions. The field will be
populated by the analyzer.
For now, we only use this for arithmetic expressions. The field will be
populated by the analyzer.
parser: Fixed setup of iterator nodes.
The iterator value was supposed to be an "incomplete operator" node, that is,
one of the operands should be NULL. This is actually the case now and this
also means we don't have to store the operator type separately.
The iterator value was supposed to be an "incomplete operator" node, that is,
one of the operands should be NULL. This is actually the case now and this
also means we don't have to store the operator type separately.
parser/ast: Add some helper defines.
Migrate top-level checks to the new parser/analyzer.
Call the analyzer from sdb_parser_parse().
Call the analyzer from sdb_parser_parse().
parser_test: Make sure that TIMESERIES end times are greater than start times.
parser/grammar: Fix the hostname in a 'FETCH host' node.
Migrate parser from frontend/ to parser/ and to use the AST.
The new parser now returns AST nodes instead of a "compiled" store lookup
operator. The old parser is still in place unmodified and currently still in
use.
The new parser now returns AST nodes instead of a "compiled" store lookup
operator. The old parser is still in place unmodified and currently still in
use.
parser/ast: Introduce a data-structure representing a SysQL AST.
This will be used by the parser in the future.
This will be used by the parser in the future.
frontend/parser: Renamed SDB_PARSE_EXPR to SDB_PARSE_ARITH.
That's a bit more specific ;-)
That's a bit more specific ;-)
build system: Fix VPATH (out-of-tree) builds.
t/cibuild: Ignore missing field initializer warnings for tests.
Old versions of clang and gcc complain about { 0 } initializers even though
they are well defined by C99.
Old versions of clang and gcc complain about { 0 } initializers even though
they are well defined by C99.
query language: Add support for attribute.value access.
analyzer: Improve some error messages.
analyzer: attributes and backends are always iterable, even in filters.
Before, this was not allowed because the execution context for a filter is not
know (generic) and this case was to handled separately.
Before, this was not allowed because the execution context for a filter is not
know (generic) and this case was to handled separately.
store: Added field type VALUE for attribute values.
store: Test get_field() more extensively and fix a small bug.
Use a table-driven test now.
Use a table-driven test now.
Add tests for expression iterators.
store_expr: iterator: Support constant arrays without a stored object.
store_expr: Fix iter_has_next if the first elements are filtered.
data: Let sdb_data_array_get support DATETIME, BINARY, REGEX values.
data: sdb_data_strcmp supports arrays because sdb_data_format supports it.
store: Use iterable expressions for iterators.
Rather than having a separate iterator implementation in store_lookup.
Rather than having a separate iterator implementation in store_lookup.
store: When advancing an iterator don't loop endlessly on filtered objects.
store: Apply iterator expressions to the iterated objects.
store: Advance expression iterators even if array access fails.
Else, we'd have an endless loop as the caller doesn't know about that.
Else, we'd have an endless loop as the caller doesn't know about that.
store: Fixed a memory leak in sdb_store_expr_iter_destroy().
Let iterator operators fill in the left operand of child operators.
This avoids the need for repeating the same operand in two places and better
reflects what's actually going on.
This avoids the need for repeating the same operand in two places and better
reflects what's actually going on.
Let the first operand of ANY/ALL iterators be an expression.
For now, the same restrictions apply as before (iterate child objects or the
backends field). This is in preparation for more generic iterators.
For now, the same restrictions apply as before (iterate child objects or the
backends field). This is in preparation for more generic iterators.
query language: Change iterator syntax to ANY/ALL <iter>.<field> <op> <v>.
That is, make it explicit that iterators access the object name and make it
easier to support other fields as well.
That is, make it explicit that iterators access the object name and make it
easier to support other fields as well.
data: Return the number of bytes that would have been returned.
That is, behave as documented, even if the buffer is NULL or otherwise too
small. Return size_t instead of an integer.
That is, behave as documented, even if the buffer is NULL or otherwise too
small. Return size_t instead of an integer.
data: Let strlen/format handle NULL values correctly.
store: Add support for iterable expressions.
It can be used to iterate through either the list of child nodes or through
arbitrary arrays. An expression is iterable either if it stores / evaluates to
an array or if it's a typed expression evaluated in the context of an object
where the specified type represents child nodes.
It can be used to iterate through either the list of child nodes or through
arbitrary arrays. An expression is iterable either if it stores / evaluates to
an array or if it's a typed expression evaluated in the context of an object
where the specified type represents child nodes.
avltree: Add sdb_avltree_iter_peek_next().
The function returns the next element without advancing the iterator.
The function returns the next element without advancing the iterator.
Allow the left operand of comparison operations to be NULL (initially).
However, when evaluating the expression, the operand has to be set. We'll use
this as a placeholder for inserting values dynamically.
However, when evaluating the expression, the operand has to be set. We'll use
this as a placeholder for inserting values dynamically.
analyzer: Check that all iterators use ary operators.
All iterators are based on a comparison <iter> <op> <expr> and the same
restrictions apply to all of them.
All iterators are based on a comparison <iter> <op> <expr> and the same
restrictions apply to all of them.
frontend/grammar: Fixed format argument used in yyerrorf().
t/integration: Split query.sh into multiple tests.
integration/query.sh: Check that empty commands work fine.
parser_test: Test further error cases and error propagation in the analyzer.
frontend/grammar: Check arithmetic expressions early.
Constant expressions are evaluated early. Thus, creating an expression object
may fail if there's a semantics error. Catch this early and report a (generic)
error to avoid propagating a NULL value.
Constant expressions are evaluated early. Thus, creating an expression object
may fail if there's a semantics error. Catch this early and report a (generic)
error to avoid propagating a NULL value.
sysdbql(7): Document typed expressions.
Add support for the 'NOT IN' operator.
'a NOT IN b' is the same as 'NOT a IN b'.
'a NOT IN b' is the same as 'NOT a IN b'.