mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-08 20:40:59 +01:00
MEDIUM: peers: Remove commitupdate field on stick-tables
This stick-table field was atomically updated with the last update id pushed and dumped on the CLI but never used otherwise. And all peer sessions share the same id because it is a stick-table info. So the info in peers dump is pretty limited. So, let's remove it.
This commit is contained in:
parent
590c5ff2ed
commit
ecc2c3a35d
@ -227,7 +227,6 @@ struct stktable {
|
||||
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 localupdate; /* uses updt_lock */
|
||||
unsigned int commitupdate;/* used to identify the latest local updates pending for sync, uses updt_lock */
|
||||
struct tasklet *updt_task;/* tasklet responsible for pushing the pending updates into the tree */
|
||||
|
||||
THREAD_ALIGN(64);
|
||||
|
||||
33
src/peers.c
33
src/peers.c
@ -1536,7 +1536,7 @@ static inline struct stksess *peer_teach_process_stksess_lookup(struct shared_ta
|
||||
if (!eb) {
|
||||
eb = eb32_first(&st->table->updates);
|
||||
if (!eb || (eb->key == st->last_pushed)) {
|
||||
st->table->commitupdate = st->last_pushed = st->table->localupdate;
|
||||
st->last_pushed = st->table->localupdate;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -1546,7 +1546,7 @@ static inline struct stksess *peer_teach_process_stksess_lookup(struct shared_ta
|
||||
* this means we are beyond localupdate.
|
||||
*/
|
||||
if ((eb->key - st->last_pushed) > (st->table->localupdate - st->last_pushed)) {
|
||||
st->table->commitupdate = st->last_pushed = st->table->localupdate;
|
||||
st->last_pushed = st->table->localupdate;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1701,16 +1701,6 @@ int peer_send_teachmsgs(struct appctx *appctx, struct peer *p,
|
||||
TRACE_PRINTF(TRACE_LEVEL_DEVELOPER, PEERS_EV_PROTO_UPDATE, appctx, NULL, st, NULL,
|
||||
"update message sent (table=%s, updateid=%u)", st->table->id, st->last_pushed);
|
||||
|
||||
if (peer_stksess_lookup == peer_teach_process_stksess_lookup) {
|
||||
uint commitid = _HA_ATOMIC_LOAD(&st->table->commitupdate);
|
||||
|
||||
while ((int)(updateid - commitid) > 0) {
|
||||
if (_HA_ATOMIC_CAS(&st->table->commitupdate, &commitid, updateid))
|
||||
break;
|
||||
__ha_cpu_relax();
|
||||
}
|
||||
}
|
||||
|
||||
/* identifier may not needed in next update message */
|
||||
new_pushed = 0;
|
||||
|
||||
@ -2981,8 +2971,6 @@ static inline void init_connected_peer(struct peer *peer, struct peers *peers)
|
||||
|
||||
/* Init cursors */
|
||||
for (st = peer->tables; st ; st = st->next) {
|
||||
uint updateid, commitid;
|
||||
|
||||
st->last_get = st->last_acked = 0;
|
||||
HA_RWLOCK_WRLOCK(STK_TABLE_UPDT_LOCK, &st->table->updt_lock);
|
||||
/* if st->update appears to be in future it means
|
||||
@ -2999,15 +2987,6 @@ static inline void init_connected_peer(struct peer *peer, struct peers *peers)
|
||||
st->teaching_origin = st->last_pushed = st->update;
|
||||
st->flags = 0;
|
||||
|
||||
updateid = st->last_pushed;
|
||||
commitid = _HA_ATOMIC_LOAD(&st->table->commitupdate);
|
||||
|
||||
while ((int)(updateid - commitid) > 0) {
|
||||
if (_HA_ATOMIC_CAS(&st->table->commitupdate, &commitid, updateid))
|
||||
break;
|
||||
__ha_cpu_relax();
|
||||
}
|
||||
|
||||
HA_RWLOCK_WRUNLOCK(STK_TABLE_UPDT_LOCK, &st->table->updt_lock);
|
||||
}
|
||||
|
||||
@ -4347,11 +4326,9 @@ static int peers_dump_peer(struct buffer *msg, struct appctx *appctx, struct pee
|
||||
st->flags, (unsigned long long)st->remote_data);
|
||||
chunk_appendf(&trash, "\n last_acked=%u last_pushed=%u last_get=%u"
|
||||
" teaching_origin=%u update=%u",
|
||||
st->last_acked, st->last_pushed, st->last_get,
|
||||
st->teaching_origin, st->update);
|
||||
chunk_appendf(&trash, "\n table:%p id=%s update=%u localupdate=%u"
|
||||
" commitupdate=%u refcnt=%u",
|
||||
t, t->id, t->update, t->localupdate, _HA_ATOMIC_LOAD(&t->commitupdate), t->refcnt);
|
||||
st->last_acked, st->last_pushed, st->last_get, st->teaching_origin, st->update);
|
||||
chunk_appendf(&trash, "\n table:%p id=%s update=%u localupdate=%u refcnt=%u",
|
||||
t, t->id, t->update, t->localupdate, t->refcnt);
|
||||
if (flags & PEERS_SHOW_F_DICT) {
|
||||
chunk_appendf(&trash, "\n TX dictionary cache:");
|
||||
count = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user