[Bug] PD KV keys share one namespace with TTL markers and locks, so the TTL cleanup deletes a client key named like a marker
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Read KvService.java, especially getKey, getTTLStoreKey, getLockKey, and clearTTLData, then inspect TaskScheduleService to understand when cleanup runs. The issue describes a reproducible case and possible approaches; first trace how entries are stored and scanned, then choose a fix that prevents client keys from being mistaken for TTL markers or locks. Done means the probe scenario preserves the client value after cleanup and the existing KV tests pass.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug Type (问题类型)
logic (逻辑设计问题)
Before submit
- I have confirmed and searched that there are no similar problems in the historical issue and documents
Environment (环境信息)
- Server Version: PD on
masteratebb8f4e17(1.8.0-SNAPSHOT), and #3382 at55ae8fee6 - Backend: PD's own RocksDB metadata store (the KV service), checked without raft as the
pd-core-testsuite runs it - OS: macOS, JDK 17.0.20.1
- Data Size: one key
Expected & Actual behavior (期望与实际表现)
A key that a client writes through the KV service should stay until the client deletes it or its TTL expires, whatever its name.
The KV service keeps three kinds of entries under the same store prefix K@ (KvService.java, lines 47 to 49 and getKey):
- client keys:
put("a/b", v)is stored asK@a/b; - TTL markers: a key put with a TTL gets
K@T@<expireAt>@<key>(getTTLStoreKey); - lock keys:
lock(key, ttl, clientId)putsL@<key>@<clientId>(getLockKey), stored asK@L@<key>@<clientId>.
Nothing stops a client key from having the shape of a marker or a lock. TaskScheduleService runs KvService.clearTTLData() every second on the leader; it scans [K@T@0@, K@T@<now>@) and handles every entry there as a marker. So a client key whose name starts with T@ and sorts below T@<now>@ is taken for a marker:
- On master,
clearTTLDataremoves every entry it scans (meta.remove(kv.getKey()), line 305), so such a client key is deleted within a second of being written. - With #3382, which fixes the cleanup's parse (#3378), an entry whose time is not a number, such as
T@123abc@foo, is skipped. One with a numeric time, such asT@1700000000000@foo, is still taken for a marker, and the cleanup removes it once it finds no value offoowith that expiry.
Measured on 2026-10-22 with JDK 17.0.20.1, with this test added to hg-pd-test's core package and mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-core-test -Dtest=KvNamespaceProbeTest, once at master ebb8f4e17 and once at #3382's 55ae8fee6:
KvService service = new KvService(getPdConfig());
service.put("T@1700000000000@foo", "ordinary");
Assert.assertEquals("ordinary", service.get("T@1700000000000@foo"));
service.clearTTLData();
Assert.assertEquals("ordinary", service.get("T@1700000000000@foo")); // fails on both
KvNamespaceProbeTest.testOrdinaryKeyShapedLikeAMarker:32 expected:<[ordinary]> but was:<[]>
The same holds the other way round for locks: a client key named L@<key>@<n> is read by locked(key) and owned(key, n) as a lock held by client n. That was not measured here.
Possible directions: keep markers and locks under store prefixes of their own (for example T@... and L@... next to K@..., not inside it), with a migration of the existing entries; or reject client keys that start with the reserved T@ and L@ names. Either would also let the cleanup trust that every entry it scans is a marker.
Vertex/Edge example (问题点 / 边数据举例)
N/A
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
N/A
- Lenguaje dominante
- Java
- Estrellas
- 3.2k
- Forks
- 640
- Merge medio
- 1 d 12 h
- PR fusionados (30 d)
- 98
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/hugegraph
-
[Bug] PD task REST: balanceLeaders throws a bare HTTP 500 during the balance-shard window, and task responses cannot be told apart from a no-op or a follower answerPosiblemente ocupada @pallavithegod la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
apache/hugegraph#3231 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
[Bug] PD TTL cleanup deletes the marker-shaped name instead of the expired key, so expired values stay in the store until readPosiblemente ocupada @bitflicker64 la tomó hace 2 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
[Task] Establish systematic performance baselines and optimization trackingPosiblemente ocupada @contrueCT la tomó hace 6 días. Abiertohelp wanted improvement rust
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
apache/hugegraph#3346 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
[Bug] CI accepts obsolete PR targets after retargeting or force-pushQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/hugegraph
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
checkstyle/checkstyle#22145 ·
Los mantenedores suelen responder en 1 día
-
rset command throws NPE in ResultsFormat.guessSyntaxPosiblemente ocupada @Ostrzyciel la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
enhancement good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
objectionary/eo#9593 ·
Los mantenedores suelen responder en 1 día
-
Incorrect doc for jwtConsumerAbiertorelease bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
OpenLiberty/open-liberty#36124 ·
Los mantenedores suelen responder en 1 día