Skip to content

Commit 34a104b

Browse files
committed
MDEV-10229: TokuDB fails to build with CLang
Structure initialization must feature all members present within the struct.
1 parent 1bf2509 commit 34a104b

File tree

5 files changed

+9
-28
lines changed

5 files changed

+9
-28
lines changed

storage/tokudb/ft-index/ft/logger/recover.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ static int toku_recover_xcommit (struct logtype_xcommit *l, RECOVER_ENV renv) {
785785
assert(txn!=NULL);
786786

787787
// commit the transaction
788-
toku_txn_progress_extra extra = { time(NULL), l->lsn, "commit", l->xid };
788+
toku_txn_progress_extra extra = { time(NULL), l->lsn, "commit", l->xid, 0 };
789789
int r = toku_txn_commit_with_lsn(txn, true, l->lsn, toku_recover_txn_progress, &extra);
790790
assert(r == 0);
791791

@@ -828,7 +828,7 @@ static int toku_recover_xabort (struct logtype_xabort *l, RECOVER_ENV renv) {
828828
assert(txn!=NULL);
829829

830830
// abort the transaction
831-
toku_txn_progress_extra extra = { time(NULL), l->lsn, "abort", l->xid };
831+
toku_txn_progress_extra extra = { time(NULL), l->lsn, "abort", l->xid, 0 };
832832
r = toku_txn_abort_with_lsn(txn, l->lsn, toku_recover_txn_progress, &extra);
833833
assert(r == 0);
834834

@@ -1363,7 +1363,7 @@ static void recover_abort_live_txn(TOKUTXN txn) {
13631363
// sanity check that the recursive call successfully NULLs out txn->child
13641364
invariant(txn->child == NULL);
13651365
// abort the transaction
1366-
toku_txn_progress_extra extra = { time(NULL), ZERO_LSN, "abort live", txn->txnid };
1366+
toku_txn_progress_extra extra = { time(NULL), ZERO_LSN, "abort live", txn->txnid, 0 };
13671367
int r = toku_txn_abort_txn(txn, toku_recover_txn_progress, &extra);
13681368
assert(r == 0);
13691369

storage/tokudb/ft-index/ft/serialize/ft_node-serialize.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ serialize_and_compress_in_parallel(FTNODE node,
643643
struct serialize_compress_work work[npartitions];
644644
workset_lock(&ws);
645645
for (int i = 0; i < npartitions; i++) {
646-
work[i] = (struct serialize_compress_work) { .base = {{NULL}},
646+
work[i] = (struct serialize_compress_work) { .base = {{NULL, NULL}},
647647
.node = node,
648648
.i = i,
649649
.compression_method = compression_method,

storage/tokudb/ft-index/ft/txn/txn.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,14 @@ static txn_child_manager tcm;
333333
.do_fsync = false,
334334
.force_fsync_on_commit = false,
335335
.do_fsync_lsn = ZERO_LSN,
336-
.xa_xid = {0},
336+
.xa_xid = {0, 0, 0, {}},
337337
.progress_poll_fun = NULL,
338338
.progress_poll_fun_extra = NULL,
339-
.txn_lock = ZERO_MUTEX_INITIALIZER,
339+
.txn_lock = TOKU_MUTEX_INITIALIZER,
340340
.open_fts = open_fts,
341341
.roll_info = roll_info,
342-
.state_lock = ZERO_MUTEX_INITIALIZER,
343-
.state_cond = ZERO_COND_INITIALIZER,
342+
.state_lock = TOKU_MUTEX_INITIALIZER,
343+
.state_cond = TOKU_COND_INITIALIZER,
344344
.state = TOKUTXN_LIVE,
345345
.num_pin = 0,
346346
.client_id = 0,

storage/tokudb/ft-index/portability/toku_pthread.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,6 @@ typedef struct toku_mutex_aligned {
125125
toku_mutex_t aligned_mutex __attribute__((__aligned__(64)));
126126
} toku_mutex_aligned_t;
127127

128-
// Different OSes implement mutexes as different amounts of nested structs.
129-
// C++ will fill out all missing values with zeroes if you provide at least one zero, but it needs the right amount of nesting.
130-
#if defined(__FreeBSD__)
131-
# define ZERO_MUTEX_INITIALIZER {0}
132-
#elif defined(__APPLE__)
133-
# define ZERO_MUTEX_INITIALIZER {{0}}
134-
#else // __linux__, at least
135-
# define ZERO_MUTEX_INITIALIZER {{{0}}}
136-
#endif
137-
138128
#if TOKU_PTHREAD_DEBUG
139129
# define TOKU_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER, .owner = 0, .locked = false, .valid = true }
140130
#else
@@ -276,15 +266,6 @@ typedef struct toku_cond {
276266
pthread_cond_t pcond;
277267
} toku_cond_t;
278268

279-
// Different OSes implement mutexes as different amounts of nested structs.
280-
// C++ will fill out all missing values with zeroes if you provide at least one zero, but it needs the right amount of nesting.
281-
#if defined(__FreeBSD__)
282-
# define ZERO_COND_INITIALIZER {0}
283-
#elif defined(__APPLE__)
284-
# define ZERO_COND_INITIALIZER {{0}}
285-
#else // __linux__, at least
286-
# define ZERO_COND_INITIALIZER {{{0}}}
287-
#endif
288269
#define TOKU_COND_INITIALIZER {PTHREAD_COND_INITIALIZER}
289270

290271
static inline void

storage/tokudb/ft-index/src/tests/threaded_stress_test_helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ static int run_workers(
18251825
{
18261826
int r;
18271827
const struct perf_formatter *perf_formatter = &perf_formatters[cli_args->perf_output_format];
1828-
toku_mutex_t mutex = ZERO_MUTEX_INITIALIZER;
1828+
toku_mutex_t mutex = TOKU_MUTEX_INITIALIZER;
18291829
toku_mutex_init(&mutex, nullptr);
18301830
struct rwlock rwlock;
18311831
rwlock_init(&rwlock);

0 commit comments

Comments
 (0)