Skip to content

Commit 8880139

Browse files
authored
Fix stale code in Ensure (#6997)
Also make Ensure use all its argument even in debug mode, so that these things are easier to notice.
1 parent cecf2f9 commit 8880139

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/debug_assert.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@
2323
* of our control (e.g., unexpected changes to the metadata) so if you have a
2424
* test that trigger the error, this macro should not be used.
2525
*/
26-
#ifdef USE_ASSERT_CHECKING
27-
#define Ensure(COND, FMT, ...) AssertMacro(COND)
28-
#else
2926
#define Ensure(COND, FMT, ...) \
3027
do \
3128
{ \
3229
if (unlikely(!(COND))) \
30+
{ \
31+
Assert(false); \
3332
ereport(ERROR, \
3433
(errcode(ERRCODE_INTERNAL_ERROR), \
3534
errdetail("Assertion '" #COND "' failed."), \
3635
errmsg(FMT, ##__VA_ARGS__))); \
36+
} \
3737
} while (0)
38-
#endif

src/dimension_slice.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ ts_dimension_slice_delete_by_id(int32 dimension_slice_id, bool delete_constraint
832832
ItemPointerData tid;
833833
/* lock the tuple entry in the catalog table */
834834
bool found = lock_dimension_slice_tuple(dimension_slice_id, &tid, &form);
835-
Ensure(found, "hypertable id %d not found", slice->fd.id);
835+
Ensure(found, "dimension slice id %d not found", dimension_slice_id);
836836

837837
dimension_slice_delete_catalog_tuple(&tid);
838838
return true;

0 commit comments

Comments
 (0)