Changeset: 3e390ca163e2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3e390ca163e2
Modified Files:
gdk/gdk.h
sql/storage/bat/bat_storage.c
Branch: Sep2022
Log Message:
Never, ever treat gdk_return as Boolean, only ever compare with GDK_SUCCEED.
diffs (72 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -343,6 +343,8 @@
#define gdk_export extern
#endif
+/* Only ever compare with GDK_SUCCEED, never with GDK_FAIL, and do not
+ * use as a Boolean. */
typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return;
gdk_export _Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char
*format, ...)
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -3958,7 +3958,7 @@ log_table_append(sql_trans *tr, sql_tabl
}
unlock_table(tr->store, t->base.id);
- for (node *n = ol_first_node(t->columns); n && ok; n = n->next) {
+ for (node *n = ol_first_node(t->columns); n && ok == GDK_SUCCEED; n =
n->next) {
sql_column *c = n->data;
column_storage *cs = ATOMIC_PTR_GET(&c->data);
@@ -3968,17 +3968,19 @@ log_table_append(sql_trans *tr, sql_tabl
}
lock_table(tr->store, t->base.id);
- if (!cs->cleared) for (segment *cur = segs->h; cur && ok; cur =
cur->next) {
- unlock_table(tr->store, t->base.id);
- if (cur->ts == tr->tid && !cur->deleted && cur->start <
end) {
- /* append col*/
- BAT *ins = temp_descriptor(cs->bid);
- assert(ins);
- assert(BATcount(ins) >= cur->end);
- ok = log_bat(store->logger, ins, c->base.id,
cur->start, cur->end-cur->start, nr_appends);
- bat_destroy(ins);
+ if (!cs->cleared) {
+ for (segment *cur = segs->h; cur && ok == GDK_SUCCEED;
cur = cur->next) {
+ unlock_table(tr->store, t->base.id);
+ if (cur->ts == tr->tid && !cur->deleted &&
cur->start < end) {
+ /* append col*/
+ BAT *ins = temp_descriptor(cs->bid);
+ assert(ins);
+ assert(BATcount(ins) >= cur->end);
+ ok = log_bat(store->logger, ins,
c->base.id, cur->start, cur->end-cur->start, nr_appends);
+ bat_destroy(ins);
+ }
+ lock_table(tr->store, t->base.id);
}
- lock_table(tr->store, t->base.id);
}
unlock_table(tr->store, t->base.id);
@@ -3993,7 +3995,7 @@ log_table_append(sql_trans *tr, sql_tabl
}
if (t->idxs) {
- for (node *n = ol_first_node(t->idxs); n && ok; n = n->next) {
+ for (node *n = ol_first_node(t->idxs); n && ok == GDK_SUCCEED;
n = n->next) {
sql_idx *i = n->data;
if ((hash_index(i->type) && list_length(i->columns) <=
1) || !idx_has_column(i->type))
@@ -4007,7 +4009,7 @@ log_table_append(sql_trans *tr, sql_tabl
}
lock_table(tr->store, t->base.id);
- for (segment *cur = segs->h; cur && ok; cur =
cur->next) {
+ for (segment *cur = segs->h; cur && ok ==
GDK_SUCCEED; cur = cur->next) {
unlock_table(tr->store, t->base.id);
if (cur->ts == tr->tid && !cur->deleted
&& cur->start < end) {
/* append idx */
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]