summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6e5f65c)
raw | patch | inline | side by side (parent: 6e5f65c)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 4 Jul 2014 18:35:26 +0000 (20:35 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 4 Jul 2014 18:35:26 +0000 (20:35 +0200) |
In theory, this doesn't make a big difference as either approach will let the
result depend on the order of update operations. However, considering more
cases as too old will allow to ignore more stuff and, thus, avoid some work.
result depend on the order of update operations. However, considering more
cases as too old will allow to ignore more stuff and, thus, avoid some work.
src/core/store.c | patch | blob | history | |
t/unit/core/store_test.c | patch | blob | history |
diff --git a/src/core/store.c b/src/core/store.c
index 8b284e77378bba680ead5d0edc8854049305a955..fc2a7f472d6dbdc0fb7111c2096cbfde38741d6f 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
old = STORE_OBJ(sdb_llist_search_by_name(parent_list, name));
if (old) {
- if (old->last_update > last_update) {
+ if (old->last_update >= last_update) {
sdb_log(SDB_LOG_DEBUG, "store: Cannot update %s '%s' - "
"value too old (%"PRIscTIME" < %"PRIscTIME")",
SDB_STORE_TYPE_TO_NAME(type), name,
index 4e40743d85ce60b28dcb965ac770b72935285927..0a022e430508276e80563c7b37fc2fb494f6e511 100644 (file)
--- a/t/unit/core/store_test.c
+++ b/t/unit/core/store_test.c
sdb_time_t last_update;
int expected;
} golden_data[] = {
+ { "a", 1, 0 },
{ "a", 2, 0 },
- { "a", 3, 0 },
{ "a", 1, 1 },
- { "b", 2, 0 },
+ { "b", 1, 0 },
{ "b", 1, 1 },
{ "A", 1, 1 }, /* case-insensitive */
- { "A", 4, 0 },
+ { "A", 3, 0 },
};
struct {
sdb_time_t last_update;
int expected;
} golden_data[] = {
- { "k", "k", "v", 1, -1 },
- { "k", "k", "v", 1, -1 }, /* retry to ensure the host is not created */
- { "l", "k1", "v1", 1, 0 },
- { "l", "k1", "v2", 2, 0 },
- { "l", "k1", "v3", 1, 1 },
- { "l", "k2", "v1", 1, 0 },
- { "m", "k", "v1", 2, 0 },
- { "m", "k", "v2", 1, 1 },
+ { "k", "k", "v", 1, -1 },
+ { "k", "k", "v", 1, -1 }, /* retry to ensure the host is not created */
+ { "l", "k1", "v1", 1, 0 },
+ { "l", "k1", "v2", 2, 0 },
+ { "l", "k1", "v3", 2, 1 },
+ { "l", "k2", "v1", 1, 0 },
+ { "m", "k", "v1", 1, 0 },
+ { "m", "k", "v2", 1, 1 },
};
size_t i;
sdb_time_t last_update;
int expected;
} golden_data[] = {
- { "k", "s", 1, -1 },
- { "k", "s", 1, -1 }, /* retry to ensure the host is not created */
- { "l", "s1", 1, 0 },
- { "l", "s1", 2, 0 },
- { "l", "s1", 1, 1 },
- { "l", "s2", 1, 0 },
- { "m", "s", 2, 0 },
- { "m", "s", 1, 1 },
+ { "k", "s", 1, -1 },
+ { "k", "s", 1, -1 }, /* retry to ensure the host is not created */
+ { "l", "s1", 1, 0 },
+ { "l", "s1", 2, 0 },
+ { "l", "s1", 2, 1 },
+ { "l", "s2", 1, 0 },
+ { "m", "s", 1, 0 },
+ { "m", "s", 1, 1 },
};
size_t i;