Skip to content

Commit

Permalink
Fix stale code in Ensure (#6997)
Browse files Browse the repository at this point in the history
Also make Ensure use all its argument even in debug mode, so that these
things are easier to notice.
  • Loading branch information
akuzm authored Jun 4, 2024
1 parent cecf2f9 commit 8880139
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/debug_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@
* of our control (e.g., unexpected changes to the metadata) so if you have a
* test that trigger the error, this macro should not be used.
*/
#ifdef USE_ASSERT_CHECKING
#define Ensure(COND, FMT, ...) AssertMacro(COND)
#else
#define Ensure(COND, FMT, ...) \
do \
{ \
if (unlikely(!(COND))) \
{ \
Assert(false); \
ereport(ERROR, \
(errcode(ERRCODE_INTERNAL_ERROR), \
errdetail("Assertion '" #COND "' failed."), \
errmsg(FMT, ##__VA_ARGS__))); \
} \
} while (0)
#endif
2 changes: 1 addition & 1 deletion src/dimension_slice.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ ts_dimension_slice_delete_by_id(int32 dimension_slice_id, bool delete_constraint
ItemPointerData tid;
/* lock the tuple entry in the catalog table */
bool found = lock_dimension_slice_tuple(dimension_slice_id, &tid, &form);
Ensure(found, "hypertable id %d not found", slice->fd.id);
Ensure(found, "dimension slice id %d not found", dimension_slice_id);

dimension_slice_delete_catalog_tuple(&tid);
return true;
Expand Down

0 comments on commit 8880139

Please sign in to comment.