mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-02 16:21:27 +01:00
WIP/MINOR: stick-tables: Remove localupdate identifier from stick-tables to only rely on update
This commit is contained in:
parent
6485418925
commit
e9162ee569
@ -226,7 +226,6 @@ struct stktable {
|
|||||||
struct eb_root updates; /* head of sticky updates sequence tree, uses updt_lock */
|
struct eb_root updates; /* head of sticky updates sequence tree, uses updt_lock */
|
||||||
struct mt_list *pend_updts; /* list of updates to be added to the update sequence tree, one per thread-group */
|
struct mt_list *pend_updts; /* list of updates to be added to the update sequence tree, one per thread-group */
|
||||||
unsigned int update; /* uses updt_lock */
|
unsigned int update; /* uses updt_lock */
|
||||||
unsigned int localupdate; /* uses updt_lock */
|
|
||||||
struct tasklet *updt_task;/* tasklet responsible for pushing the pending updates into the tree */
|
struct tasklet *updt_task;/* tasklet responsible for pushing the pending updates into the tree */
|
||||||
|
|
||||||
THREAD_ALIGN(64);
|
THREAD_ALIGN(64);
|
||||||
|
|||||||
36
src/peers.c
36
src/peers.c
@ -1541,17 +1541,17 @@ static inline struct stksess *peer_update_stksess_lookup(struct shared_table *st
|
|||||||
if (!eb) {
|
if (!eb) {
|
||||||
eb = eb32_first(&st->table->updates);
|
eb = eb32_first(&st->table->updates);
|
||||||
if (!eb || (eb->key == st->last_pushed)) {
|
if (!eb || (eb->key == st->last_pushed)) {
|
||||||
st->last_pushed = st->table->localupdate;
|
st->last_pushed = st->table->update;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if distance between the last pushed and the retrieved key
|
/* if distance between the last pushed and the retrieved key
|
||||||
* is greater than the distance last_pushed and the local_update
|
* is greater than the distance last_pushed and the update
|
||||||
* this means we are beyond localupdate.
|
* this means we are beyond update.
|
||||||
*/
|
*/
|
||||||
if ((eb->key - st->last_pushed) > (st->table->localupdate - st->last_pushed)) {
|
if ((eb->key - st->last_pushed) > (st->table->update - st->last_pushed)) {
|
||||||
st->last_pushed = st->table->localupdate;
|
st->last_pushed = st->table->update;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2787,7 +2787,7 @@ int peer_send_msgs(struct appctx *appctx,
|
|||||||
repl = -1;
|
repl = -1;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
must_send = (peer->learnstate == PEER_LR_ST_NOTASSIGNED) && (st->last_pushed != st->table->localupdate);
|
must_send = (peer->learnstate == PEER_LR_ST_NOTASSIGNED) && (st->last_pushed != st->table->update);
|
||||||
HA_RWLOCK_RDUNLOCK(STK_TABLE_UPDT_LOCK, &st->table->updt_lock);
|
HA_RWLOCK_RDUNLOCK(STK_TABLE_UPDT_LOCK, &st->table->updt_lock);
|
||||||
|
|
||||||
if (must_send) {
|
if (must_send) {
|
||||||
@ -2982,21 +2982,7 @@ static inline void init_connected_peer(struct peer *peer, struct peers *peers)
|
|||||||
/* Init cursors */
|
/* Init cursors */
|
||||||
for (st = peer->tables; st ; st = st->next) {
|
for (st = peer->tables; st ; st = st->next) {
|
||||||
st->last_get = st->last_acked = 0;
|
st->last_get = st->last_acked = 0;
|
||||||
HA_RWLOCK_WRLOCK(STK_TABLE_UPDT_LOCK, &st->table->updt_lock);
|
st->last_pushed = HA_ATOMIC_LOAD(&st->update);
|
||||||
/* if st->update appears to be in future it means
|
|
||||||
* that the last acked value is very old and we
|
|
||||||
* remain unconnected a too long time to use this
|
|
||||||
* acknowledgement as a reset.
|
|
||||||
* We should update the protocol to be able to
|
|
||||||
* signal the remote peer that it needs a full resync.
|
|
||||||
* Here a partial fix consist to set st->update at
|
|
||||||
* the max past value.
|
|
||||||
*/
|
|
||||||
if ((int)(st->table->localupdate - st->update) < 0)
|
|
||||||
st->update = st->table->localupdate + (2147483648U);
|
|
||||||
st->last_pushed = st->update;
|
|
||||||
HA_RWLOCK_WRUNLOCK(STK_TABLE_UPDT_LOCK, &st->table->updt_lock);
|
|
||||||
|
|
||||||
st->ts = NULL;
|
st->ts = NULL;
|
||||||
st->bucket = 0;
|
st->bucket = 0;
|
||||||
st->resync_end = TICK_ETERNITY;
|
st->resync_end = TICK_ETERNITY;
|
||||||
@ -3701,7 +3687,7 @@ static void __process_running_peer_sync(struct task *task, struct peers *peers,
|
|||||||
|
|
||||||
/* Awake session if there is data to push */
|
/* Awake session if there is data to push */
|
||||||
for (st = peer->tables; st ; st = st->next) {
|
for (st = peer->tables; st ; st = st->next) {
|
||||||
if (st->last_pushed != st->table->localupdate) {
|
if (st->last_pushed != st->table->update) {
|
||||||
/* wake up the peer handler to push local updates */
|
/* wake up the peer handler to push local updates */
|
||||||
update_to_push = 1;
|
update_to_push = 1;
|
||||||
/* There is no need to send a heartbeat message
|
/* There is no need to send a heartbeat message
|
||||||
@ -3890,7 +3876,7 @@ static void __process_stopping_peer_sync(struct task *task, struct peers *peers,
|
|||||||
/* current peer connection is active and established
|
/* current peer connection is active and established
|
||||||
* wake up all peer handlers to push remaining local updates */
|
* wake up all peer handlers to push remaining local updates */
|
||||||
for (st = peer->tables; st ; st = st->next) {
|
for (st = peer->tables; st ; st = st->next) {
|
||||||
if (st->last_pushed != st->table->localupdate) {
|
if (st->last_pushed != st->table->update) {
|
||||||
appctx_wakeup(peer->appctx);
|
appctx_wakeup(peer->appctx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4339,8 +4325,8 @@ static int peers_dump_peer(struct buffer *msg, struct appctx *appctx, struct pee
|
|||||||
st->flags, (unsigned long long)st->remote_data);
|
st->flags, (unsigned long long)st->remote_data);
|
||||||
chunk_appendf(&trash, "\n last_acked=%u last_pushed=%u last_get=%u update=%u",
|
chunk_appendf(&trash, "\n last_acked=%u last_pushed=%u last_get=%u update=%u",
|
||||||
st->last_acked, st->last_pushed, st->last_get, st->update);
|
st->last_acked, st->last_pushed, st->last_get, st->update);
|
||||||
chunk_appendf(&trash, "\n table:%p id=%s update=%u localupdate=%u refcnt=%u",
|
chunk_appendf(&trash, "\n table:%p id=%s update=%u refcnt=%u",
|
||||||
t, t->id, t->update, t->localupdate, t->refcnt);
|
t, t->id, t->update, t->refcnt);
|
||||||
if (flags & PEERS_SHOW_F_DICT) {
|
if (flags & PEERS_SHOW_F_DICT) {
|
||||||
chunk_appendf(&trash, "\n TX dictionary cache:");
|
chunk_appendf(&trash, "\n TX dictionary cache:");
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|||||||
@ -845,7 +845,6 @@ struct task *stktable_add_pend_updates(struct task *t, void *ctx, unsigned int s
|
|||||||
cur_tgid = 0;
|
cur_tgid = 0;
|
||||||
stksess->seen = 0;
|
stksess->seen = 0;
|
||||||
stksess->upd.key = ++table->update;
|
stksess->upd.key = ++table->update;
|
||||||
table->localupdate = table->update;
|
|
||||||
eb32_delete(&stksess->upd);
|
eb32_delete(&stksess->upd);
|
||||||
|
|
||||||
/* even though very unlikely, it seldom happens that the entry
|
/* even though very unlikely, it seldom happens that the entry
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user