Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
RedisLabs Raft
Commits
ab9c28d3
Commit
ab9c28d3
authored
Dec 19, 2018
by
Yossi Gottlieb
Browse files
Fix memory access issues in tests, update docs.
parent
84362fa7
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/raft.h
View file @
ab9c28d3
...
@@ -1130,14 +1130,20 @@ typedef struct {
...
@@ -1130,14 +1130,20 @@ typedef struct {
/** Callback for removing the oldest entry from the log
/** Callback for removing the oldest entry from the log
* For safety reasons this callback MUST flush the change to disk.
* For safety reasons this callback MUST flush the change to disk.
* @note If memory was malloc'd in log_offer then this should be the right
* @note The callback does not need to call raft_entry_release() as
* time to free the memory. */
* no references are implicitly held. If access to the entry is
* desired after the callback returns, raft_entry_hold() should be
* used.
*/
func_logentry_event_f
log_poll
;
func_logentry_event_f
log_poll
;
/** Callback for removing the youngest entry from the log
/** Callback for removing the youngest entry from the log
* For safety reasons this callback MUST flush the change to disk.
* For safety reasons this callback MUST flush the change to disk.
* @note If memory was malloc'd in log_offer then this should be the right
* @note The callback does not need to call raft_entry_release() as
* time to free the memory. */
* no references are implicitly held. If access to the entry is
* desired after the callback returns, raft_entry_hold() should be
* used.
*/
func_logentry_event_f
log_pop
;
func_logentry_event_f
log_pop
;
/** Callback called for every existing log entry when clearing the log.
/** Callback called for every existing log entry when clearing the log.
...
...
tests/test_log.c
View file @
ab9c28d3
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
static
void
__LOG_APPEND_ENTRY
(
void
*
l
,
int
id
,
raft_term_t
term
,
const
char
*
data
)
static
void
__LOG_APPEND_ENTRY
(
void
*
l
,
int
id
,
raft_term_t
term
,
const
char
*
data
)
{
{
raft_entry_t
*
e
=
__MAKE_ENTRY
(
id
,
term
,
data
);
raft_entry_t
*
e
=
__MAKE_ENTRY
(
id
,
term
,
data
);
raft_entry_hold
(
e
);
/* need an extra ref because tests assume it lives on */
log_append_entry
(
l
,
e
);
log_append_entry
(
l
,
e
);
}
}
...
@@ -25,6 +26,7 @@ static void __LOG_APPEND_ENTRIES_SEQ_ID(void *l, int count, int id, raft_term_t
...
@@ -25,6 +26,7 @@ static void __LOG_APPEND_ENTRIES_SEQ_ID(void *l, int count, int id, raft_term_t
int
i
;
int
i
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
raft_entry_t
*
e
=
__MAKE_ENTRY
(
id
++
,
term
,
data
);
raft_entry_t
*
e
=
__MAKE_ENTRY
(
id
++
,
term
,
data
);
raft_entry_hold
(
e
);
/* need an extra ref because tests assume it lives on */
log_append_entry
(
l
,
e
);
log_append_entry
(
l
,
e
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment