Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(personhog): delete a tombstoned person only at or below a version bound (#111670)

Eli Reisman3e393f9e196c
diff --git a/nodejs/src/common/generated/personhog/personhog/service/v1/service_pb.ts b/nodejs/src/common/generated/personhog/personhog/service/v1/service_pb.ts
index 398d1217a609..3a2ba334af4a 100644
--- a/nodejs/src/common/generated/personhog/personhog/service/v1/service_pb.ts
+++ b/nodejs/src/common/generated/personhog/personhog/service/v1/service_pb.ts
@@ -505,8 +505,9 @@ export const PersonHogService: GenService<{
output: typeof DeletePersonsBatchForTeamResponseSchema
}
/**
- * Deletes only persons that are still tombstoned when the delete runs, a bounded
- * number of rows per call; pending uuids are sent again by the caller.
+ * Deletes only persons that are still tombstoned, and at or below their version bound when the
+ * request carries bounded_persons. Deletes a bounded number of rows per call; the caller resends
+ * pending uuids.
* WARNING: Same routing caveat as DeletePersons above.
*
* @generated from rpc personhog.service.v1.PersonHogService.DeleteTombstonedPersons
diff --git a/nodejs/src/common/generated/personhog/personhog/types/v1/person_pb.ts b/nodejs/src/common/generated/personhog/personhog/types/v1/person_pb.ts
index 529baaa889a5..1ca31015db98 100644
--- a/nodejs/src/common/generated/personhog/personhog/types/v1/person_pb.ts
+++ b/nodejs/src/common/generated/personhog/personhog/types/v1/person_pb.ts
@@ -13,7 +13,7 @@ import { file_personhog_types_v1_common } from './common_pb'
export const file_personhog_types_v1_person: GenFile =
/*@__PURE__*/
fileDesc(
- 'Ch9wZXJzb25ob2cvdHlwZXMvdjEvcGVyc29uLnByb3RvEhJwZXJzb25ob2cudHlwZXMudjEisgIKBlBlcnNvbhIKCgJpZBgBIAEoAxIMCgR1dWlkGAIgASgJEg8KB3RlYW1faWQYAyABKAMSEgoKcHJvcGVydGllcxgEIAEoDBIiChpwcm9wZXJ0aWVzX2xhc3R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udjEuU2VhbGVkU291cmNlU25hcHNob3QSEQoJZXZlbnRfc2V0GAQgASgMEhYKDmV2ZW50X3NldF9vbmNlGAUgASgMEg0KBW9wX2lkGAYgASgJIkgKGkZvbGRQZXJzb25Eb2N1bWVudFJlc3BvbnNlEioKBnBlcnNvbhgBIAEoCzIaLnBlcnNvbmhvZy50eXBlcy52MS5QZXJzb24qeQoRRGVsZXRlUGVyc29uc01vZGUSIwofREVMRVRFX1BFUlNPTlNfTU9ERV9VTlNQRUNJRklFRBAAEhwKGERFTEVURV9QRVJTT05TX01PREVfSEFSRBABEiEKHURFTEVURV9QRVJTT05TX01PREVfVE9NQlNUT05FEAIq5AEKE1ZlcnNpb25GbG9vck91dGNvbWUSJQohVkVSU0lPTl9GTE9PUl9PVVRDT01FX1VOU1BFQ0lGSUVEEAASLAooVkVSU0lPTl9GTE9PUl9PVVRDT01FX1RPTUJTVE9ORV9JTlNFUlRFRBABEioKJlZFUlNJT05fRkxPT1JfT1VUQ09NRV9UT01CU1RPTkVfUkFJU0VEEAISLAooVkVSU0lPTl9GTE9PUl9PVVRDT01FX1RPTUJTVE9ORV9BVF9GTE9PUhADEh4KGlZFUlNJT05fRkxPT1JfT1VUQ09NRV9MSVZFEAQqbwoPTGlmZWN5Y2xlT3BUeXBlEiEKHUxJRkVDWUNMRV9PUF9UWVBFX1VOU1BFQ0lGSUVEEAASHAoYTElGRUNZQ0xFX09QX1RZUEVfREVMRVRFEAESGwoXTElGRUNZQ0xFX09QX1RZUEVfTUVSR0UQAiptCg5SZWxlYXNlT3V0Y29tZRIfChtSRUxFQVNFX09VVENPTUVfVU5TUEVDSUZJRUQQABIdChlSRUxFQVNFX09VVENPTUVfQ09NTUlUVEVEEAESGwoXUkVMRUFTRV9PVVRDT01FX0FCT1JURUQQAmIGcHJvdG8z',
[file_personhog_types_v1_common]
)
@@ -1106,7 +1106,7 @@ export type DeleteTombstonedPersonsRequest = Message<'personhog.types.v1.DeleteT
teamId: bigint
/**
- * Person UUIDs to delete. Max 1000 per request.
+ * Person UUIDs to delete. Max 1000 per request. Leave empty when bounded_persons is set.
*
* @generated from field: repeated string person_uuids = 2;
*/
@@ -1119,6 +1119,15 @@ export type DeleteTombstonedPersonsRequest = Message<'personhog.types.v1.DeleteT
* @generated from field: int64 max_rows = 3;
*/
maxRows: bigint
+
+ /**
+ * Persons to delete, each with a version bound, in place of person_uuids. Max 1000 per request.
+ * A server that predates this field reads an empty person_uuids and deletes nothing, so the
+ * caller must check version_guard_applied on the response.
+ *
+ * @generated from field: repeated personhog.types.v1.VersionBoundedPerson bounded_persons = 4;
+ */
+ boundedPersons: VersionBoundedPerson[]
}
/**
@@ -1129,6 +1138,32 @@ export const DeleteTombstonedPersonsRequestSchema: GenMessage<DeleteTombstonedPe
/*@__PURE__*/
messageDesc(file_personhog_types_v1_person, 36)
+/**
+ * @generated from message personhog.types.v1.VersionBoundedPerson
+ */
+export type VersionBoundedPerson = Message<'personhog.types.v1.VersionBoundedPerson'> & {
+ /**
+ * @generated from field: string person_uuid = 1;
+ */
+ personUuid: string
+
+ /**
+ * The person is deleted only while its version is at or below this value. A person with a
+ * higher version was tombstoned again after the caller took the bound.
+ *
+ * @generated from field: int64 max_version = 2;
+ */
+ maxVersion: bigint
+}
+
+/**
+ * Describes the message personhog.types.v1.VersionBoundedPerson.
+ * Use `create(VersionBoundedPersonSchema)` to create a new message.
+ */
+export const VersionBoundedPersonSchema: GenMessage<VersionBoundedPerson> =
+ /*@__PURE__*/
+ messageDesc(file_personhog_types_v1_person, 37)
+
/**
* @generated from message personhog.types.v1.DeleteTombstonedPersonsResponse
*/
@@ -1170,6 +1205,21 @@ export type DeleteTombstonedPersonsResponse = Message<'personhog.types.v1.Delete
* @generated from field: int64 rows_deleted = 5;
*/
rowsDeleted: bigint
+
+ /**
+ * True when the request carried bounded_persons and the server checked every bound. Always
+ * false from a server that predates bounded_persons.
+ *
+ * @generated from field: bool version_guard_applied = 6;
+ */
+ versionGuardApplied: boolean
+
+ /**
+ * Persons still tombstoned but at a version above their bound. Nothing was deleted for them.
+ *
+ * @generated from field: int64 skipped_version_count = 7;
+ */
+ skippedVersionCount: bigint
}
/**
@@ -1178,7 +1228,7 @@ export type DeleteTombstonedPersonsResponse = Message<'personhog.types.v1.Delete
*/
export const DeleteTombstonedPersonsResponseSchema: GenMessage<DeleteTombstonedPersonsResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 37)
+ messageDesc(file_personhog_types_v1_person, 38)
/**
* SplitPersonRequest splits specific distinct_ids off of a person onto new persons.
@@ -1216,7 +1266,7 @@ export type SplitPersonRequest = Message<'personhog.types.v1.SplitPersonRequest'
*/
export const SplitPersonRequestSchema: GenMessage<SplitPersonRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 38)
+ messageDesc(file_personhog_types_v1_person, 39)
/**
* SplitResult describes a single distinct_id that was split onto a new person.
@@ -1258,7 +1308,7 @@ export type SplitResult = Message<'personhog.types.v1.SplitResult'> & {
* Describes the message personhog.types.v1.SplitResult.
* Use `create(SplitResultSchema)` to create a new message.
*/
-export const SplitResultSchema: GenMessage<SplitResult> = /*@__PURE__*/ messageDesc(file_personhog_types_v1_person, 39)
+export const SplitResultSchema: GenMessage<SplitResult> = /*@__PURE__*/ messageDesc(file_personhog_types_v1_person, 40)
/**
* @generated from message personhog.types.v1.SplitPersonResponse
@@ -1278,7 +1328,7 @@ export type SplitPersonResponse = Message<'personhog.types.v1.SplitPersonRespons
*/
export const SplitPersonResponseSchema: GenMessage<SplitPersonResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 40)
+ messageDesc(file_personhog_types_v1_person, 41)
/**
* SetPersonDistinctIdVersionFloorRequest bumps a person_distinct_id row's version.
@@ -1315,7 +1365,7 @@ export type SetPersonDistinctIdVersionFloorRequest =
*/
export const SetPersonDistinctIdVersionFloorRequestSchema: GenMessage<SetPersonDistinctIdVersionFloorRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 41)
+ messageDesc(file_personhog_types_v1_person, 42)
/**
* @generated from message personhog.types.v1.SetPersonDistinctIdVersionFloorResponse
@@ -1338,7 +1388,7 @@ export type SetPersonDistinctIdVersionFloorResponse =
*/
export const SetPersonDistinctIdVersionFloorResponseSchema: GenMessage<SetPersonDistinctIdVersionFloorResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 42)
+ messageDesc(file_personhog_types_v1_person, 43)
/**
* SetPersonVersionFloorRequest bumps a person's version. Used by the undelete repair
@@ -1373,7 +1423,7 @@ export type SetPersonVersionFloorRequest = Message<'personhog.types.v1.SetPerson
*/
export const SetPersonVersionFloorRequestSchema: GenMessage<SetPersonVersionFloorRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 43)
+ messageDesc(file_personhog_types_v1_person, 44)
/**
* @generated from message personhog.types.v1.SetPersonVersionFloorResponse
@@ -1393,7 +1443,7 @@ export type SetPersonVersionFloorResponse = Message<'personhog.types.v1.SetPerso
*/
export const SetPersonVersionFloorResponseSchema: GenMessage<SetPersonVersionFloorResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 44)
+ messageDesc(file_personhog_types_v1_person, 45)
/**
* @generated from message personhog.types.v1.PersonVersionFloor
@@ -1416,7 +1466,7 @@ export type PersonVersionFloor = Message<'personhog.types.v1.PersonVersionFloor'
*/
export const PersonVersionFloorSchema: GenMessage<PersonVersionFloor> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 45)
+ messageDesc(file_personhog_types_v1_person, 46)
/**
* EnsurePersonVersionFloorsRequest raises each person tombstone to at least min_version in one transaction,
@@ -1446,7 +1496,7 @@ export type EnsurePersonVersionFloorsRequest = Message<'personhog.types.v1.Ensur
*/
export const EnsurePersonVersionFloorsRequestSchema: GenMessage<EnsurePersonVersionFloorsRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 46)
+ messageDesc(file_personhog_types_v1_person, 47)
/**
* @generated from message personhog.types.v1.PersonVersionFloorResult
@@ -1476,7 +1526,7 @@ export type PersonVersionFloorResult = Message<'personhog.types.v1.PersonVersion
*/
export const PersonVersionFloorResultSchema: GenMessage<PersonVersionFloorResult> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 47)
+ messageDesc(file_personhog_types_v1_person, 48)
/**
* @generated from message personhog.types.v1.EnsurePersonVersionFloorsResponse
@@ -1496,7 +1546,7 @@ export type EnsurePersonVersionFloorsResponse = Message<'personhog.types.v1.Ensu
*/
export const EnsurePersonVersionFloorsResponseSchema: GenMessage<EnsurePersonVersionFloorsResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 48)
+ messageDesc(file_personhog_types_v1_person, 49)
/**
* FencePersonRequest freezes a person for a lifecycle operation (see
@@ -1533,7 +1583,7 @@ export type FencePersonRequest = Message<'personhog.types.v1.FencePersonRequest'
*/
export const FencePersonRequestSchema: GenMessage<FencePersonRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 49)
+ messageDesc(file_personhog_types_v1_person, 50)
/**
* @generated from message personhog.types.v1.FencePersonResponse
@@ -1562,7 +1612,7 @@ export type FencePersonResponse = Message<'personhog.types.v1.FencePersonRespons
*/
export const FencePersonResponseSchema: GenMessage<FencePersonResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 50)
+ messageDesc(file_personhog_types_v1_person, 51)
/**
* FencePersonsRequest freezes many persons of one op in one call (see
@@ -1599,7 +1649,7 @@ export type FencePersonsRequest = Message<'personhog.types.v1.FencePersonsReques
*/
export const FencePersonsRequestSchema: GenMessage<FencePersonsRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 51)
+ messageDesc(file_personhog_types_v1_person, 52)
/**
* Every requested person id lands in exactly one of the two lists; a
@@ -1633,7 +1683,7 @@ export type FencePersonsResponse = Message<'personhog.types.v1.FencePersonsRespo
*/
export const FencePersonsResponseSchema: GenMessage<FencePersonsResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 52)
+ messageDesc(file_personhog_types_v1_person, 53)
/**
* @generated from message personhog.types.v1.FencedPersonSeal
@@ -1666,7 +1716,7 @@ export type FencedPersonSeal = Message<'personhog.types.v1.FencedPersonSeal'> &
*/
export const FencedPersonSealSchema: GenMessage<FencedPersonSeal> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 53)
+ messageDesc(file_personhog_types_v1_person, 54)
/**
* ReleaseFenceRequest closes a fence (see PersonHogLeader.ReleaseFence).
@@ -1734,7 +1784,7 @@ export type ReleaseFenceRequest = Message<'personhog.types.v1.ReleaseFenceReques
*/
export const ReleaseFenceRequestSchema: GenMessage<ReleaseFenceRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 54)
+ messageDesc(file_personhog_types_v1_person, 55)
/**
* @generated from message personhog.types.v1.ReleaseFenceResponse
@@ -1747,7 +1797,7 @@ export type ReleaseFenceResponse = Message<'personhog.types.v1.ReleaseFenceRespo
*/
export const ReleaseFenceResponseSchema: GenMessage<ReleaseFenceResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 55)
+ messageDesc(file_personhog_types_v1_person, 56)
/**
* ReleaseFencesRequest closes many fences of one op in one call (see
@@ -1784,7 +1834,7 @@ export type ReleaseFencesRequest = Message<'personhog.types.v1.ReleaseFencesRequ
*/
export const ReleaseFencesRequestSchema: GenMessage<ReleaseFencesRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 56)
+ messageDesc(file_personhog_types_v1_person, 57)
/**
* @generated from message personhog.types.v1.ReleaseFenceItem
@@ -1821,7 +1871,7 @@ export type ReleaseFenceItem = Message<'personhog.types.v1.ReleaseFenceItem'> &
*/
export const ReleaseFenceItemSchema: GenMessage<ReleaseFenceItem> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 57)
+ messageDesc(file_personhog_types_v1_person, 58)
/**
* @generated from message personhog.types.v1.ReleaseFencesResponse
@@ -1834,7 +1884,7 @@ export type ReleaseFencesResponse = Message<'personhog.types.v1.ReleaseFencesRes
*/
export const ReleaseFencesResponseSchema: GenMessage<ReleaseFencesResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 58)
+ messageDesc(file_personhog_types_v1_person, 59)
/**
* A sealed source snapshot paired with its precedence ordinal — the
@@ -1862,7 +1912,7 @@ export type SealedSourceSnapshot = Message<'personhog.types.v1.SealedSourceSnaps
*/
export const SealedSourceSnapshotSchema: GenMessage<SealedSourceSnapshot> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 59)
+ messageDesc(file_personhog_types_v1_person, 60)
/**
* FoldPersonDocumentRequest folds sealed source snapshots into the merge
@@ -1938,7 +1988,7 @@ export type FoldPersonDocumentRequest = Message<'personhog.types.v1.FoldPersonDo
*/
export const FoldPersonDocumentRequestSchema: GenMessage<FoldPersonDocumentRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 60)
+ messageDesc(file_personhog_types_v1_person, 61)
/**
* @generated from message personhog.types.v1.FoldPersonDocumentResponse
@@ -1966,7 +2016,7 @@ export type FoldPersonDocumentResponse = Message<'personhog.types.v1.FoldPersonD
*/
export const FoldPersonDocumentResponseSchema: GenMessage<FoldPersonDocumentResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 61)
+ messageDesc(file_personhog_types_v1_person, 62)
/**
* How DeletePersons removes the rows.
diff --git a/packages/personhog-proto/personhog/service/v1/service_pb2_grpc.py b/packages/personhog-proto/personhog/service/v1/service_pb2_grpc.py
index df74fe81105a..ff87d99316e3 100644
--- a/packages/personhog-proto/personhog/service/v1/service_pb2_grpc.py
+++ b/packages/personhog-proto/personhog/service/v1/service_pb2_grpc.py
@@ -613,8 +613,9 @@ class PersonHogServiceServicer:
raise NotImplementedError("Method not implemented!")
def DeleteTombstonedPersons(self, request, context):
- """Deletes only persons that are still tombstoned when the delete runs, a bounded
- number of rows per call; pending uuids are sent again by the caller.
+ """Deletes only persons that are still tombstoned, and at or below their version bound when the
+ request carries bounded_persons. Deletes a bounded number of rows per call; the caller resends
+ pending uuids.
WARNING: Same routing caveat as DeletePersons above.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
diff --git a/packages/personhog-proto/personhog/types/v1/person_pb2.py b/packages/personhog-proto/personhog/types/v1/person_pb2.py
index 707965913f7d..3ea25edf84fa 100644
--- a/packages/personhog-proto/personhog/types/v1/person_pb2.py
+++ b/packages/personhog-proto/personhog/types/v1/person_pb2.py
@@ -23,7 +23,7 @@ _sym_db = _symbol_database.Default()
from personhog.types.v1 import common_pb2 as personhog_dot_types_dot_v1_dot_common__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
- b'\n\x1fpersonhog/types/v1/person.proto\x12\x12personhog.types.v1\x1a\x1fpersonhog/types/v1/common.proto"\xb2\x02\n\x06Person\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04uuid\x18\x02 \x01(\t\x12\x0f\n\x07team_id\x18\x03 \x01(\x03\x12\x12\n\nproperties\x18\x04 \x01(\x0c\x12"\n\x1aproperties_last_updated_at\x18\x05 \x01(\x0c\x12!\n\x19properties_last_operation\x18\x06 \x01(\x0c\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x12\x0f\n\x07version\x18\x08 \x01(\x03\x12\x15\n\ris_identified\x18\t \x01(\x08\x12\x17\n\nis_user_id\x18\n \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0clast_seen_at\x18\x0b \x01(\x03H\x01\x88\x01\x01\x12\x12\n\nis_deleted\x18\x0c \x01(\x08\x42\r\n\x0b_is_user_idB\x0f\n\r_last_seen_at"f\n\x15\x44istinctIdWithVersion\x12\x13\n\x0b\x64istinct_id\x18\x01 \x01(\t\x12\x14\n\x07version\x18\x02 \x01(\x03H\x00\x88\x01\x01\x12\x0f\n\x02id\x18\x03 \x01(\x03H\x01\x88\x01\x01\x42\n\n\x08_versionB\x05\n\x03_id"h\n\x15PersonWithDistinctIds\x12\x13\n\x0b\x64istinct_id\x18\x01 \x01(\t\x12/\n\x06person\x18\x02 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x42\t\n\x07_person"g\n\x11PersonDistinctIds\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12?\n\x0c\x64istinct_ids\x18\x02 \x03(\x0b\x32).personhog.types.v1.DistinctIdWithVersion"\x87\x01\n\x18PersonWithTeamDistinctId\x12/\n\x03key\x18\x01 \x01(\x0b\x32".personhog.types.v1.TeamDistinctId\x12/\n\x06person\x18\x02 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x42\t\n\x07_person"m\n\x10GetPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"O\n\x11GetPersonResponse\x12/\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x42\t\n\x07_person"o\n\x11GetPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"S\n\x0fPersonsResponse\x12+\n\x07persons\x18\x01 \x03(\x0b\x32\x1a.personhog.types.v1.Person\x12\x13\n\x0bmissing_ids\x18\x02 \x03(\x03"n\n\x16GetPersonByUuidRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x0c\n\x04uuid\x18\x02 \x01(\t\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"q\n\x18GetPersonsByUuidsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\r\n\x05uuids\x18\x02 \x03(\t\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"{\n\x1cGetPersonByDistinctIdRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0b\x64istinct_id\x18\x02 \x01(\t\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"\x84\x01\n$GetPersonsByDistinctIdsInTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0c\x64istinct_ids\x18\x02 \x03(\t\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"`\n"PersonsByDistinctIdsInTeamResponse\x12:\n\x07results\x18\x01 \x03(\x0b\x32).personhog.types.v1.PersonWithDistinctIds"\x96\x01\n\x1eGetPersonsByDistinctIdsRequest\x12=\n\x11team_distinct_ids\x18\x01 \x03(\x0b\x32".personhog.types.v1.TeamDistinctId\x12\x35\n\x0cread_options\x18\x02 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"]\n\x1cPersonsByDistinctIdsResponse\x12=\n\x07results\x18\x01 \x03(\x0b\x32,.personhog.types.v1.PersonWithTeamDistinctId"\xbf\x01\n\x1eGetDistinctIdsForPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions\x12\x12\n\x05limit\x18\x04 \x01(\x03H\x00\x88\x01\x01\x12\x16\n\tcursor_id\x18\x05 \x01(\x03H\x01\x88\x01\x01\x42\x08\n\x06_limitB\x0c\n\n_cursor_id"\x92\x01\n\x1fGetDistinctIdsForPersonResponse\x12?\n\x0c\x64istinct_ids\x18\x01 \x03(\x0b\x32).personhog.types.v1.DistinctIdWithVersion\x12\x1b\n\x0enext_cursor_id\x18\x02 \x01(\x03H\x00\x88\x01\x01\x42\x11\n\x0f_next_cursor_id"\xb1\x01\n\x1fGetDistinctIdsForPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions\x12\x1d\n\x10limit_per_person\x18\x04 \x01(\x03H\x00\x88\x01\x01\x42\x13\n\x11_limit_per_person"f\n GetDistinctIdsForPersonsResponse\x12\x42\n\x13person_distinct_ids\x18\x01 \x03(\x0b\x32%.personhog.types.v1.PersonDistinctIds"\x96\x02\n\x1dUpdatePersonPropertiesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x12\n\nevent_name\x18\x03 \x01(\t\x12\x16\n\x0eset_properties\x18\x04 \x01(\x0c\x12\x1b\n\x13set_once_properties\x18\x05 \x01(\x0c\x12\x18\n\x10unset_properties\x18\x06 \x03(\t\x12\x1a\n\ris_identified\x18\x07 \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0clast_seen_at\x18\x08 \x01(\x03H\x01\x88\x01\x01\x12\x14\n\x0c\x66orce_update\x18\t \x01(\x08\x42\x10\n\x0e_is_identifiedB\x0f\n\r_last_seen_at"m\n\x1eUpdatePersonPropertiesResponse\x12/\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x12\x0f\n\x07updated\x18\x02 \x01(\x08\x42\t\n\x07_person"r\n\x14\x44\x65letePersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t\x12\x33\n\x04mode\x18\x03 \x01(\x0e\x32%.personhog.types.v1.DeletePersonsMode"<\n\x14TombstonedDistinctId\x12\x13\n\x0b\x64istinct_id\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x03"x\n\x10TombstonedPerson\x12\x13\n\x0bperson_uuid\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x03\x12>\n\x0c\x64istinct_ids\x18\x03 \x03(\x0b\x32(.personhog.types.v1.TombstonedDistinctId"|\n\x15\x44\x65letePersonsResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03\x12\x12\n\ntombstoned\x18\x02 \x01(\x08\x12\x38\n\ntombstones\x18\x03 \x03(\x0b\x32$.personhog.types.v1.TombstonedPerson"C\n\x1aGetPersonTombstonesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t"W\n\x1bGetPersonTombstonesResponse\x12\x38\n\ntombstones\x18\x01 \x03(\x0b\x32$.personhog.types.v1.TombstonedPerson"<\n\x14\x41\x63kedPersonTombstone\x12\x13\n\x0bperson_uuid\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x03"k\n\x1a\x41\x63kPersonTombstonesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12<\n\ntombstones\x18\x02 \x03(\x0b\x32(.personhog.types.v1.AckedPersonTombstone"4\n\x1b\x41\x63kPersonTombstonesResponse\x12\x15\n\rcleared_count\x18\x01 \x01(\x03"\x84\x01\n\x1fListPersonTombstoneQueueRequest\x12\x15\n\rafter_team_id\x18\x01 \x01(\x03\x12\x19\n\x11\x61\x66ter_person_uuid\x18\x02 \x01(\t\x12\r\n\x05limit\x18\x03 \x01(\x03\x12\x14\n\x07team_id\x18\x04 \x01(\x03H\x00\x88\x01\x01\x42\n\n\x08_team_id"p\n\x19PersonTombstoneQueueEntry\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bperson_uuid\x18\x02 \x01(\t\x12\x16\n\x0eperson_version\x18\x03 \x01(\x03\x12\x15\n\rtombstoned_at\x18\x04 \x01(\x03"b\n ListPersonTombstoneQueueResponse\x12>\n\x07\x65ntries\x18\x01 \x03(\x0b\x32-.personhog.types.v1.PersonTombstoneQueueEntry"G\n DeletePersonsBatchForTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nbatch_size\x18\x02 \x01(\x03":\n!DeletePersonsBatchForTeamResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03"Y\n\x1e\x44\x65leteTombstonedPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t\x12\x10\n\x08max_rows\x18\x03 \x01(\x03"\xa6\x01\n\x1f\x44\x65leteTombstonedPersonsResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03\x12\x1a\n\x12skipped_live_count\x18\x02 \x01(\x03\x12\x1c\n\x14\x62locked_person_uuids\x18\x03 \x03(\t\x12\x1c\n\x14pending_person_uuids\x18\x04 \x03(\t\x12\x14\n\x0crows_deleted\x18\x05 \x01(\x03"W\n\x12SplitPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x1d\n\x15\x64istinct_ids_to_split\x18\x03 \x03(\t"\x8e\x01\n\x0bSplitResult\x12\x13\n\x0b\x64istinct_id\x18\x01 \x01(\t\x12\x17\n\x0fnew_person_uuid\x18\x02 \x01(\t\x12\x1a\n\x12new_person_version\x18\x03 \x01(\x03\x12\x13\n\x0bpdi_version\x18\x04 \x01(\x03\x12 \n\x18new_person_created_at_ms\x18\x05 \x01(\x03"F\n\x13SplitPersonResponse\x12/\n\x06splits\x18\x01 \x03(\x0b\x32\x1f.personhog.types.v1.SplitResult"c\n&SetPersonDistinctIdVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0b\x64istinct_id\x18\x02 \x01(\t\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"e\n\'SetPersonDistinctIdVersionFloorResponse\x12/\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x42\t\n\x07_person"W\n\x1cSetPersonVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"0\n\x1dSetPersonVersionFloorResponse\x12\x0f\n\x07updated\x18\x01 \x01(\x08">\n\x12PersonVersionFloor\x12\x13\n\x0bperson_uuid\x18\x01 \x01(\t\x12\x13\n\x0bmin_version\x18\x02 \x01(\x03"k\n EnsurePersonVersionFloorsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x36\n\x06\x66loors\x18\x02 \x03(\x0b\x32&.personhog.types.v1.PersonVersionFloor"z\n\x18PersonVersionFloorResult\x12\x13\n\x0bperson_uuid\x18\x01 \x01(\t\x12\x38\n\x07outcome\x18\x02 \x01(\x0e\x32\'.personhog.types.v1.VersionFloorOutcome\x12\x0f\n\x07version\x18\x03 \x01(\x03"b\n!EnsurePersonVersionFloorsResponse\x12=\n\x07results\x18\x01 \x03(\x0b\x32,.personhog.types.v1.PersonVersionFloorResult"}\n\x12\x46\x65ncePersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\r\n\x05op_id\x18\x03 \x01(\t\x12\x34\n\x07op_type\x18\x04 \x01(\x0e\x32#.personhog.types.v1.LifecycleOpType"A\n\x13\x46\x65ncePersonResponse\x12*\n\x06sealed\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.Person"\x7f\n\x13\x46\x65ncePersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\r\n\x05op_id\x18\x02 \x01(\t\x12\x34\n\x07op_type\x18\x03 \x01(\x0e\x32#.personhog.types.v1.LifecycleOpType\x12\x12\n\nperson_ids\x18\x04 \x03(\x03"_\n\x14\x46\x65ncePersonsResponse\x12\x34\n\x06sealed\x18\x01 \x03(\x0b\x32$.personhog.types.v1.FencedPersonSeal\x12\x11\n\tnot_found\x18\x02 \x03(\x03"J\n\x10\x46\x65ncedPersonSeal\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12\x0f\n\x07version\x18\x02 \x01(\x03\x12\x12\n\ncreated_at\x18\x03 \x01(\x03"\xd6\x01\n\x13ReleaseFenceRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x13\n\x0bperson_uuid\x18\x03 \x01(\t\x12\r\n\x05op_id\x18\x04 \x01(\t\x12\x33\n\x07outcome\x18\x05 \x01(\x0e\x32".personhog.types.v1.ReleaseOutcome\x12\x1b\n\x0esealed_version\x18\x06 \x01(\x03H\x00\x88\x01\x01\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x42\x11\n\x0f_sealed_version"\x16\n\x14ReleaseFenceResponse"\xa2\x01\n\x14ReleaseFencesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\r\n\x05op_id\x18\x02 \x01(\t\x12\x33\n\x07outcome\x18\x03 \x01(\x0e\x32".personhog.types.v1.ReleaseOutcome\x12\x35\n\x07persons\x18\x04 \x03(\x0b\x32$.personhog.types.v1.ReleaseFenceItem"~\n\x10ReleaseFenceItem\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12\x13\n\x0bperson_uuid\x18\x02 \x01(\t\x12\x1b\n\x0esealed_version\x18\x03 \x01(\x03H\x00\x88\x01\x01\x12\x12\n\ncreated_at\x18\x04 \x01(\x03\x42\x11\n\x0f_sealed_version"\x17\n\x15ReleaseFencesResponse"S\n\x14SealedSourceSnapshot\x12*\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.Person\x12\x0f\n\x07ordinal\x18\x02 \x01(\x05"\xbd\x01\n\x19\x46oldPersonDocumentRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x42\n\x10sealed_snapshots\x18\x03 \x03(\x0b\x32(.personhog.types.v1.SealedSourceSnapshot\x12\x11\n\tevent_set\x18\x04 \x01(\x0c\x12\x16\n\x0e\x65vent_set_once\x18\x05 \x01(\x0c\x12\r\n\x05op_id\x18\x06 \x01(\t"H\n\x1a\x46oldPersonDocumentResponse\x12*\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.Person*y\n\x11\x44\x65letePersonsMode\x12#\n\x1f\x44\x45LETE_PERSONS_MODE_UNSPECIFIED\x10\x00\x12\x1c\n\x18\x44\x45LETE_PERSONS_MODE_HARD\x10\x01\x12!\n\x1d\x44\x45LETE_PERSONS_MODE_TOMBSTONE\x10\x02*\xe4\x01\n\x13VersionFloorOutcome\x12%\n!VERSION_FLOOR_OUTCOME_UNSPECIFIED\x10\x00\x12,\n(VERSION_FLOOR_OUTCOME_TOMBSTONE_INSERTED\x10\x01\x12*\n&VERSION_FLOOR_OUTCOME_TOMBSTONE_RAISED\x10\x02\x12,\n(VERSION_FLOOR_OUTCOME_TOMBSTONE_AT_FLOOR\x10\x03\x12\x1e\n\x1aVERSION_FLOOR_OUTCOME_LIVE\x10\x04*o\n\x0fLifecycleOpType\x12!\n\x1dLIFECYCLE_OP_TYPE_UNSPECIFIED\x10\x00\x12\x1c\n\x18LIFECYCLE_OP_TYPE_DELETE\x10\x01\x12\x1b\n\x17LIFECYCLE_OP_TYPE_MERGE\x10\x02*m\n\x0eReleaseOutcome\x12\x1f\n\x1bRELEASE_OUTCOME_UNSPECIFIED\x10\x00\x12\x1d\n\x19RELEASE_OUTCOME_COMMITTED\x10\x01\x12\x1b\n\x17RELEASE_OUTCOME_ABORTED\x10\x02\x62\x06proto3'
+ b'\n\x1fpersonhog/types/v1/person.proto\x12\x12personhog.types.v1\x1a\x1fpersonhog/types/v1/common.proto"\xb2\x02\n\x06Person\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04uuid\x18\x02 \x01(\t\x12\x0f\n\x07team_id\x18\x03 \x01(\x03\x12\x12\n\nproperties\x18\x04 \x01(\x0c\x12"\n\x1aproperties_last_updated_at\x18\x05 \x01(\x0c\x12!\n\x19properties_last_operation\x18\x06 \x01(\x0c\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x12\x0f\n\x07version\x18\x08 \x01(\x03\x12\x15\n\ris_identified\x18\t \x01(\x08\x12\x17\n\nis_user_id\x18\n \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0clast_seen_at\x18\x0b \x01(\x03H\x01\x88\x01\x01\x12\x12\n\nis_deleted\x18\x0c \x01(\x08\x42\r\n\x0b_is_user_idB\x0f\n\r_last_seen_at"f\n\x15\x44istinctIdWithVersion\x12\x13\n\x0b\x64istinct_id\x18\x01 \x01(\t\x12\x14\n\x07version\x18\x02 \x01(\x03H\x00\x88\x01\x01\x12\x0f\n\x02id\x18\x03 \x01(\x03H\x01\x88\x01\x01\x42\n\n\x08_versionB\x05\n\x03_id"h\n\x15PersonWithDistinctIds\x12\x13\n\x0b\x64istinct_id\x18\x01 \x01(\t\x12/\n\x06person\x18\x02 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x42\t\n\x07_person"g\n\x11PersonDistinctIds\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12?\n\x0c\x64istinct_ids\x18\x02 \x03(\x0b\x32).personhog.types.v1.DistinctIdWithVersion"\x87\x01\n\x18PersonWithTeamDistinctId\x12/\n\x03key\x18\x01 \x01(\x0b\x32".personhog.types.v1.TeamDistinctId\x12/\n\x06person\x18\x02 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x42\t\n\x07_person"m\n\x10GetPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"O\n\x11GetPersonResponse\x12/\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x42\t\n\x07_person"o\n\x11GetPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"S\n\x0fPersonsResponse\x12+\n\x07persons\x18\x01 \x03(\x0b\x32\x1a.personhog.types.v1.Person\x12\x13\n\x0bmissing_ids\x18\x02 \x03(\x03"n\n\x16GetPersonByUuidRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x0c\n\x04uuid\x18\x02 \x01(\t\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"q\n\x18GetPersonsByUuidsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\r\n\x05uuids\x18\x02 \x03(\t\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"{\n\x1cGetPersonByDistinctIdRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0b\x64istinct_id\x18\x02 \x01(\t\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"\x84\x01\n$GetPersonsByDistinctIdsInTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0c\x64istinct_ids\x18\x02 \x03(\t\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"`\n"PersonsByDistinctIdsInTeamResponse\x12:\n\x07results\x18\x01 \x03(\x0b\x32).personhog.types.v1.PersonWithDistinctIds"\x96\x01\n\x1eGetPersonsByDistinctIdsRequest\x12=\n\x11team_distinct_ids\x18\x01 \x03(\x0b\x32".personhog.types.v1.TeamDistinctId\x12\x35\n\x0cread_options\x18\x02 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions"]\n\x1cPersonsByDistinctIdsResponse\x12=\n\x07results\x18\x01 \x03(\x0b\x32,.personhog.types.v1.PersonWithTeamDistinctId"\xbf\x01\n\x1eGetDistinctIdsForPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions\x12\x12\n\x05limit\x18\x04 \x01(\x03H\x00\x88\x01\x01\x12\x16\n\tcursor_id\x18\x05 \x01(\x03H\x01\x88\x01\x01\x42\x08\n\x06_limitB\x0c\n\n_cursor_id"\x92\x01\n\x1fGetDistinctIdsForPersonResponse\x12?\n\x0c\x64istinct_ids\x18\x01 \x03(\x0b\x32).personhog.types.v1.DistinctIdWithVersion\x12\x1b\n\x0enext_cursor_id\x18\x02 \x01(\x03H\x00\x88\x01\x01\x42\x11\n\x0f_next_cursor_id"\xb1\x01\n\x1fGetDistinctIdsForPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x12\x35\n\x0cread_options\x18\x03 \x01(\x0b\x32\x1f.personhog.types.v1.ReadOptions\x12\x1d\n\x10limit_per_person\x18\x04 \x01(\x03H\x00\x88\x01\x01\x42\x13\n\x11_limit_per_person"f\n GetDistinctIdsForPersonsResponse\x12\x42\n\x13person_distinct_ids\x18\x01 \x03(\x0b\x32%.personhog.types.v1.PersonDistinctIds"\x96\x02\n\x1dUpdatePersonPropertiesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x12\n\nevent_name\x18\x03 \x01(\t\x12\x16\n\x0eset_properties\x18\x04 \x01(\x0c\x12\x1b\n\x13set_once_properties\x18\x05 \x01(\x0c\x12\x18\n\x10unset_properties\x18\x06 \x03(\t\x12\x1a\n\ris_identified\x18\x07 \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0clast_seen_at\x18\x08 \x01(\x03H\x01\x88\x01\x01\x12\x14\n\x0c\x66orce_update\x18\t \x01(\x08\x42\x10\n\x0e_is_identifiedB\x0f\n\r_last_seen_at"m\n\x1eUpdatePersonPropertiesResponse\x12/\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x12\x0f\n\x07updated\x18\x02 \x01(\x08\x42\t\n\x07_person"r\n\x14\x44\x65letePersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t\x12\x33\n\x04mode\x18\x03 \x01(\x0e\x32%.personhog.types.v1.DeletePersonsMode"<\n\x14TombstonedDistinctId\x12\x13\n\x0b\x64istinct_id\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x03"x\n\x10TombstonedPerson\x12\x13\n\x0bperson_uuid\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x03\x12>\n\x0c\x64istinct_ids\x18\x03 \x03(\x0b\x32(.personhog.types.v1.TombstonedDistinctId"|\n\x15\x44\x65letePersonsResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03\x12\x12\n\ntombstoned\x18\x02 \x01(\x08\x12\x38\n\ntombstones\x18\x03 \x03(\x0b\x32$.personhog.types.v1.TombstonedPerson"C\n\x1aGetPersonTombstonesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t"W\n\x1bGetPersonTombstonesResponse\x12\x38\n\ntombstones\x18\x01 \x03(\x0b\x32$.personhog.types.v1.TombstonedPerson"<\n\x14\x41\x63kedPersonTombstone\x12\x13\n\x0bperson_uuid\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x03"k\n\x1a\x41\x63kPersonTombstonesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12<\n\ntombstones\x18\x02 \x03(\x0b\x32(.personhog.types.v1.AckedPersonTombstone"4\n\x1b\x41\x63kPersonTombstonesResponse\x12\x15\n\rcleared_count\x18\x01 \x01(\x03"\x84\x01\n\x1fListPersonTombstoneQueueRequest\x12\x15\n\rafter_team_id\x18\x01 \x01(\x03\x12\x19\n\x11\x61\x66ter_person_uuid\x18\x02 \x01(\t\x12\r\n\x05limit\x18\x03 \x01(\x03\x12\x14\n\x07team_id\x18\x04 \x01(\x03H\x00\x88\x01\x01\x42\n\n\x08_team_id"p\n\x19PersonTombstoneQueueEntry\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bperson_uuid\x18\x02 \x01(\t\x12\x16\n\x0eperson_version\x18\x03 \x01(\x03\x12\x15\n\rtombstoned_at\x18\x04 \x01(\x03"b\n ListPersonTombstoneQueueResponse\x12>\n\x07\x65ntries\x18\x01 \x03(\x0b\x32-.personhog.types.v1.PersonTombstoneQueueEntry"G\n DeletePersonsBatchForTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nbatch_size\x18\x02 \x01(\x03":\n!DeletePersonsBatchForTeamResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03"\x9c\x01\n\x1e\x44\x65leteTombstonedPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t\x12\x10\n\x08max_rows\x18\x03 \x01(\x03\x12\x41\n\x0f\x62ounded_persons\x18\x04 \x03(\x0b\x32(.personhog.types.v1.VersionBoundedPerson"@\n\x14VersionBoundedPerson\x12\x13\n\x0bperson_uuid\x18\x01 \x01(\t\x12\x13\n\x0bmax_version\x18\x02 \x01(\x03"\xe4\x01\n\x1f\x44\x65leteTombstonedPersonsResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03\x12\x1a\n\x12skipped_live_count\x18\x02 \x01(\x03\x12\x1c\n\x14\x62locked_person_uuids\x18\x03 \x03(\t\x12\x1c\n\x14pending_person_uuids\x18\x04 \x03(\t\x12\x14\n\x0crows_deleted\x18\x05 \x01(\x03\x12\x1d\n\x15version_guard_applied\x18\x06 \x01(\x08\x12\x1d\n\x15skipped_version_count\x18\x07 \x01(\x03"W\n\x12SplitPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x1d\n\x15\x64istinct_ids_to_split\x18\x03 \x03(\t"\x8e\x01\n\x0bSplitResult\x12\x13\n\x0b\x64istinct_id\x18\x01 \x01(\t\x12\x17\n\x0fnew_person_uuid\x18\x02 \x01(\t\x12\x1a\n\x12new_person_version\x18\x03 \x01(\x03\x12\x13\n\x0bpdi_version\x18\x04 \x01(\x03\x12 \n\x18new_person_created_at_ms\x18\x05 \x01(\x03"F\n\x13SplitPersonResponse\x12/\n\x06splits\x18\x01 \x03(\x0b\x32\x1f.personhog.types.v1.SplitResult"c\n&SetPersonDistinctIdVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0b\x64istinct_id\x18\x02 \x01(\t\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"e\n\'SetPersonDistinctIdVersionFloorResponse\x12/\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x42\t\n\x07_person"W\n\x1cSetPersonVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"0\n\x1dSetPersonVersionFloorResponse\x12\x0f\n\x07updated\x18\x01 \x01(\x08">\n\x12PersonVersionFloor\x12\x13\n\x0bperson_uuid\x18\x01 \x01(\t\x12\x13\n\x0bmin_version\x18\x02 \x01(\x03"k\n EnsurePersonVersionFloorsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x36\n\x06\x66loors\x18\x02 \x03(\x0b\x32&.personhog.types.v1.PersonVersionFloor"z\n\x18PersonVersionFloorResult\x12\x13\n\x0bperson_uuid\x18\x01 \x01(\t\x12\x38\n\x07outcome\x18\x02 \x01(\x0e\x32\'.personhog.types.v1.VersionFloorOutcome\x12\x0f\n\x07version\x18\x03 \x01(\x03"b\n!EnsurePersonVersionFloorsResponse\x12=\n\x07results\x18\x01 \x03(\x0b\x32,.personhog.types.v1.PersonVersionFloorResult"}\n\x12\x46\x65ncePersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\r\n\x05op_id\x18\x03 \x01(\t\x12\x34\n\x07op_type\x18\x04 \x01(\x0e\x32#.personhog.types.v1.LifecycleOpType"A\n\x13\x46\x65ncePersonResponse\x12*\n\x06sealed\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.Person"\x7f\n\x13\x46\x65ncePersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\r\n\x05op_id\x18\x02 \x01(\t\x12\x34\n\x07op_type\x18\x03 \x01(\x0e\x32#.personhog.types.v1.LifecycleOpType\x12\x12\n\nperson_ids\x18\x04 \x03(\x03"_\n\x14\x46\x65ncePersonsResponse\x12\x34\n\x06sealed\x18\x01 \x03(\x0b\x32$.personhog.types.v1.FencedPersonSeal\x12\x11\n\tnot_found\x18\x02 \x03(\x03"J\n\x10\x46\x65ncedPersonSeal\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12\x0f\n\x07version\x18\x02 \x01(\x03\x12\x12\n\ncreated_at\x18\x03 \x01(\x03"\xd6\x01\n\x13ReleaseFenceRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x13\n\x0bperson_uuid\x18\x03 \x01(\t\x12\r\n\x05op_id\x18\x04 \x01(\t\x12\x33\n\x07outcome\x18\x05 \x01(\x0e\x32".personhog.types.v1.ReleaseOutcome\x12\x1b\n\x0esealed_version\x18\x06 \x01(\x03H\x00\x88\x01\x01\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x42\x11\n\x0f_sealed_version"\x16\n\x14ReleaseFenceResponse"\xa2\x01\n\x14ReleaseFencesRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\r\n\x05op_id\x18\x02 \x01(\t\x12\x33\n\x07outcome\x18\x03 \x01(\x0e\x32".personhog.types.v1.ReleaseOutcome\x12\x35\n\x07persons\x18\x04 \x03(\x0b\x32$.personhog.types.v1.ReleaseFenceItem"~\n\x10ReleaseFenceItem\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12\x13\n\x0bperson_uuid\x18\x02 \x01(\t\x12\x1b\n\x0esealed_version\x18\x03 \x01(\x03H\x00\x88\x01\x01\x12\x12\n\ncreated_at\x18\x04 \x01(\x03\x42\x11\n\x0f_sealed_version"\x17\n\x15ReleaseFencesResponse"S\n\x14SealedSourceSnapshot\x12*\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.Person\x12\x0f\n\x07ordinal\x18\x02 \x01(\x05"\xbd\x01\n\x19\x46oldPersonDocumentRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x42\n\x10sealed_snapshots\x18\x03 \x03(\x0b\x32(.personhog.types.v1.SealedSourceSnapshot\x12\x11\n\tevent_set\x18\x04 \x01(\x0c\x12\x16\n\x0e\x65vent_set_once\x18\x05 \x01(\x0c\x12\r\n\x05op_id\x18\x06 \x01(\t"H\n\x1a\x46oldPersonDocumentResponse\x12*\n\x06person\x18\x01 \x01(\x0b\x32\x1a.personhog.types.v1.Person*y\n\x11\x44\x65letePersonsMode\x12#\n\x1f\x44\x45LETE_PERSONS_MODE_UNSPECIFIED\x10\x00\x12\x1c\n\x18\x44\x45LETE_PERSONS_MODE_HARD\x10\x01\x12!\n\x1d\x44\x45LETE_PERSONS_MODE_TOMBSTONE\x10\x02*\xe4\x01\n\x13VersionFloorOutcome\x12%\n!VERSION_FLOOR_OUTCOME_UNSPECIFIED\x10\x00\x12,\n(VERSION_FLOOR_OUTCOME_TOMBSTONE_INSERTED\x10\x01\x12*\n&VERSION_FLOOR_OUTCOME_TOMBSTONE_RAISED\x10\x02\x12,\n(VERSION_FLOOR_OUTCOME_TOMBSTONE_AT_FLOOR\x10\x03\x12\x1e\n\x1aVERSION_FLOOR_OUTCOME_LIVE\x10\x04*o\n\x0fLifecycleOpType\x12!\n\x1dLIFECYCLE_OP_TYPE_UNSPECIFIED\x10\x00\x12\x1c\n\x18LIFECYCLE_OP_TYPE_DELETE\x10\x01\x12\x1b\n\x17LIFECYCLE_OP_TYPE_MERGE\x10\x02*m\n\x0eReleaseOutcome\x12\x1f\n\x1bRELEASE_OUTCOME_UNSPECIFIED\x10\x00\x12\x1d\n\x19RELEASE_OUTCOME_COMMITTED\x10\x01\x12\x1b\n\x17RELEASE_OUTCOME_ABORTED\x10\x02\x62\x06proto3'
)
_globals = globals()
@@ -31,14 +31,14 @@ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "personhog.types.v1.person_pb2", _globals)
if not _descriptor._USE_C_DESCRIPTORS:
DESCRIPTOR._loaded_options = None
- _globals["_DELETEPERSONSMODE"]._serialized_start = 7095
- _globals["_DELETEPERSONSMODE"]._serialized_end = 7216
- _globals["_VERSIONFLOOROUTCOME"]._serialized_start = 7219
- _globals["_VERSIONFLOOROUTCOME"]._serialized_end = 7447
- _globals["_LIFECYCLEOPTYPE"]._serialized_start = 7449
- _globals["_LIFECYCLEOPTYPE"]._serialized_end = 7560
- _globals["_RELEASEOUTCOME"]._serialized_start = 7562
- _globals["_RELEASEOUTCOME"]._serialized_end = 7671
+ _globals["_DELETEPERSONSMODE"]._serialized_start = 7291
+ _globals["_DELETEPERSONSMODE"]._serialized_end = 7412
+ _globals["_VERSIONFLOOROUTCOME"]._serialized_start = 7415
+ _globals["_VERSIONFLOOROUTCOME"]._serialized_end = 7643
+ _globals["_LIFECYCLEOPTYPE"]._serialized_start = 7645
+ _globals["_LIFECYCLEOPTYPE"]._serialized_end = 7756
+ _globals["_RELEASEOUTCOME"]._serialized_start = 7758
+ _globals["_RELEASEOUTCOME"]._serialized_end = 7867
_globals["_PERSON"]._serialized_start = 89
_globals["_PERSON"]._serialized_end = 395
_globals["_DISTINCTIDWITHVERSION"]._serialized_start = 397
@@ -111,56 +111,58 @@ if not _descriptor._USE_C_DESCRIPTORS:
_globals["_DELETEPERSONSBATCHFORTEAMREQUEST"]._serialized_end = 4321
_globals["_DELETEPERSONSBATCHFORTEAMRESPONSE"]._serialized_start = 4323
_globals["_DELETEPERSONSBATCHFORTEAMRESPONSE"]._serialized_end = 4381
- _globals["_DELETETOMBSTONEDPERSONSREQUEST"]._serialized_start = 4383
- _globals["_DELETETOMBSTONEDPERSONSREQUEST"]._serialized_end = 4472
- _globals["_DELETETOMBSTONEDPERSONSRESPONSE"]._serialized_start = 4475
- _globals["_DELETETOMBSTONEDPERSONSRESPONSE"]._serialized_end = 4641
- _globals["_SPLITPERSONREQUEST"]._serialized_start = 4643
- _globals["_SPLITPERSONREQUEST"]._serialized_end = 4730
- _globals["_SPLITRESULT"]._serialized_start = 4733
- _globals["_SPLITRESULT"]._serialized_end = 4875
- _globals["_SPLITPERSONRESPONSE"]._serialized_start = 4877
- _globals["_SPLITPERSONRESPONSE"]._serialized_end = 4947
- _globals["_SETPERSONDISTINCTIDVERSIONFLOORREQUEST"]._serialized_start = 4949
- _globals["_SETPERSONDISTINCTIDVERSIONFLOORREQUEST"]._serialized_end = 5048
- _globals["_SETPERSONDISTINCTIDVERSIONFLOORRESPONSE"]._serialized_start = 5050
- _globals["_SETPERSONDISTINCTIDVERSIONFLOORRESPONSE"]._serialized_end = 5151
- _globals["_SETPERSONVERSIONFLOORREQUEST"]._serialized_start = 5153
- _globals["_SETPERSONVERSIONFLOORREQUEST"]._serialized_end = 5240
- _globals["_SETPERSONVERSIONFLOORRESPONSE"]._serialized_start = 5242
- _globals["_SETPERSONVERSIONFLOORRESPONSE"]._serialized_end = 5290
- _globals["_PERSONVERSIONFLOOR"]._serialized_start = 5292
- _globals["_PERSONVERSIONFLOOR"]._serialized_end = 5354
- _globals["_ENSUREPERSONVERSIONFLOORSREQUEST"]._serialized_start = 5356
- _globals["_ENSUREPERSONVERSIONFLOORSREQUEST"]._serialized_end = 5463
- _globals["_PERSONVERSIONFLOORRESULT"]._serialized_start = 5465
- _globals["_PERSONVERSIONFLOORRESULT"]._serialized_end = 5587
- _globals["_ENSUREPERSONVERSIONFLOORSRESPONSE"]._serialized_start = 5589
- _globals["_ENSUREPERSONVERSIONFLOORSRESPONSE"]._serialized_end = 5687
- _globals["_FENCEPERSONREQUEST"]._serialized_start = 5689
- _globals["_FENCEPERSONREQUEST"]._serialized_end = 5814
- _globals["_FENCEPERSONRESPONSE"]._serialized_start = 5816
- _globals["_FENCEPERSONRESPONSE"]._serialized_end = 5881
- _globals["_FENCEPERSONSREQUEST"]._serialized_start = 5883
- _globals["_FENCEPERSONSREQUEST"]._serialized_end = 6010
- _globals["_FENCEPERSONSRESPONSE"]._serialized_start = 6012
- _globals["_FENCEPERSONSRESPONSE"]._serialized_end = 6107
- _globals["_FENCEDPERSONSEAL"]._serialized_start = 6109
- _globals["_FENCEDPERSONSEAL"]._serialized_end = 6183
- _globals["_RELEASEFENCEREQUEST"]._serialized_start = 6186
- _globals["_RELEASEFENCEREQUEST"]._serialized_end = 6400
- _globals["_RELEASEFENCERESPONSE"]._serialized_start = 6402
- _globals["_RELEASEFENCERESPONSE"]._serialized_end = 6424
- _globals["_RELEASEFENCESREQUEST"]._serialized_start = 6427
- _globals["_RELEASEFENCESREQUEST"]._serialized_end = 6589
- _globals["_RELEASEFENCEITEM"]._serialized_start = 6591
- _globals["_RELEASEFENCEITEM"]._serialized_end = 6717
- _globals["_RELEASEFENCESRESPONSE"]._serialized_start = 6719
- _globals["_RELEASEFENCESRESPONSE"]._serialized_end = 6742
- _globals["_SEALEDSOURCESNAPSHOT"]._serialized_start = 6744
- _globals["_SEALEDSOURCESNAPSHOT"]._serialized_end = 6827
- _globals["_FOLDPERSONDOCUMENTREQUEST"]._serialized_start = 6830
- _globals["_FOLDPERSONDOCUMENTREQUEST"]._serialized_end = 7019
- _globals["_FOLDPERSONDOCUMENTRESPONSE"]._serialized_start = 7021
- _globals["_FOLDPERSONDOCUMENTRESPONSE"]._serialized_end = 7093
+ _globals["_DELETETOMBSTONEDPERSONSREQUEST"]._serialized_start = 4384
+ _globals["_DELETETOMBSTONEDPERSONSREQUEST"]._serialized_end = 4540
+ _globals["_VERSIONBOUNDEDPERSON"]._serialized_start = 4542
+ _globals["_VERSIONBOUNDEDPERSON"]._serialized_end = 4606
+ _globals["_DELETETOMBSTONEDPERSONSRESPONSE"]._serialized_start = 4609
+ _globals["_DELETETOMBSTONEDPERSONSRESPONSE"]._serialized_end = 4837
+ _globals["_SPLITPERSONREQUEST"]._serialized_start = 4839
+ _globals["_SPLITPERSONREQUEST"]._serialized_end = 4926
+ _globals["_SPLITRESULT"]._serialized_start = 4929
+ _globals["_SPLITRESULT"]._serialized_end = 5071
+ _globals["_SPLITPERSONRESPONSE"]._serialized_start = 5073
+ _globals["_SPLITPERSONRESPONSE"]._serialized_end = 5143
+ _globals["_SETPERSONDISTINCTIDVERSIONFLOORREQUEST"]._serialized_start = 5145
+ _globals["_SETPERSONDISTINCTIDVERSIONFLOORREQUEST"]._serialized_end = 5244
+ _globals["_SETPERSONDISTINCTIDVERSIONFLOORRESPONSE"]._serialized_start = 5246
+ _globals["_SETPERSONDISTINCTIDVERSIONFLOORRESPONSE"]._serialized_end = 5347
+ _globals["_SETPERSONVERSIONFLOORREQUEST"]._serialized_start = 5349
+ _globals["_SETPERSONVERSIONFLOORREQUEST"]._serialized_end = 5436
+ _globals["_SETPERSONVERSIONFLOORRESPONSE"]._serialized_start = 5438
+ _globals["_SETPERSONVERSIONFLOORRESPONSE"]._serialized_end = 5486
+ _globals["_PERSONVERSIONFLOOR"]._serialized_start = 5488
+ _globals["_PERSONVERSIONFLOOR"]._serialized_end = 5550
+ _globals["_ENSUREPERSONVERSIONFLOORSREQUEST"]._serialized_start = 5552
+ _globals["_ENSUREPERSONVERSIONFLOORSREQUEST"]._serialized_end = 5659
+ _globals["_PERSONVERSIONFLOORRESULT"]._serialized_start = 5661
+ _globals["_PERSONVERSIONFLOORRESULT"]._serialized_end = 5783
+ _globals["_ENSUREPERSONVERSIONFLOORSRESPONSE"]._serialized_start = 5785
+ _globals["_ENSUREPERSONVERSIONFLOORSRESPONSE"]._serialized_end = 5883
+ _globals["_FENCEPERSONREQUEST"]._serialized_start = 5885
+ _globals["_FENCEPERSONREQUEST"]._serialized_end = 6010
+ _globals["_FENCEPERSONRESPONSE"]._serialized_start = 6012
+ _globals["_FENCEPERSONRESPONSE"]._serialized_end = 6077
+ _globals["_FENCEPERSONSREQUEST"]._serialized_start = 6079
+ _globals["_FENCEPERSONSREQUEST"]._serialized_end = 6206
+ _globals["_FENCEPERSONSRESPONSE"]._serialized_start = 6208
+ _globals["_FENCEPERSONSRESPONSE"]._serialized_end = 6303
+ _globals["_FENCEDPERSONSEAL"]._serialized_start = 6305
+ _globals["_FENCEDPERSONSEAL"]._serialized_end = 6379
+ _globals["_RELEASEFENCEREQUEST"]._serialized_start = 6382
+ _globals["_RELEASEFENCEREQUEST"]._serialized_end = 6596
+ _globals["_RELEASEFENCERESPONSE"]._serialized_start = 6598
+ _globals["_RELEASEFENCERESPONSE"]._serialized_end = 6620
+ _globals["_RELEASEFENCESREQUEST"]._serialized_start = 6623
+ _globals["_RELEASEFENCESREQUEST"]._serialized_end = 6785
+ _globals["_RELEASEFENCEITEM"]._serialized_start = 6787
+ _globals["_RELEASEFENCEITEM"]._serialized_end = 6913
+ _globals["_RELEASEFENCESRESPONSE"]._serialized_start = 6915
+ _globals["_RELEASEFENCESRESPONSE"]._serialized_end = 6938
+ _globals["_SEALEDSOURCESNAPSHOT"]._serialized_start = 6940
+ _globals["_SEALEDSOURCESNAPSHOT"]._serialized_end = 7023
+ _globals["_FOLDPERSONDOCUMENTREQUEST"]._serialized_start = 7026
+ _globals["_FOLDPERSONDOCUMENTREQUEST"]._serialized_end = 7215
+ _globals["_FOLDPERSONDOCUMENTRESPONSE"]._serialized_start = 7217
+ _globals["_FOLDPERSONDOCUMENTRESPONSE"]._serialized_end = 7289
# @@protoc_insertion_point(module_scope)
diff --git a/packages/personhog-proto/personhog/types/v1/person_pb2.pyi b/packages/personhog-proto/personhog/types/v1/person_pb2.pyi
index 79eeb0a69517..2fa755b6bc10 100644
--- a/packages/personhog-proto/personhog/types/v1/person_pb2.pyi
+++ b/packages/personhog-proto/personhog/types/v1/person_pb2.pyi
@@ -555,32 +555,55 @@ class DeletePersonsBatchForTeamResponse(_message.Message):
def __init__(self, deleted_count: _Optional[int] = ...) -> None: ...
class DeleteTombstonedPersonsRequest(_message.Message):
- __slots__ = ("team_id", "person_uuids", "max_rows")
+ __slots__ = ("team_id", "person_uuids", "max_rows", "bounded_persons")
TEAM_ID_FIELD_NUMBER: _ClassVar[int]
PERSON_UUIDS_FIELD_NUMBER: _ClassVar[int]
MAX_ROWS_FIELD_NUMBER: _ClassVar[int]
+ BOUNDED_PERSONS_FIELD_NUMBER: _ClassVar[int]
team_id: int
person_uuids: _containers.RepeatedScalarFieldContainer[str]
max_rows: int
+ bounded_persons: _containers.RepeatedCompositeFieldContainer[VersionBoundedPerson]
def __init__(
self,
team_id: _Optional[int] = ...,
person_uuids: _Optional[_Iterable[str]] = ...,
max_rows: _Optional[int] = ...,
+ bounded_persons: _Optional[_Iterable[_Union[VersionBoundedPerson, _Mapping]]] = ...,
) -> None: ...
+class VersionBoundedPerson(_message.Message):
+ __slots__ = ("person_uuid", "max_version")
+ PERSON_UUID_FIELD_NUMBER: _ClassVar[int]
+ MAX_VERSION_FIELD_NUMBER: _ClassVar[int]
+ person_uuid: str
+ max_version: int
+ def __init__(self, person_uuid: _Optional[str] = ..., max_version: _Optional[int] = ...) -> None: ...
+
class DeleteTombstonedPersonsResponse(_message.Message):
- __slots__ = ("deleted_count", "skipped_live_count", "blocked_person_uuids", "pending_person_uuids", "rows_deleted")
+ __slots__ = (
+ "deleted_count",
+ "skipped_live_count",
+ "blocked_person_uuids",
+ "pending_person_uuids",
+ "rows_deleted",
+ "version_guard_applied",
+ "skipped_version_count",
+ )
DELETED_COUNT_FIELD_NUMBER: _ClassVar[int]
SKIPPED_LIVE_COUNT_FIELD_NUMBER: _ClassVar[int]
BLOCKED_PERSON_UUIDS_FIELD_NUMBER: _ClassVar[int]
PENDING_PERSON_UUIDS_FIELD_NUMBER: _ClassVar[int]
ROWS_DELETED_FIELD_NUMBER: _ClassVar[int]
+ VERSION_GUARD_APPLIED_FIELD_NUMBER: _ClassVar[int]
+ SKIPPED_VERSION_COUNT_FIELD_NUMBER: _ClassVar[int]
deleted_count: int
skipped_live_count: int
blocked_person_uuids: _containers.RepeatedScalarFieldContainer[str]
pending_person_uuids: _containers.RepeatedScalarFieldContainer[str]
rows_deleted: int
+ version_guard_applied: bool
+ skipped_version_count: int
def __init__(
self,
deleted_count: _Optional[int] = ...,
@@ -588,6 +611,8 @@ class DeleteTombstonedPersonsResponse(_message.Message):
blocked_person_uuids: _Optional[_Iterable[str]] = ...,
pending_person_uuids: _Optional[_Iterable[str]] = ...,
rows_deleted: _Optional[int] = ...,
+ version_guard_applied: bool = ...,
+ skipped_version_count: _Optional[int] = ...,
) -> None: ...
class SplitPersonRequest(_message.Message):
diff --git a/posthog/personhog_client/README.md b/posthog/personhog_client/README.md
index 42bee7434292..e72e508a6d6d 100644
--- a/posthog/personhog_client/README.md
+++ b/posthog/personhog_client/README.md
@@ -69,7 +69,7 @@ The `PersonHogClient` in `client.py` exposes typed methods for every RPC:
`get_distinct_ids_for_person`, `get_distinct_ids_for_persons`
**Person deletes:**
-`delete_persons`, `delete_persons_batch_for_team`, `delete_tombstoned_persons` (deletes only while still tombstoned, a bounded number of dependent rows per call; persons it did not finish come back as pending and are sent again; used by the persons cleanup drain)
+`delete_persons`, `delete_persons_batch_for_team`, `delete_tombstoned_persons` (deletes only while still tombstoned and, for `bounded_persons`, at or below each person's `max_version`; check `version_guard_applied` on the response; a bounded number of dependent rows per call; persons it did not finish come back as pending and are sent again; used by the persons cleanup drain)
**Person split:**
`split_person` — splits distinct_ids off a person onto new persons (max 250 per request); the sole write path for person splits, with no ORM fallback
diff --git a/posthog/personhog_client/fake_client.py b/posthog/personhog_client/fake_client.py
index 2b3fb340c563..2a0bb7f97320 100644
--- a/posthog/personhog_client/fake_client.py
+++ b/posthog/personhog_client/fake_client.py
@@ -744,16 +744,26 @@ class FakePersonHogClient:
# Mirrors the server, in person id order: a tombstoned person whose distinct ids fit the
# leftover budget goes whole unless one is live (blocked); the first that does not fit
# gives up as many as the leftover allows and stays pending; the rest stay pending untouched.
- response = person_pb2.DeleteTombstonedPersonsResponse()
+ if request.person_uuids and request.bounded_persons:
+ raise ValueError("Set either person_uuids or bounded_persons, not both")
+ response = person_pb2.DeleteTombstonedPersonsResponse(version_guard_applied=bool(request.bounded_persons))
budget = max(1, min(request.max_rows or DELETE_TOMBSTONED_DEFAULT_ROWS, self.tombstoned_delete_max_rows))
+ bounds: dict[str, int] = {}
+ for bounded in request.bounded_persons:
+ if bounded.max_version < 0:
+ raise ValueError("max_version must not be negative")
+ bounds[bounded.person_uuid] = min(bounds.get(bounded.person_uuid, bounded.max_version), bounded.max_version)
candidates: list[tuple[str, person_pb2.Person]] = []
- for uuid in dict.fromkeys(request.person_uuids):
+ for uuid in dict.fromkeys([*request.person_uuids, *bounds]):
person = self._persons_by_uuid.get((request.team_id, uuid))
if person is None:
continue
if not person.is_deleted:
response.skipped_live_count += 1
continue
+ if request.bounded_persons and person.version > bounds[uuid]:
+ response.skipped_version_count += 1
+ continue
candidates.append((uuid, person))
candidates.sort(key=lambda candidate: candidate[1].id)
diff --git a/posthog/personhog_client/proto/__init__.py b/posthog/personhog_client/proto/__init__.py
index c109e1f66c91..93c149fffd3f 100644
--- a/posthog/personhog_client/proto/__init__.py
+++ b/posthog/personhog_client/proto/__init__.py
@@ -75,6 +75,7 @@ from personhog.types.v1.person_pb2 import (
TombstonedPerson,
DeleteTombstonedPersonsRequest,
DeleteTombstonedPersonsResponse,
+ VersionBoundedPerson,
GetDistinctIdsForPersonRequest,
GetDistinctIdsForPersonResponse,
GetDistinctIdsForPersonsRequest,
diff --git a/posthog/personhog_client/test_fake_client.py b/posthog/personhog_client/test_fake_client.py
index 71780593cc2b..4a822ed579e2 100644
--- a/posthog/personhog_client/test_fake_client.py
+++ b/posthog/personhog_client/test_fake_client.py
@@ -529,6 +529,52 @@ class TestFakePersonHogClientDeleteTombstonedPersons:
assert self._delete(uuid, uuid) == expected
assert self._present(uuid) == expect_present
+ @pytest.mark.parametrize(
+ "bounds,expected,expect_present",
+ [
+ (
+ [("newer", 3)],
+ person_pb2.DeleteTombstonedPersonsResponse(deleted_count=1, rows_deleted=1, version_guard_applied=True),
+ False,
+ ),
+ (
+ [("newer", 2)],
+ person_pb2.DeleteTombstonedPersonsResponse(skipped_version_count=1, version_guard_applied=True),
+ True,
+ ),
+ (
+ [("newer", 5), ("newer", 2)],
+ person_pb2.DeleteTombstonedPersonsResponse(skipped_version_count=1, version_guard_applied=True),
+ True,
+ ),
+ (
+ [("live", 0)],
+ person_pb2.DeleteTombstonedPersonsResponse(skipped_live_count=1, version_guard_applied=True),
+ True,
+ ),
+ ],
+ )
+ def test_bounded_persons_delete_only_at_or_below_their_bound(self, bounds, expected, expect_present):
+ self.client.add_person(
+ team_id=self.TEAM_ID,
+ person_id=5,
+ uuid="newer",
+ version=3,
+ distinct_ids=["n-1"],
+ is_deleted=True,
+ tombstoned_distinct_ids=["n-1"],
+ )
+ resp = self.client.delete_tombstoned_persons(
+ person_pb2.DeleteTombstonedPersonsRequest(
+ team_id=self.TEAM_ID,
+ bounded_persons=[
+ person_pb2.VersionBoundedPerson(person_uuid=uuid, max_version=bound) for uuid, bound in bounds
+ ],
+ )
+ )
+ assert resp == expected
+ assert self._present(bounds[0][0]) == expect_present
+
def test_a_person_over_the_budget_is_trimmed_across_calls_then_deleted(self):
pending = person_pb2.DeleteTombstonedPersonsResponse(pending_person_uuids=["big"], rows_deleted=2)
diff --git a/proto/personhog/service/v1/service.proto b/proto/personhog/service/v1/service.proto
index fb0ef04ad52b..9bf79728d4d1 100644
--- a/proto/personhog/service/v1/service.proto
+++ b/proto/personhog/service/v1/service.proto
@@ -84,8 +84,9 @@ service PersonHogService {
rpc DeletePersons(personhog.types.v1.DeletePersonsRequest) returns (personhog.types.v1.DeletePersonsResponse);
// WARNING: Same routing caveat as DeletePersons above.
rpc DeletePersonsBatchForTeam(personhog.types.v1.DeletePersonsBatchForTeamRequest) returns (personhog.types.v1.DeletePersonsBatchForTeamResponse);
- // Deletes only persons that are still tombstoned when the delete runs, a bounded
- // number of rows per call; pending uuids are sent again by the caller.
+ // Deletes only persons that are still tombstoned, and at or below their version bound when the
+ // request carries bounded_persons. Deletes a bounded number of rows per call; the caller resends
+ // pending uuids.
// WARNING: Same routing caveat as DeletePersons above.
rpc DeleteTombstonedPersons(personhog.types.v1.DeleteTombstonedPersonsRequest) returns (personhog.types.v1.DeleteTombstonedPersonsResponse);
rpc GetPersonTombstones(personhog.types.v1.GetPersonTombstonesRequest) returns (personhog.types.v1.GetPersonTombstonesResponse);
diff --git a/proto/personhog/types/v1/person.proto b/proto/personhog/types/v1/person.proto
index 306284173f63..60cd040a639c 100644
--- a/proto/personhog/types/v1/person.proto
+++ b/proto/personhog/types/v1/person.proto
@@ -297,11 +297,22 @@ message DeletePersonsBatchForTeamResponse {
// until none come back. Idempotent.
message DeleteTombstonedPersonsRequest {
int64 team_id = 1;
- // Person UUIDs to delete. Max 1000 per request.
+ // Person UUIDs to delete. Max 1000 per request. Leave empty when bounded_persons is set.
repeated string person_uuids = 2;
// Dependent rows this call may delete. 0 means the server default; the server
// clamps the value to its own maximum (replica setting TOMBSTONED_DELETE_MAX_ROWS).
int64 max_rows = 3;
+ // Persons to delete, each with a version bound, in place of person_uuids. Max 1000 per request.
+ // A server that predates this field reads an empty person_uuids and deletes nothing, so the
+ // caller must check version_guard_applied on the response.
+ repeated VersionBoundedPerson bounded_persons = 4;
+}
+
+message VersionBoundedPerson {
+ string person_uuid = 1;
+ // The person is deleted only while its version is at or below this value. A person with a
+ // higher version was tombstoned again after the caller took the bound.
+ int64 max_version = 2;
}
message DeleteTombstonedPersonsResponse {
@@ -318,6 +329,11 @@ message DeleteTombstonedPersonsResponse {
repeated string pending_person_uuids = 4;
// Dependent rows deleted by this call.
int64 rows_deleted = 5;
+ // True when the request carried bounded_persons and the server checked every bound. Always
+ // false from a server that predates bounded_persons.
+ bool version_guard_applied = 6;
+ // Persons still tombstoned but at a version above their bound. Nothing was deleted for them.
+ int64 skipped_version_count = 7;
}
// SplitPersonRequest splits specific distinct_ids off of a person onto new persons.
diff --git a/rust/personhog-replica/.sqlx/query-21af309261930520ef74c10cc6ee26721d39975c56d1e8889390e318abac895e.json b/rust/personhog-replica/.sqlx/query-21af309261930520ef74c10cc6ee26721d39975c56d1e8889390e318abac895e.json
new file mode 100644
index 000000000000..78a7e6e81833
--- /dev/null
+++ b/rust/personhog-replica/.sqlx/query-21af309261930520ef74c10cc6ee26721d39975c56d1e8889390e318abac895e.json
@@ -0,0 +1,24 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT p.id::bigint AS \"id!\"\n FROM posthog_person p\n JOIN UNNEST($2::bigint[], $3::bigint[]) AS bound(id, max_version) ON bound.id = p.id\n WHERE p.team_id = $1 AND p.id = ANY($2) AND p.is_deleted\n AND COALESCE(p.version, 0) <= bound.max_version\n ORDER BY p.id\n FOR UPDATE OF p\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id!",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Int4",
+ "Int8Array",
+ "Int8Array"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "21af309261930520ef74c10cc6ee26721d39975c56d1e8889390e318abac895e"
+}
diff --git a/rust/personhog-replica/.sqlx/query-6927414fcbb8f07e710b61435441f6d7b9db22734707f972fb32074fa2fad4f1.json b/rust/personhog-replica/.sqlx/query-6927414fcbb8f07e710b61435441f6d7b9db22734707f972fb32074fa2fad4f1.json
deleted file mode 100644
index 80d0e1b8892c..000000000000
--- a/rust/personhog-replica/.sqlx/query-6927414fcbb8f07e710b61435441f6d7b9db22734707f972fb32074fa2fad4f1.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n SELECT id::bigint AS \"id!\"\n FROM posthog_person\n WHERE team_id = $1 AND id = ANY($2) AND is_deleted\n ORDER BY id\n FOR UPDATE\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "id!",
- "type_info": "Int8"
- }
- ],
- "parameters": {
- "Left": [
- "Int4",
- "Int8Array"
- ]
- },
- "nullable": [
- false
- ]
- },
- "hash": "6927414fcbb8f07e710b61435441f6d7b9db22734707f972fb32074fa2fad4f1"
-}
diff --git a/rust/personhog-replica/.sqlx/query-709c822202ccdcb5ff14e54fb82960465ae47ce237bb0de6ae1d9e289a800c14.json b/rust/personhog-replica/.sqlx/query-709c822202ccdcb5ff14e54fb82960465ae47ce237bb0de6ae1d9e289a800c14.json
deleted file mode 100644
index f91b2f2b8521..000000000000
--- a/rust/personhog-replica/.sqlx/query-709c822202ccdcb5ff14e54fb82960465ae47ce237bb0de6ae1d9e289a800c14.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n SELECT count(*) AS \"count!\"\n FROM posthog_person\n WHERE team_id = $1 AND uuid = ANY($2) AND is_deleted = false\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "count!",
- "type_info": "Int8"
- }
- ],
- "parameters": {
- "Left": [
- "Int4",
- "UuidArray"
- ]
- },
- "nullable": [
- null
- ]
- },
- "hash": "709c822202ccdcb5ff14e54fb82960465ae47ce237bb0de6ae1d9e289a800c14"
-}
diff --git a/rust/personhog-replica/.sqlx/query-d0422727d46f82a91929bd6e1bde67a4d1b95e0373b45ab7b935b175c3b9af25.json b/rust/personhog-replica/.sqlx/query-d0422727d46f82a91929bd6e1bde67a4d1b95e0373b45ab7b935b175c3b9af25.json
deleted file mode 100644
index 0a74a66678a2..000000000000
--- a/rust/personhog-replica/.sqlx/query-d0422727d46f82a91929bd6e1bde67a4d1b95e0373b45ab7b935b175c3b9af25.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n SELECT id::bigint AS \"id!\", uuid AS \"uuid!\"\n FROM posthog_person\n WHERE team_id = $1 AND uuid = ANY($2) AND is_deleted\n ORDER BY id\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "id!",
- "type_info": "Int8"
- },
- {
- "ordinal": 1,
- "name": "uuid!",
- "type_info": "Uuid"
- }
- ],
- "parameters": {
- "Left": [
- "Int4",
- "UuidArray"
- ]
- },
- "nullable": [
- false,
- false
- ]
- },
- "hash": "d0422727d46f82a91929bd6e1bde67a4d1b95e0373b45ab7b935b175c3b9af25"
-}
diff --git a/rust/personhog-replica/.sqlx/query-d36c16382a960fa7f05b020be428830767f655c98536713fa1dad6db1ba92500.json b/rust/personhog-replica/.sqlx/query-d36c16382a960fa7f05b020be428830767f655c98536713fa1dad6db1ba92500.json
new file mode 100644
index 000000000000..f706ed5f0c00
--- /dev/null
+++ b/rust/personhog-replica/.sqlx/query-d36c16382a960fa7f05b020be428830767f655c98536713fa1dad6db1ba92500.json
@@ -0,0 +1,41 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT id::bigint AS \"id!\", uuid AS \"uuid!\", is_deleted AS \"is_deleted!\",\n COALESCE(version, 0)::bigint AS \"version!\"\n FROM posthog_person\n WHERE team_id = $1 AND uuid = ANY($2)\n ORDER BY id\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id!",
+ "type_info": "Int8"
+ },
+ {
+ "ordinal": 1,
+ "name": "uuid!",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 2,
+ "name": "is_deleted!",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 3,
+ "name": "version!",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Int4",
+ "UuidArray"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ null
+ ]
+ },
+ "hash": "d36c16382a960fa7f05b020be428830767f655c98536713fa1dad6db1ba92500"
+}
diff --git a/rust/personhog-replica/src/service/mod.rs b/rust/personhog-replica/src/service/mod.rs
index 4e67a2fde8eb..c44f6293f62f 100644
--- a/rust/personhog-replica/src/service/mod.rs
+++ b/rust/personhog-replica/src/service/mod.rs
@@ -587,18 +587,35 @@ impl PersonHogReplica for PersonHogReplicaService {
) -> Result<Response<DeleteTombstonedPersonsResponse>, Status> {
let req = request.into_inner();
- if req.person_uuids.len() > 1000 {
+ if !req.person_uuids.is_empty() && !req.bounded_persons.is_empty() {
+ return Err(Status::invalid_argument(
+ "Set either person_uuids or bounded_persons, not both",
+ ));
+ }
+ if req.person_uuids.len().max(req.bounded_persons.len()) > 1000 {
return Err(Status::invalid_argument(
"Maximum 1000 person UUIDs per request",
));
}
- let uuids: Vec<Uuid> = req
- .person_uuids
- .iter()
- .map(|s| Uuid::parse_str(s))
- .collect::<Result<Vec<_>, _>>()
- .map_err(|e| Status::invalid_argument(format!("Invalid UUID: {e}")))?;
+ let parse_uuid = |s: &str| {
+ Uuid::parse_str(s).map_err(|e| Status::invalid_argument(format!("Invalid UUID: {e}")))
+ };
+ let version_guard_applied = !req.bounded_persons.is_empty();
+ let mut targets: Vec<storage::TombstoneTarget> =
+ Vec::with_capacity(req.person_uuids.len() + req.bounded_persons.len());
+ for uuid in &req.person_uuids {
+ targets.push(storage::TombstoneTarget::unbounded(parse_uuid(uuid)?));
+ }
+ for bounded in &req.bounded_persons {
+ if bounded.max_version < 0 {
+ return Err(Status::invalid_argument("max_version must not be negative"));
+ }
+ targets.push(storage::TombstoneTarget {
+ uuid: parse_uuid(&bounded.person_uuid)?,
+ max_version: bounded.max_version,
+ });
+ }
if req.max_rows < 0 {
return Err(Status::invalid_argument("max_rows must not be negative"));
}
@@ -610,13 +627,15 @@ impl PersonHogReplica for PersonHogReplicaService {
let outcome = self
.storage
- .delete_tombstoned_persons(req.team_id, &uuids, max_rows)
+ .delete_tombstoned_persons(req.team_id, &targets, max_rows)
.await
.map_err(|e| log_and_convert_error(e, "delete_tombstoned_persons"))?;
Ok(Response::new(DeleteTombstonedPersonsResponse {
deleted_count: outcome.deleted,
skipped_live_count: outcome.skipped_live,
+ version_guard_applied,
+ skipped_version_count: outcome.skipped_version,
blocked_person_uuids: outcome
.blocked_uuids
.iter()
diff --git a/rust/personhog-replica/src/service/tests/mocks.rs b/rust/personhog-replica/src/service/tests/mocks.rs
index 3e040dfeefcd..c55a6abf2fe4 100644
--- a/rust/personhog-replica/src/service/tests/mocks.rs
+++ b/rust/personhog-replica/src/service/tests/mocks.rs
@@ -108,7 +108,7 @@ impl storage::PersonLookup for FailingStorage {
async fn delete_tombstoned_persons(
&self,
_team_id: i64,
- _uuids: &[Uuid],
+ _targets: &[storage::TombstoneTarget],
_max_rows: i64,
) -> storage::StorageResult<storage::TombstonedDeleteOutcome> {
Err(self.error.clone())
@@ -529,7 +529,7 @@ impl storage::PersonLookup for SuccessStorage {
async fn delete_tombstoned_persons(
&self,
_team_id: i64,
- _uuids: &[Uuid],
+ _targets: &[storage::TombstoneTarget],
_max_rows: i64,
) -> storage::StorageResult<storage::TombstonedDeleteOutcome> {
Ok(storage::TombstonedDeleteOutcome::default())
@@ -1009,7 +1009,7 @@ impl storage::PersonLookup for PopulatedStorage {
async fn delete_tombstoned_persons(
&self,
_team_id: i64,
- _uuids: &[Uuid],
+ _targets: &[storage::TombstoneTarget],
_max_rows: i64,
) -> storage::StorageResult<storage::TombstonedDeleteOutcome> {
Ok(storage::TombstonedDeleteOutcome::default())
@@ -1465,7 +1465,7 @@ impl storage::PersonLookup for ConsistencyTrackingStorage {
async fn delete_tombstoned_persons(
&self,
_team_id: i64,
- _uuids: &[Uuid],
+ _targets: &[storage::TombstoneTarget],
_max_rows: i64,
) -> storage::StorageResult<storage::TombstonedDeleteOutcome> {
Ok(storage::TombstonedDeleteOutcome::default())
diff --git a/rust/personhog-replica/src/service/tests/mod.rs b/rust/personhog-replica/src/service/tests/mod.rs
index 865988d7c986..2922fc96fa0f 100644
--- a/rust/personhog-replica/src/service/tests/mod.rs
+++ b/rust/personhog-replica/src/service/tests/mod.rs
@@ -13,7 +13,7 @@ use personhog_proto::personhog::types::v1::{
EnsurePersonVersionFloorsRequest, GetGroupRequest, GetPersonRequest,
GetPersonsByDistinctIdsInTeamRequest, InsertCohortMembersRequest, ListCohortMemberIdsRequest,
PersonVersionFloor, UpdateGroupRequest, UpdateGroupTypeMappingRequest,
- UpsertHashKeyOverridesRequest,
+ UpsertHashKeyOverridesRequest, VersionBoundedPerson,
};
use rstest::rstest;
use tonic::Request;
@@ -201,21 +201,42 @@ async fn test_delete_persons_success(#[case] person_uuids: Vec<String>) {
// DeleteTombstonedPersons tests
// ============================================================
+fn bounded(uuid: &str, max_version: i64) -> VersionBoundedPerson {
+ VersionBoundedPerson {
+ person_uuid: uuid.to_string(),
+ max_version,
+ }
+}
+
+const SOME_UUID: &str = "00000000-0000-0000-0000-000000000001";
+
#[rstest]
#[case::too_many_uuids(
(0..1001).map(|i| format!("00000000-0000-0000-0000-{i:012}")).collect(),
+ vec![],
0,
"1000"
)]
-#[case::invalid_uuid(vec!["not-a-valid-uuid".to_string()], 0, "Invalid UUID")]
-#[case::negative_max_rows(
- vec!["00000000-0000-0000-0000-000000000001".to_string()],
- -1,
- "max_rows"
+#[case::too_many_bounded_persons(
+ vec![],
+ (0..1001).map(|i| bounded(&format!("00000000-0000-0000-0000-{i:012}"), 1)).collect(),
+ 0,
+ "1000"
+)]
+#[case::invalid_uuid(vec!["not-a-valid-uuid".to_string()], vec![], 0, "Invalid UUID")]
+#[case::invalid_bounded_uuid(vec![], vec![bounded("not-a-valid-uuid", 1)], 0, "Invalid UUID")]
+#[case::negative_max_rows(vec![SOME_UUID.to_string()], vec![], -1, "max_rows")]
+#[case::negative_max_version(vec![], vec![bounded(SOME_UUID, -1)], 0, "max_version")]
+#[case::both_uuid_lists(
+ vec![SOME_UUID.to_string()],
+ vec![bounded(SOME_UUID, 1)],
+ 0,
+ "not both"
)]
#[tokio::test]
async fn test_delete_tombstoned_persons_invalid_input(
#[case] person_uuids: Vec<String>,
+ #[case] bounded_persons: Vec<VersionBoundedPerson>,
#[case] max_rows: i64,
#[case] expected_message: &str,
) {
@@ -226,6 +247,7 @@ async fn test_delete_tombstoned_persons_invalid_input(
team_id: 1,
person_uuids,
max_rows,
+ bounded_persons,
}))
.await
.unwrap_err();
diff --git a/rust/personhog-replica/src/storage/mod.rs b/rust/personhog-replica/src/storage/mod.rs
index 5ee9407cdfb0..dc14220ea2c3 100644
--- a/rust/personhog-replica/src/storage/mod.rs
+++ b/rust/personhog-replica/src/storage/mod.rs
@@ -8,8 +8,8 @@ pub use error::{StorageError, StorageResult};
pub use types::{
CohortMembership, DeletePersonsOutcome, DistinctIdMapping, DistinctIdWithVersion, Group,
GroupIdentifier, GroupKey, GroupTypeMapping, HashKeyOverride, HashKeyOverrideContext, Person,
- PersonVersionFloorResult, SplitResult, TombstonedDeleteOutcome, TombstonedDistinctId,
- TombstonedPerson, VersionFloorOutcome,
+ PersonVersionFloorResult, SplitResult, TombstoneTarget, TombstonedDeleteOutcome,
+ TombstonedDistinctId, TombstonedPerson, VersionFloorOutcome,
};
pub use traits::{CohortStorage, DistinctIdLookup, FeatureFlagStorage, GroupStorage, PersonLookup};
diff --git a/rust/personhog-replica/src/storage/postgres/person.rs b/rust/personhog-replica/src/storage/postgres/person.rs
index 9278653b66ef..8d90bfe2f009 100644
--- a/rust/personhog-replica/src/storage/postgres/person.rs
+++ b/rust/personhog-replica/src/storage/postgres/person.rs
@@ -14,7 +14,8 @@ use crate::storage::error::{StorageError, StorageResult};
use crate::storage::traits::PersonLookup;
use crate::storage::types::{
DeletePersonsOutcome, Person, PersonTombstoneQueueEntry, PersonVersionFloorResult, SplitResult,
- TombstonedDeleteOutcome, TombstonedDistinctId, TombstonedPerson, VersionFloorOutcome,
+ TombstoneTarget, TombstonedDeleteOutcome, TombstonedDistinctId, TombstonedPerson,
+ VersionFloorOutcome,
};
/// Version offset for split person/PDI rows — mirrors the Django convention.
@@ -650,10 +651,10 @@ impl PersonLookup for PostgresStorage {
async fn delete_tombstoned_persons(
&self,
team_id: i64,
- uuids: &[Uuid],
+ targets: &[TombstoneTarget],
max_rows: i64,
) -> StorageResult<TombstonedDeleteOutcome> {
- if uuids.is_empty() {
+ if targets.is_empty() {
return Ok(TombstonedDeleteOutcome::default());
}
@@ -670,9 +671,16 @@ impl PersonLookup for PostgresStorage {
];
let _timer = common_metrics::timing_guard(DB_QUERY_DURATION, &labels);
- // One outcome per uuid: a duplicate must not be counted or reported twice.
- let mut seen = HashSet::with_capacity(uuids.len());
- let unique: Vec<Uuid> = uuids.iter().copied().filter(|u| seen.insert(*u)).collect();
+ // One outcome per uuid: a duplicate must not be counted or reported twice. It keeps its
+ // lowest bound, the one that deletes the least.
+ let mut bounds: HashMap<Uuid, i64> = HashMap::with_capacity(targets.len());
+ for target in targets {
+ bounds
+ .entry(target.uuid)
+ .and_modify(|bound| *bound = (*bound).min(target.max_version))
+ .or_insert(target.max_version);
+ }
+ let unique: Vec<Uuid> = bounds.keys().copied().collect();
// The caller picks the row budget; the server caps it so no call outlives its deadline.
let budget = max_rows.clamp(1, self.tombstoned_delete_max_rows as i64);
@@ -684,38 +692,37 @@ impl PersonLookup for PostgresStorage {
.execute(&mut *tx)
.await?;
- // Resolved without locks. The delete re-checks the tombstone under its row lock, so a
- // person revived in between drops out and reads as neither deleted nor live.
- let candidates: Vec<(i64, Uuid)> = sqlx::query!(
+ // This read takes no lock. The delete re-checks the tombstone and the bound under its row
+ // lock, so a person revived or tombstoned again after this read lands in no outcome bucket.
+ let persons = sqlx::query!(
r#"
- SELECT id::bigint AS "id!", uuid AS "uuid!"
+ SELECT id::bigint AS "id!", uuid AS "uuid!", is_deleted AS "is_deleted!",
+ COALESCE(version, 0)::bigint AS "version!"
FROM posthog_person
- WHERE team_id = $1 AND uuid = ANY($2) AND is_deleted
+ WHERE team_id = $1 AND uuid = ANY($2)
ORDER BY id
"#,
team_id as i32,
unique.as_slice()
)
.fetch_all(&mut *tx)
- .await?
- .into_iter()
- .map(|row| (row.id, row.uuid))
- .collect();
-
- let skipped_live: i64 = sqlx::query_scalar!(
- r#"
- SELECT count(*) AS "count!"
- FROM posthog_person
- WHERE team_id = $1 AND uuid = ANY($2) AND is_deleted = false
- "#,
- team_id as i32,
- unique.as_slice()
- )
- .fetch_one(&mut *tx)
.await?;
+ let mut skipped_live = 0;
+ let mut skipped_version = 0;
+ let mut candidates: Vec<(i64, Uuid)> = Vec::with_capacity(persons.len());
+ for row in persons {
+ if !row.is_deleted {
+ skipped_live += 1;
+ } else if row.version > bounds[&row.uuid] {
+ skipped_version += 1;
+ } else {
+ candidates.push((row.id, row.uuid));
+ }
+ }
let mut outcome = TombstonedDeleteOutcome {
skipped_live,
+ skipped_version,
..TombstonedDeleteOutcome::default()
};
if candidates.is_empty() {
@@ -747,22 +754,28 @@ impl PersonLookup for PostgresStorage {
..
} = admission;
- // Lock only the persons that are still tombstoned, in id order. READ COMMITTED re-checks
- // is_deleted on the row version that wins the lock, so a person revived a moment ago
- // drops out here. Live writers touch live persons, never locked here, and the identity
- // saga locks persons before distinct ids in this same order.
- let mut lock_ids: Vec<i64> = admitted.iter().map(|(id, _)| *id).collect();
- lock_ids.extend(trim.map(|(id, _)| id));
+ // READ COMMITTED re-checks the tombstone and the bound on the row version that wins the
+ // lock, so a person revived or tombstoned again a moment ago drops out, trimmed or not.
+ // Live writers touch only live persons, which this never locks, and the identity saga locks
+ // persons before distinct ids in this same id order.
+ let (lock_ids, lock_bounds): (Vec<i64>, Vec<i64>) = admitted
+ .iter()
+ .chain(trim.iter())
+ .map(|(id, uuid)| (*id, bounds[uuid]))
+ .unzip();
let locked: HashSet<i64> = sqlx::query_scalar!(
r#"
- SELECT id::bigint AS "id!"
- FROM posthog_person
- WHERE team_id = $1 AND id = ANY($2) AND is_deleted
- ORDER BY id
- FOR UPDATE
+ SELECT p.id::bigint AS "id!"
+ FROM posthog_person p
+ JOIN UNNEST($2::bigint[], $3::bigint[]) AS bound(id, max_version) ON bound.id = p.id
+ WHERE p.team_id = $1 AND p.id = ANY($2) AND p.is_deleted
+ AND COALESCE(p.version, 0) <= bound.max_version
+ ORDER BY p.id
+ FOR UPDATE OF p
"#,
team_id as i32,
- lock_ids.as_slice()
+ lock_ids.as_slice(),
+ lock_bounds.as_slice()
)
.fetch_all(&mut *tx)
.await?
@@ -2075,6 +2088,10 @@ fn record_tombstoned_delete_rows(outcome: &TombstonedDeleteOutcome, client: &str
"delete_tombstoned_persons_skipped_live",
outcome.skipped_live,
),
+ (
+ "delete_tombstoned_persons_skipped_version",
+ outcome.skipped_version,
+ ),
(
"delete_tombstoned_persons_blocked",
outcome.blocked_uuids.len() as i64,
diff --git a/rust/personhog-replica/src/storage/traits/person.rs b/rust/personhog-replica/src/storage/traits/person.rs
index 7d0bdc122421..4bcd760ec3ca 100644
--- a/rust/personhog-replica/src/storage/traits/person.rs
+++ b/rust/personhog-replica/src/storage/traits/person.rs
@@ -4,7 +4,7 @@ use uuid::Uuid;
use crate::storage::error::StorageResult;
use crate::storage::types::{
DeletePersonsOutcome, Person, PersonTombstoneQueueEntry, PersonVersionFloorResult, SplitResult,
- TombstonedDeleteOutcome, TombstonedPerson,
+ TombstoneTarget, TombstonedDeleteOutcome, TombstonedPerson,
};
/// Person lookup operations by ID, UUID, and distinct ID
@@ -65,10 +65,13 @@ pub trait PersonLookup: Send + Sync {
/// persons that fit the budget go whole, the first that does not is trimmed with the leftover
/// and returned pending, the rest are returned pending untouched. A revival either wins the
/// row lock first and is skipped, or lands afterwards on a fresh row. Idempotent.
+ ///
+ /// A person is deleted only while its version is at or below its target's `max_version`,
+ /// checked under the same row lock. A uuid listed twice keeps its lowest bound.
async fn delete_tombstoned_persons(
&self,
team_id: i64,
- uuids: &[Uuid],
+ targets: &[TombstoneTarget],
max_rows: i64,
) -> StorageResult<TombstonedDeleteOutcome>;
diff --git a/rust/personhog-replica/src/storage/types/person.rs b/rust/personhog-replica/src/storage/types/person.rs
index 25bc23832934..a9a92522792b 100644
--- a/rust/personhog-replica/src/storage/types/person.rs
+++ b/rust/personhog-replica/src/storage/types/person.rs
@@ -46,14 +46,34 @@ pub struct DeletePersonsOutcome {
pub tombstones: Option<Vec<TombstonedPerson>>,
}
+/// A person DeleteTombstonedPersons may delete, and the highest version it may delete it at.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub struct TombstoneTarget {
+ pub uuid: Uuid,
+ pub max_version: i64,
+}
+
+impl TombstoneTarget {
+ pub fn unbounded(uuid: Uuid) -> Self {
+ Self {
+ uuid,
+ max_version: i64::MAX,
+ }
+ }
+}
+
/// Outcome of one bounded DeleteTombstonedPersons call. Every requested uuid lands in at most
-/// one bucket; a uuid with no Postgres row, or whose person is live again, lands in none.
+/// one bucket; a uuid with no Postgres row, or whose person is live again or above its version
+/// bound by the time the delete locks it, lands in none.
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct TombstonedDeleteOutcome {
/// Persons hard-deleted together with their dependent rows.
pub deleted: i64,
/// Persons found with is_deleted = false, so revived after the caller queued them. Untouched.
pub skipped_live: i64,
+ /// Persons still tombstoned but at a version above their bound, so tombstoned again after
+ /// the caller took the bound. Untouched.
+ pub skipped_version: i64,
/// Persons still tombstoned but referenced by a live distinct id. Untouched. Ingestion never
/// produces this state, so the caller should surface it rather than retry blindly.
pub blocked_uuids: Vec<Uuid>,
diff --git a/rust/personhog-replica/tests/service_tests.rs b/rust/personhog-replica/tests/service_tests.rs
index 3b0582e82358..6e0bdffba185 100644
--- a/rust/personhog-replica/tests/service_tests.rs
+++ b/rust/personhog-replica/tests/service_tests.rs
@@ -1,20 +1,21 @@
mod common;
-use common::TestContext;
+use common::{TestContext, TestPerson};
use personhog_proto::personhog::replica::v1::person_hog_replica_server::PersonHogReplica;
use personhog_proto::personhog::types::v1::{
CheckCohortMembershipRequest, CountGroupTypeMappingsRequest,
DeleteHashKeyOverridesByTeamsRequest, DeletePersonsBatchForTeamRequest, DeletePersonsMode,
- DeletePersonsRequest, DeleteTombstonedPersonsRequest, EnsurePersonVersionFloorsRequest,
- GetDistinctIdsForPersonRequest, GetDistinctIdsForPersonsRequest, GetGroupRequest,
- GetGroupTypeMappingsByProjectIdRequest, GetGroupTypeMappingsByProjectIdsRequest,
- GetGroupTypeMappingsByTeamIdRequest, GetGroupTypeMappingsByTeamIdsRequest,
- GetGroupsBatchRequest, GetGroupsRequest, GetHashKeyOverrideContextRequest,
- GetPersonByDistinctIdRequest, GetPersonByUuidRequest, GetPersonRequest,
- GetPersonsByDistinctIdsInTeamRequest, GetPersonsByDistinctIdsRequest, GetPersonsByUuidsRequest,
- GetPersonsRequest, GroupIdentifier, GroupKey, PersonVersionFloor, PersonVersionFloorResult,
- SetPersonDistinctIdVersionFloorRequest, SetPersonVersionFloorRequest, SplitPersonRequest,
- TeamDistinctId, UpsertHashKeyOverridesRequest, VersionFloorOutcome,
+ DeletePersonsRequest, DeleteTombstonedPersonsRequest, DeleteTombstonedPersonsResponse,
+ EnsurePersonVersionFloorsRequest, GetDistinctIdsForPersonRequest,
+ GetDistinctIdsForPersonsRequest, GetGroupRequest, GetGroupTypeMappingsByProjectIdRequest,
+ GetGroupTypeMappingsByProjectIdsRequest, GetGroupTypeMappingsByTeamIdRequest,
+ GetGroupTypeMappingsByTeamIdsRequest, GetGroupsBatchRequest, GetGroupsRequest,
+ GetHashKeyOverrideContextRequest, GetPersonByDistinctIdRequest, GetPersonByUuidRequest,
+ GetPersonRequest, GetPersonsByDistinctIdsInTeamRequest, GetPersonsByDistinctIdsRequest,
+ GetPersonsByUuidsRequest, GetPersonsRequest, GroupIdentifier, GroupKey, PersonVersionFloor,
+ PersonVersionFloorResult, SetPersonDistinctIdVersionFloorRequest, SetPersonVersionFloorRequest,
+ SplitPersonRequest, TeamDistinctId, UpsertHashKeyOverridesRequest, VersionBoundedPerson,
+ VersionFloorOutcome,
};
use personhog_replica::service::PersonHogReplicaService;
use rstest::rstest;
@@ -1403,6 +1404,7 @@ async fn test_delete_tombstoned_persons_reports_each_outcome(
Uuid::now_v7().to_string(),
],
max_rows,
+ bounded_persons: vec![],
}))
.await
.expect("RPC failed")
@@ -1410,6 +1412,8 @@ async fn test_delete_tombstoned_persons_reports_each_outcome(
assert_eq!(response.deleted_count, 1);
assert_eq!(response.skipped_live_count, 1);
+ assert!(!response.version_guard_applied);
+ assert_eq!(response.skipped_version_count, 0);
assert_eq!(
response.blocked_person_uuids,
vec![blocked.uuid.to_string()]
@@ -1428,6 +1432,61 @@ async fn test_delete_tombstoned_persons_reports_each_outcome(
ctx.cleanup().await.ok();
}
+#[tokio::test]
+async fn test_delete_tombstoned_persons_applies_version_bounds() {
+ // Every person is tombstoned once (version 1). `again` is tombstoned a second time
+ // (version 2), and `duplicate` is sent twice, so its lower bound must win.
+ let ctx = ServiceTestContext::new().await;
+ let at_bound = ctx.insert_person("svc_bound_at", None).await.unwrap();
+ let again = ctx.insert_person("svc_bound_again", None).await.unwrap();
+ let duplicate = ctx.insert_person("svc_bound_dup", None).await.unwrap();
+ for person in [&at_bound, &again, &duplicate] {
+ ctx.tombstone_person(person.id, None).await.unwrap();
+ }
+ ctx.tombstone_person(again.id, None).await.unwrap();
+ let live = ctx.insert_person("svc_bound_live", None).await.unwrap();
+ let bound = |person: &TestPerson, max_version: i64| VersionBoundedPerson {
+ person_uuid: person.uuid.to_string(),
+ max_version,
+ };
+
+ let response = ctx
+ .service
+ .delete_tombstoned_persons(Request::new(DeleteTombstonedPersonsRequest {
+ team_id: ctx.team_id,
+ person_uuids: vec![],
+ max_rows: 0,
+ bounded_persons: vec![
+ bound(&at_bound, 1),
+ bound(&again, 1),
+ bound(&duplicate, 5),
+ bound(&duplicate, 0),
+ bound(&live, 5),
+ ],
+ }))
+ .await
+ .expect("RPC failed")
+ .into_inner();
+
+ assert_eq!(
+ response,
+ DeleteTombstonedPersonsResponse {
+ deleted_count: 1,
+ skipped_live_count: 1,
+ rows_deleted: 1,
+ version_guard_applied: true,
+ skipped_version_count: 2,
+ ..Default::default()
+ }
+ );
+ assert!(!ctx.person_row_exists(at_bound.id).await.unwrap());
+ for person in [&again, &duplicate, &live] {
+ assert!(ctx.person_row_exists(person.id).await.unwrap());
+ }
+
+ ctx.cleanup().await.ok();
+}
+
#[rstest]
#[case::unspecified(DeletePersonsMode::Unspecified as i32)]
#[case::tombstone(DeletePersonsMode::Tombstone as i32)]
diff --git a/rust/personhog-replica/tests/storage_tests.rs b/rust/personhog-replica/tests/storage_tests.rs
index 57de39ee8c56..4cf5831da5c5 100644
--- a/rust/personhog-replica/tests/storage_tests.rs
+++ b/rust/personhog-replica/tests/storage_tests.rs
@@ -4,7 +4,7 @@ use common::TestContext;
use metrics_util::debugging::{DebugValue, DebuggingRecorder, Snapshotter};
use personhog_replica::storage::postgres::ConsistencyLevel;
use personhog_replica::storage::{
- GroupKey, PersonVersionFloorResult, StorageError, TombstonedDeleteOutcome,
+ GroupKey, PersonVersionFloorResult, StorageError, TombstoneTarget, TombstonedDeleteOutcome,
TombstonedDistinctId, TombstonedPerson, VersionFloorOutcome,
};
use rand::Rng;
@@ -3649,6 +3649,14 @@ async fn test_set_person_version_floor_missing_person() {
/// The test storage clamps max_rows to this many dependent rows per call.
const TEST_MAX_ROWS: i64 = 12;
+fn unbounded(uuids: &[Uuid]) -> Vec<TombstoneTarget> {
+ uuids
+ .iter()
+ .copied()
+ .map(TombstoneTarget::unbounded)
+ .collect()
+}
+
/// (distinct ids, hash key overrides, cohort memberships) a person still owns.
async fn dependent_rows(ctx: &TestContext, person_id: i64) -> (i64, i64, i64) {
(
@@ -3705,7 +3713,7 @@ async fn test_delete_tombstoned_persons_single_person(
let outcome = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &[person.uuid], TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&[person.uuid]), TEST_MAX_ROWS)
.await
.expect("Failed to delete tombstoned persons");
@@ -3714,6 +3722,7 @@ async fn test_delete_tombstoned_persons_single_person(
TombstonedDeleteOutcome {
deleted: expected_deleted,
skipped_live: expected_skipped_live,
+ skipped_version: 0,
blocked_uuids: if expected_blocked {
vec![person.uuid]
} else {
@@ -3754,10 +3763,10 @@ async fn test_delete_tombstoned_persons_trims_a_person_over_the_budget_until_it_
.unwrap();
}
ctx.tombstone_person(person.id, None).await.unwrap();
- let uuids = [person.uuid];
+ let targets = unbounded(&[person.uuid]);
let call = || {
ctx.storage
- .delete_tombstoned_persons(ctx.team_id, &uuids, 4)
+ .delete_tombstoned_persons(ctx.team_id, &targets, 4)
};
let pending = |rows_deleted| TombstonedDeleteOutcome {
pending_uuids: vec![person.uuid],
@@ -3802,7 +3811,7 @@ async fn test_delete_tombstoned_persons_converges_in_ceil_rows_over_budget_calls
loop {
let outcome = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &[person.uuid], 2)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&[person.uuid]), 2)
.await
.unwrap();
calls += 1;
@@ -3848,7 +3857,7 @@ async fn test_delete_tombstoned_persons_blocks_a_person_over_the_budget_that_own
let outcome = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &[person.uuid], TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&[person.uuid]), TEST_MAX_ROWS)
.await
.unwrap();
@@ -3908,7 +3917,7 @@ async fn test_delete_tombstoned_persons_mixed_batch_deletes_the_small_persons_an
let outcome = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &uuids, TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&uuids), TEST_MAX_ROWS)
.await
.expect("Failed to delete tombstoned persons");
@@ -3917,6 +3926,7 @@ async fn test_delete_tombstoned_persons_mixed_batch_deletes_the_small_persons_an
TombstonedDeleteOutcome {
deleted: 5,
skipped_live: 3,
+ skipped_version: 0,
blocked_uuids: vec![blocked.uuid],
pending_uuids: vec![big.uuid],
rows_deleted: 11,
@@ -3967,7 +3977,7 @@ async fn test_delete_tombstoned_persons_leaves_later_persons_pending_once_the_bu
let outcome = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &uuids, 4)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&uuids), 4)
.await
.unwrap();
@@ -4008,7 +4018,7 @@ async fn test_delete_tombstoned_persons_caps_the_persons_deleted_per_call() {
let first = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &uuids, TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&uuids), TEST_MAX_ROWS)
.await
.unwrap();
assert_eq!(
@@ -4024,7 +4034,7 @@ async fn test_delete_tombstoned_persons_caps_the_persons_deleted_per_call() {
let second = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &first.pending_uuids, TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&first.pending_uuids), TEST_MAX_ROWS)
.await
.unwrap();
assert_eq!(
@@ -4061,7 +4071,7 @@ async fn test_delete_tombstoned_persons_clamps_max_rows(
let outcome = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &[person.uuid], max_rows)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&[person.uuid]), max_rows)
.await
.unwrap();
@@ -4089,14 +4099,14 @@ async fn test_delete_tombstoned_persons_second_call_is_a_no_op() {
let first = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &[person.uuid], TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&[person.uuid]), TEST_MAX_ROWS)
.await
.expect("Failed to delete tombstoned persons");
assert_eq!(first.deleted, 1);
let second = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &[person.uuid], TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&[person.uuid]), TEST_MAX_ROWS)
.await
.expect("Failed to delete tombstoned persons");
assert_eq!(second, TombstonedDeleteOutcome::default());
@@ -4113,7 +4123,7 @@ async fn test_delete_tombstoned_persons_nothing_to_do(#[case] uuids: Vec<Uuid>)
let outcome = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &uuids, TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&uuids), TEST_MAX_ROWS)
.await
.expect("Failed to delete tombstoned persons");
@@ -4156,7 +4166,7 @@ async fn test_delete_tombstoned_persons_records_skipped_live_when_nothing_is_tom
let outcome = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &[live.uuid], TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&[live.uuid]), TEST_MAX_ROWS)
.await
.expect("Failed to delete tombstoned persons");
@@ -4179,7 +4189,7 @@ async fn test_delete_tombstoned_persons_cross_team_isolation() {
let outcome = ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &[person.uuid], TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&[person.uuid]), TEST_MAX_ROWS)
.await
.expect("Failed to delete tombstoned persons");
@@ -4222,7 +4232,7 @@ async fn test_primary_writes_give_up_when_a_writer_holds_the_row(#[case] write:
let result = match write {
HeldRowWrite::DeleteTombstoned => ctx
.storage
- .delete_tombstoned_persons(ctx.team_id, &[person.uuid], TEST_MAX_ROWS)
+ .delete_tombstoned_persons(ctx.team_id, &unbounded(&[person.uuid]), TEST_MAX_ROWS)
.await
.map(|_| ()),
HeldRowWrite::EnsurePersonFloor => ctx
@@ -4525,6 +4535,139 @@ async fn test_ensure_version_floors_wait_for_a_concurrent_insert(
ctx.cleanup().await.ok();
}
+#[rstest]
+#[case::unbounded_null_version(1, true, 0, None, true)]
+#[case::at_the_bound(1, false, 0, Some(1), true)]
+#[case::null_version_reads_as_zero(1, true, 0, Some(0), true)]
+#[case::tombstoned_again_above_the_bound(2, false, 0, Some(1), false)]
+#[case::over_the_budget_above_the_bound(2, false, 19, Some(1), false)]
+#[tokio::test]
+async fn test_delete_tombstoned_persons_version_bound(
+ #[case] tombstones: usize,
+ #[case] null_version: bool,
+ #[case] extra_distinct_ids: usize,
+ #[case] max_version: Option<i64>,
+ #[case] expected_deleted: bool,
+) {
+ let ctx = TestContext::new().await;
+ let person = ctx.insert_person("tomb_bound", None).await.unwrap();
+ for i in 0..extra_distinct_ids {
+ ctx.add_distinct_id_to_person(person.id, &format!("tomb_bound_{i}"))
+ .await
+ .unwrap();
+ }
+ for _ in 0..tombstones {
+ ctx.tombstone_person(person.id, None).await.unwrap();
+ }
+ if null_version {
+ sqlx::query("UPDATE posthog_person SET version = NULL WHERE team_id = $1 AND id = $2")
+ .bind(ctx.team_id)
+ .bind(person.id)
+ .execute(&ctx.pool)
+ .await
+ .unwrap();
+ }
+ let target = match max_version {
+ Some(max_version) => TombstoneTarget {
+ uuid: person.uuid,
+ max_version,
+ },
+ None => TombstoneTarget::unbounded(person.uuid),
+ };
+
+ let outcome = ctx
+ .storage
+ .delete_tombstoned_persons(ctx.team_id, &[target], TEST_MAX_ROWS)
+ .await
+ .expect("Failed to delete tombstoned persons");
+
+ let expected = if expected_deleted {
+ TombstonedDeleteOutcome {
+ deleted: 1,
+ rows_deleted: 1,
+ ..TombstonedDeleteOutcome::default()
+ }
+ } else {
+ TombstonedDeleteOutcome {
+ skipped_version: 1,
+ ..TombstonedDeleteOutcome::default()
+ }
+ };
+ assert_eq!(outcome, expected);
+ assert_eq!(
+ ctx.person_row_exists(person.id).await.unwrap(),
+ !expected_deleted
+ );
+ let expected_distinct_ids = if expected_deleted {
+ 0
+ } else {
+ 1 + extra_distinct_ids as i64
+ };
+ assert_eq!(
+ ctx.distinct_id_row_count(person.id).await.unwrap(),
+ expected_distinct_ids
+ );
+
+ ctx.cleanup().await.ok();
+}
+
+#[tokio::test]
+async fn test_delete_tombstoned_persons_rechecks_the_version_bound_under_the_row_lock() {
+ // A writer tombstones the person again while the delete waits for the row lock. The delete
+ // read version 1 before it locked, so only the re-check under the lock sees version 2.
+ let ctx = TestContext::new().await;
+ let person = ctx.insert_person("tomb_bound_race", None).await.unwrap();
+ ctx.tombstone_person(person.id, None).await.unwrap();
+ let mut writer = ctx.pool.begin().await.unwrap();
+ let writer_pid: i32 = sqlx::query_scalar("SELECT pg_backend_pid()")
+ .fetch_one(&mut *writer)
+ .await
+ .unwrap();
+ sqlx::query("UPDATE posthog_person SET version = version + 1 WHERE team_id = $1 AND id = $2")
+ .bind(ctx.team_id)
+ .bind(person.id)
+ .execute(&mut *writer)
+ .await
+ .unwrap();
+
+ let targets = [TombstoneTarget {
+ uuid: person.uuid,
+ max_version: 1,
+ }];
+ let delete = ctx
+ .storage
+ .delete_tombstoned_persons(ctx.team_id, &targets, TEST_MAX_ROWS);
+ let release = async {
+ // Commit only once the delete waits on the writer, which happens only in its lock query.
+ let deadline = Instant::now() + Duration::from_secs(1);
+ loop {
+ let waiting: i64 = sqlx::query_scalar(
+ "SELECT count(*) FROM pg_stat_activity WHERE $1 = ANY(pg_blocking_pids(pid))",
+ )
+ .bind(writer_pid)
+ .fetch_one(&ctx.pool)
+ .await
+ .unwrap();
+ if waiting > 0 {
+ break;
+ }
+ assert!(
+ Instant::now() < deadline,
+ "the delete never waited on the writer"
+ );
+ tokio::time::sleep(Duration::from_millis(10)).await;
+ }
+ writer.commit().await.unwrap();
+ };
+ let (outcome, ()) = tokio::join!(delete, release);
+
+ assert_eq!(outcome.unwrap(), TombstonedDeleteOutcome::default());
+ assert!(ctx.person_row_exists(person.id).await.unwrap());
+ assert_eq!(ctx.distinct_id_row_count(person.id).await.unwrap(), 1);
+
+ ctx.cleanup().await.ok();
+}
+
#[tokio::test]
async fn test_get_distinct_ids_for_person_paginated() {
let ctx = TestContext::new().await;