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.

feat(personhog): batch delete fence and release calls per partition (#100592)

Zach Brown8c2a9b0c8fc1
diff --git a/bin/start-rust-service b/bin/start-rust-service
index 34ab8df56831..0b1eaf481147 100755
--- a/bin/start-rust-service
+++ b/bin/start-rust-service
@@ -305,6 +305,8 @@ case "$RS_SVC" in
export GRPC_ADDRESS=127.0.0.1:50055
export PRIMARY_DATABASE_URL="${PRIMARY_DATABASE_URL:-postgres://posthog:posthog@${PGHOST:-db}:${PGPORT:-5432}/posthog_persons}"
export ROUTER_URL=http://127.0.0.1:50054
+ export ETCD_ENDPOINTS=http://localhost:2379
+ export ETCD_PREFIX=/personhog/
export METRICS_PORT=9108
;;
diff --git a/docker-compose.base.yml b/docker-compose.base.yml
index c9189a1c1a9e..bd162a8f03c9 100644
--- a/docker-compose.base.yml
+++ b/docker-compose.base.yml
@@ -613,6 +613,8 @@ services:
GRPC_ADDRESS: '0.0.0.0:50055'
PRIMARY_DATABASE_URL: 'postgres://posthog:posthog@db:5432/posthog_persons'
ROUTER_URL: 'http://personhog-router-leader:50054'
+ ETCD_ENDPOINTS: 'http://etcd:2379'
+ ETCD_PREFIX: '/personhog/'
RUST_LOG: 'info'
METRICS_PORT: '9108'
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 9c0e24641587..abfb0711a8db 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
@@ -67,6 +67,8 @@ import type {
DeletePersonsResponseSchema,
FencePersonRequestSchema,
FencePersonResponseSchema,
+ FencePersonsRequestSchema,
+ FencePersonsResponseSchema,
FoldPersonDocumentRequestSchema,
FoldPersonDocumentResponseSchema,
GetDistinctIdsForPersonRequestSchema,
@@ -86,6 +88,8 @@ import type {
PersonsResponseSchema,
ReleaseFenceRequestSchema,
ReleaseFenceResponseSchema,
+ ReleaseFencesRequestSchema,
+ ReleaseFencesResponseSchema,
SetPersonDistinctIdVersionFloorRequestSchema,
SetPersonDistinctIdVersionFloorResponseSchema,
SetPersonVersionFloorRequestSchema,
@@ -103,7 +107,7 @@ import { file_personhog_types_v1_person } from '../../types/v1/person_pb'
export const file_personhog_service_v1_service: GenFile =
/*@__PURE__*/
fileDesc(
- 'CiJwZXJzb25ob2cvc2VydmljZS92MS9zZXJ2aWNlLnByb3RvEhRwZXJzb25ob2cuc2VydmljZS52MTKOKQoQUGVyc29uSG9nU2VydmljZRJYCglHZXRQZXJzb24SJC5wZXJzb25ob2cudHlwZXMudjEuR2V0UGVyc29uUmVxdWVzdBolLnBlcnNvbmhvZy50eXBlcy52MS5HZXRQZXJzb25SZXNwb25zZRJYCgpHZXRQZXJzb25zEiUucGVyc29uaG9nLnR5cGVzLnYxLkdldFBlcnNvbnNSZXF1ZXN0GiMucGVyc29uaG9nLnR5cGVzLnYxLlBlcnNvbnNSZXNwb25zZRJkCg9HZXRQZXJzb25CeVV1aWQSKi5wZXJzb25ob2cudHlwZXMudjEuR2V0UGVyc29uQnlVdWlkUmVxdWVzdBolLnBlcnNvbmhvZy50eXBlcy52MS5HZXRQZXJzb25SZXNwb25zZRJmChFHZXRQZXJzb25zQnlVdWlkcxIsLnBlcnNvbmhvZy50eXBlcy52MS5HZXRQZXJzb25zQnlVdWlkc1JlcXVlc3QaIy5wZXJzb25ob2cudHlwZXMudjEuUGVyc29uc1Jlc3BvbnNlEnAKFUdldFBlcnNvbkJ5RGlzdGluY3RJZBIwLnBlcnNvbmhvZy50eXBlcy52MS5HZXRQZXJzb25CeURpc3RpbmN0SWRSZXF1ZXN0GiUucGVyc29uaG9nLnR5cGVzLnYxLkdldFBlcnNvblJlc3BvbnNlEpEBCh1HZXRQZXJzb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IoLnBlcnNvbmhvZy50eXBlcy52MS5EZWxldGVQZXJzb25zUmVxdWVzdBopLnBlcnNvbmhvZy50eXBlcy52MS5EZWxldGVQZXJzb25zUmVzcG9uc2USiAEKGURlbGV0ZVBlcnNvbnNCYXRjaEZvclRlYW0SNC5wZXJzb25ob2cudHlwZXMudjEuRGVsZXRlUGVyc29uc0JhdGNoRm9yVGVhbVJlcXVlc3QaNS5wZXJzb25ob2cudHlwZXMudjEuRGVsZXRlUGVyc29uc0JhdGNoRm9yVGVhbVJlc3BvbnNlEl4KC1NwbGl0UGVyc29uEiYucGVyc29uaG9nLnR5cGVzLnYxLlNwbGl0UGVyc29uUmVxdWVzdBonLnBlcnNvbmhvZy50eXBlcy52MS5TcGxpdFBlcnNvblJlc3BvbnNlEpoBCh9TZXRQZXJzb25EaXN0aW5jdElkVmVyc2lvbkZsb29yEjoucGVyc29uaG9nLnR5cGVzLnYxLlNldFBlcnNvbkRpc3RpbmN0SWRWZXJzaW9uRmxvb3JSZXF1ZXN0GjsucGVyc29uaG9nLnR5cGVzLnYxLlNldFBlcnNvbkRpc3RpbmN0SWRWZXJzaW9uRmxvb3JSZXNwb25zZRJ8ChVTZXRQZXJzb25WZXJzaW9uRmxvb3ISMC5wZXJzb25ob2cudHlwZXMudjEuU2V0UGVyc29uVmVyc2lvbkZsb29yUmVxdWVzdBoxLnBlcnNvbmhvZy50eXBlcy52MS5TZXRQZXJzb25WZXJzaW9uRmxvb3JSZXNwb25zZWIGcHJvdG8z',
[
file_personhog_types_v1_person,
file_personhog_types_v1_group,
@@ -431,6 +435,14 @@ export const PersonHogService: GenService<{
input: typeof FencePersonRequestSchema
output: typeof FencePersonResponseSchema
}
+ /**
+ * @generated from rpc personhog.service.v1.PersonHogService.FencePersons
+ */
+ fencePersons: {
+ methodKind: 'unary'
+ input: typeof FencePersonsRequestSchema
+ output: typeof FencePersonsResponseSchema
+ }
/**
* @generated from rpc personhog.service.v1.PersonHogService.ReleaseFence
*/
@@ -439,6 +451,14 @@ export const PersonHogService: GenService<{
input: typeof ReleaseFenceRequestSchema
output: typeof ReleaseFenceResponseSchema
}
+ /**
+ * @generated from rpc personhog.service.v1.PersonHogService.ReleaseFences
+ */
+ releaseFences: {
+ methodKind: 'unary'
+ input: typeof ReleaseFencesRequestSchema
+ output: typeof ReleaseFencesResponseSchema
+ }
/**
* @generated from rpc personhog.service.v1.PersonHogService.FoldPersonDocument
*/
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 9b843884d10f..accc392d47ca 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(
- 'Ch9wZXJzb25ob2cvdHlwZXMvdjEvcGVyc29uLnByb3RvEhJwZXJzb25ob2cudHlwZXMudjEisgIKBlBlcnNvbhIKCgJpZBgBIAEoAxIMCgR1dWlkGAIgASgJEg8KB3RlYW1faWQYAyABKAMSEgoKcHJvcGVydGllcxgEIAEoDBIiChpwcm9wZXJ0aWVzX2xhc3RfdXBkYXRlZF9hdBgFIAEoDBIhChlwcm9wZXJ0aWVzX2xhc3Rfb3BlcmF0aW9uGAYgASgMEhIKCmNyZWF0ZWRfYXQYByABKAMSDwoHdmVyc2lvbhgIIAEoAxIVCg1pc19pZGVudGlmaWVkGAkgASgIEhcKCmlzX3VzZXJfaWQYCiABKAhIAIgBARIZCgxsYXN0X3NlZW5fYXQYCyABKANIAYgBARISCgppc19kZWxldGVkGAwgASgIQg0KC19pc191c2VyX2lkQg8KDV9sYXN0X3NlZW5fYXQiTgoVRGlzdGluY3RJZFdpdGhWZXJzaW9uEhMKC2Rpc3RpbmN0X2lkGAEgASgJEhQKB3ZlcnNpb24YAiABKANIAIgBAUIKCghfdmVyc2lvb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VfT1BfVFlQRV9ERUxFVEUQARIbChdMSUZFQ1lDTEVfT1BfVFlQRV9NRVJHRRACKm0KDlJlbGVhc2VPdXRjb21lEh8KG1JFTEVBU0VfT1VUQ09NRV9VTlNQRUNJRklFRBAAEh0KGVJFTEVBU0VfT1VUQ09NRV9DT01NSVRURUQQARIbChdSRUxFQVNFX09VVENPTUVfQUJPUlRFRBACYgZwcm90bzM',
[file_personhog_types_v1_common]
)
@@ -1084,6 +1084,110 @@ export const FencePersonResponseSchema: GenMessage<FencePersonResponse> =
/*@__PURE__*/
messageDesc(file_personhog_types_v1_person, 34)
+/**
+ * FencePersonsRequest freezes many persons of one op in one call (see
+ * PersonHogLeader.FencePersons). The saga sends one call per partition
+ * of the op, routed by one of the persons like a single fence.
+ *
+ * @generated from message personhog.types.v1.FencePersonsRequest
+ */
+export type FencePersonsRequest = Message<'personhog.types.v1.FencePersonsRequest'> & {
+ /**
+ * @generated from field: int64 team_id = 1;
+ */
+ teamId: bigint
+
+ /**
+ * @generated from field: string op_id = 2;
+ */
+ opId: string
+
+ /**
+ * @generated from field: personhog.types.v1.LifecycleOpType op_type = 3;
+ */
+ opType: LifecycleOpType
+
+ /**
+ * @generated from field: repeated int64 person_ids = 4;
+ */
+ personIds: bigint[]
+}
+
+/**
+ * Describes the message personhog.types.v1.FencePersonsRequest.
+ * Use `create(FencePersonsRequestSchema)` to create a new message.
+ */
+export const FencePersonsRequestSchema: GenMessage<FencePersonsRequest> =
+ /*@__PURE__*/
+ messageDesc(file_personhog_types_v1_person, 35)
+
+/**
+ * Every requested person id lands in exactly one of the two lists; a
+ * failure any single FencePerson reports through its status, other than
+ * NOT_FOUND, fails the whole call the same way.
+ *
+ * @generated from message personhog.types.v1.FencePersonsResponse
+ */
+export type FencePersonsResponse = Message<'personhog.types.v1.FencePersonsResponse'> & {
+ /**
+ * The sealed scalars of every person fenced: what the delete saga reads
+ * from a seal. Full documents would not fit a batch, and the merge saga,
+ * which folds the document, fences one person at a time.
+ *
+ * @generated from field: repeated personhog.types.v1.FencedPersonSeal sealed = 1;
+ */
+ sealed: FencedPersonSeal[]
+
+ /**
+ * The persons a single FencePerson answers NOT_FOUND for: destroyed, so
+ * no fence was installed.
+ *
+ * @generated from field: repeated int64 not_found = 2;
+ */
+ notFound: bigint[]
+}
+
+/**
+ * Describes the message personhog.types.v1.FencePersonsResponse.
+ * Use `create(FencePersonsResponseSchema)` to create a new message.
+ */
+export const FencePersonsResponseSchema: GenMessage<FencePersonsResponse> =
+ /*@__PURE__*/
+ messageDesc(file_personhog_types_v1_person, 36)
+
+/**
+ * @generated from message personhog.types.v1.FencedPersonSeal
+ */
+export type FencedPersonSeal = Message<'personhog.types.v1.FencedPersonSeal'> & {
+ /**
+ * @generated from field: int64 person_id = 1;
+ */
+ personId: bigint
+
+ /**
+ * See FencePersonResponse.sealed: the version the fence made final.
+ *
+ * @generated from field: int64 version = 2;
+ */
+ version: bigint
+
+ /**
+ * The person's creation time in epoch milliseconds, as the death
+ * document carries it (see ReleaseFenceRequest.created_at).
+ *
+ * @generated from field: int64 created_at = 3;
+ */
+ createdAt: bigint
+}
+
+/**
+ * Describes the message personhog.types.v1.FencedPersonSeal.
+ * Use `create(FencedPersonSealSchema)` to create a new message.
+ */
+export const FencedPersonSealSchema: GenMessage<FencedPersonSeal> =
+ /*@__PURE__*/
+ messageDesc(file_personhog_types_v1_person, 37)
+
/**
* ReleaseFenceRequest closes a fence (see PersonHogLeader.ReleaseFence).
* person_uuid, sealed_version, and created_at travel in the request so a
@@ -1150,7 +1254,7 @@ export type ReleaseFenceRequest = Message<'personhog.types.v1.ReleaseFenceReques
*/
export const ReleaseFenceRequestSchema: GenMessage<ReleaseFenceRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 35)
+ messageDesc(file_personhog_types_v1_person, 38)
/**
* @generated from message personhog.types.v1.ReleaseFenceResponse
@@ -1163,7 +1267,94 @@ export type ReleaseFenceResponse = Message<'personhog.types.v1.ReleaseFenceRespo
*/
export const ReleaseFenceResponseSchema: GenMessage<ReleaseFenceResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 36)
+ messageDesc(file_personhog_types_v1_person, 39)
+
+/**
+ * ReleaseFencesRequest closes many fences of one op in one call (see
+ * PersonHogLeader.ReleaseFences), one call per partition of the op.
+ * Per-person fields carry what ReleaseFenceRequest carries.
+ *
+ * @generated from message personhog.types.v1.ReleaseFencesRequest
+ */
+export type ReleaseFencesRequest = Message<'personhog.types.v1.ReleaseFencesRequest'> & {
+ /**
+ * @generated from field: int64 team_id = 1;
+ */
+ teamId: bigint
+
+ /**
+ * @generated from field: string op_id = 2;
+ */
+ opId: string
+
+ /**
+ * @generated from field: personhog.types.v1.ReleaseOutcome outcome = 3;
+ */
+ outcome: ReleaseOutcome
+
+ /**
+ * @generated from field: repeated personhog.types.v1.ReleaseFenceItem persons = 4;
+ */
+ persons: ReleaseFenceItem[]
+}
+
+/**
+ * Describes the message personhog.types.v1.ReleaseFencesRequest.
+ * Use `create(ReleaseFencesRequestSchema)` to create a new message.
+ */
+export const ReleaseFencesRequestSchema: GenMessage<ReleaseFencesRequest> =
+ /*@__PURE__*/
+ messageDesc(file_personhog_types_v1_person, 40)
+
+/**
+ * @generated from message personhog.types.v1.ReleaseFenceItem
+ */
+export type ReleaseFenceItem = Message<'personhog.types.v1.ReleaseFenceItem'> & {
+ /**
+ * @generated from field: int64 person_id = 1;
+ */
+ personId: bigint
+
+ /**
+ * @generated from field: string person_uuid = 2;
+ */
+ personUuid: string
+
+ /**
+ * See ReleaseFenceRequest.sealed_version.
+ *
+ * @generated from field: optional int64 sealed_version = 3;
+ */
+ sealedVersion?: bigint
+
+ /**
+ * See ReleaseFenceRequest.created_at.
+ *
+ * @generated from field: int64 created_at = 4;
+ */
+ createdAt: bigint
+}
+
+/**
+ * Describes the message personhog.types.v1.ReleaseFenceItem.
+ * Use `create(ReleaseFenceItemSchema)` to create a new message.
+ */
+export const ReleaseFenceItemSchema: GenMessage<ReleaseFenceItem> =
+ /*@__PURE__*/
+ messageDesc(file_personhog_types_v1_person, 41)
+
+/**
+ * @generated from message personhog.types.v1.ReleaseFencesResponse
+ */
+export type ReleaseFencesResponse = Message<'personhog.types.v1.ReleaseFencesResponse'> & {}
+
+/**
+ * Describes the message personhog.types.v1.ReleaseFencesResponse.
+ * Use `create(ReleaseFencesResponseSchema)` to create a new message.
+ */
+export const ReleaseFencesResponseSchema: GenMessage<ReleaseFencesResponse> =
+ /*@__PURE__*/
+ messageDesc(file_personhog_types_v1_person, 42)
/**
* A sealed source snapshot paired with its precedence ordinal — the
@@ -1191,7 +1382,7 @@ export type SealedSourceSnapshot = Message<'personhog.types.v1.SealedSourceSnaps
*/
export const SealedSourceSnapshotSchema: GenMessage<SealedSourceSnapshot> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 37)
+ messageDesc(file_personhog_types_v1_person, 43)
/**
* FoldPersonDocumentRequest folds sealed source snapshots into the merge
@@ -1267,7 +1458,7 @@ export type FoldPersonDocumentRequest = Message<'personhog.types.v1.FoldPersonDo
*/
export const FoldPersonDocumentRequestSchema: GenMessage<FoldPersonDocumentRequest> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 38)
+ messageDesc(file_personhog_types_v1_person, 44)
/**
* @generated from message personhog.types.v1.FoldPersonDocumentResponse
@@ -1295,7 +1486,7 @@ export type FoldPersonDocumentResponse = Message<'personhog.types.v1.FoldPersonD
*/
export const FoldPersonDocumentResponseSchema: GenMessage<FoldPersonDocumentResponse> =
/*@__PURE__*/
- messageDesc(file_personhog_types_v1_person, 39)
+ messageDesc(file_personhog_types_v1_person, 45)
/**
* The kind of lifecycle operation — mirrors lifecycle_op.op_type. The
diff --git a/nodejs/src/common/personhog/client.test.ts b/nodejs/src/common/personhog/client.test.ts
index 55ea8f889ac2..0ac92b499d64 100644
--- a/nodejs/src/common/personhog/client.test.ts
+++ b/nodejs/src/common/personhog/client.test.ts
@@ -137,7 +137,9 @@ const SERVICE_DEFAULTS: ServiceImpl<typeof PersonHogService> = {
setPersonDistinctIdVersionFloor: () => ({}),
setPersonVersionFloor: () => ({ updated: false }),
fencePerson: () => ({}),
+ fencePersons: () => ({}),
releaseFence: () => ({}),
+ releaseFences: () => ({}),
foldPersonDocument: () => ({}),
}
diff --git a/nodejs/src/common/personhog/persons.test.ts b/nodejs/src/common/personhog/persons.test.ts
index 49fbb681806f..5a9111dbdd73 100644
--- a/nodejs/src/common/personhog/persons.test.ts
+++ b/nodejs/src/common/personhog/persons.test.ts
@@ -75,7 +75,9 @@ const SERVICE_DEFAULTS: ServiceImpl<typeof PersonHogService> = {
setPersonDistinctIdVersionFloor: () => ({}),
setPersonVersionFloor: () => ({ updated: false }),
fencePerson: () => ({}),
+ fencePersons: () => ({}),
releaseFence: () => ({}),
+ releaseFences: () => ({}),
foldPersonDocument: () => ({}),
}
diff --git a/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2.py b/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2.py
index a0c0dce60d5a..c00c50a7ca20 100644
--- a/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2.py
+++ b/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2.py
@@ -20,7 +20,7 @@ from ....personhog.types.v1 import (
)
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
- b"\n\"personhog/service/v1/service.proto\x12\x14personhog.service.v1\x1a\x1fpersonhog/types/v1/person.proto\x1a\x1epersonhog/types/v1/group.proto\x1a\x1fpersonhog/types/v1/cohort.proto\x1a%personhog/types/v1/feature_flag.proto2\x8e)\n\x10PersonHogService\x12X\n\tGetPerson\x12$.personhog.types.v1.GetPersonRequest\x1a%.personhog.types.v1.GetPersonResponse\x12X\n\nGetPersons\x12%.personhog.types.v1.GetPersonsRequest\x1a#.personhog.types.v1.PersonsResponse\x12d\n\x0fGetPersonByUuid\x12*.personhog.types.v1.GetPersonByUuidRequest\x1a%.personhog.types.v1.GetPersonResponse\x12f\n\x11GetPersonsByUuids\x12,.personhog.types.v1.GetPersonsByUuidsRequest\x1a#.personhog.types.v1.PersonsResponse\x12p\n\x15GetPersonByDistinctId\x120.personhog.types.v1.GetPersonByDistinctIdRequest\x1a%.personhog.types.v1.GetPersonResponse\x12\x91\x01\n\x1dGetPersonsByDistinctIdsInTeam\x128.personhog.types.v1.GetPersonsByDistinctIdsInTeamRequest\x1a6.personhog.types.v1.PersonsByDistinctIdsInTeamResponse\x12\x7f\n\x17GetPersonsByDistinctIds\x122.personhog.types.v1.GetPersonsByDistinctIdsRequest\x1a0.personhog.types.v1.PersonsByDistinctIdsResponse\x12\x82\x01\n\x17GetDistinctIdsForPerson\x122.personhog.types.v1.GetDistinctIdsForPersonRequest\x1a3.personhog.types.v1.GetDistinctIdsForPersonResponse\x12\x85\x01\n\x18GetDistinctIdsForPersons\x123.personhog.types.v1.GetDistinctIdsForPersonsRequest\x1a4.personhog.types.v1.GetDistinctIdsForPersonsResponse\x12\x88\x01\n\x19GetHashKeyOverrideContext\x124.personhog.types.v1.GetHashKeyOverrideContextRequest\x1a5.personhog.types.v1.GetHashKeyOverrideContextResponse\x12\x7f\n\x16UpsertHashKeyOverrides\x121.personhog.types.v1.UpsertHashKeyOverridesRequest\x1a2.personhog.types.v1.UpsertHashKeyOverridesResponse\x12\x94\x01\n\x1dDeleteHashKeyOverridesByTeams\x128.personhog.types.v1.DeleteHashKeyOverridesByTeamsRequest\x1a9.personhog.types.v1.DeleteHashKeyOverridesByTeamsResponse\x12w\n\x15CheckCohortMembership\x120.personhog.types.v1.CheckCohortMembershipRequest\x1a,.personhog.types.v1.CohortMembershipResponse\x12s\n\x12CountCohortMembers\x12-.personhog.types.v1.CountCohortMembersRequest\x1a..personhog.types.v1.CountCohortMembersResponse\x12s\n\x12DeleteCohortMember\x12-.personhog.types.v1.DeleteCohortMemberRequest\x1a..personhog.types.v1.DeleteCohortMemberResponse\x12\x82\x01\n\x17DeleteCohortMembersBulk\x122.personhog.types.v1.DeleteCohortMembersBulkRequest\x1a3.personhog.types.v1.DeleteCohortMembersBulkResponse\x12v\n\x13InsertCohortMembers\x12..personhog.types.v1.InsertCohortMembersRequest\x1a/.personhog.types.v1.InsertCohortMembersResponse\x12v\n\x13ListCohortMemberIds\x12..personhog.types.v1.ListCohortMemberIdsRequest\x1a/.personhog.types.v1.ListCohortMemberIdsResponse\x12U\n\x08GetGroup\x12#.personhog.types.v1.GetGroupRequest\x1a$.personhog.types.v1.GetGroupResponse\x12U\n\tGetGroups\x12$.personhog.types.v1.GetGroupsRequest\x1a\".personhog.types.v1.GroupsResponse\x12g\n\x0eGetGroupsBatch\x12).personhog.types.v1.GetGroupsBatchRequest\x1a*.personhog.types.v1.GetGroupsBatchResponse\x12[\n\nListGroups\x12%.personhog.types.v1.ListGroupsRequest\x1a&.personhog.types.v1.ListGroupsResponse\x12\x86\x01\n\x1cGetGroupTypeMappingsByTeamId\x127.personhog.types.v1.GetGroupTypeMappingsByTeamIdRequest\x1a-.personhog.types.v1.GroupTypeMappingsResponse\x12\x8d\x01\n\x1dGetGroupTypeMappingsByTeamIds\x128.personhog.types.v1.GetGroupTypeMappingsByTeamIdsRequest\x1a2.personhog.types.v1.GroupTypeMappingsBatchResponse\x12\x8c\x01\n\x1fGetGroupTypeMappingsByProjectId\x12:.personhog.types.v1.GetGroupTypeMappingsByProjectIdRequest\x1a-.personhog.types.v1.GroupTypeMappingsResponse\x12\x93\x01\n GetGroupTypeMappingsByProjectIds\x12;.personhog.types.v1.GetGroupTypeMappingsByProjectIdsRequest\x1a2.personhog.types.v1.GroupTypeMappingsBatchResponse\x12\x9d\x01\n GetGroupTypeMappingByDashboardId\x12;.personhog.types.v1.GetGroupTypeMappingByDashboardIdRequest\x1a<.personhog.types.v1.GetGroupTypeMappingByDashboardIdResponse\x12\x7f\n\x16CountGroupTypeMappings\x121.personhog.types.v1.CountGroupTypeMappingsRequest\x1a2.personhog.types.v1.CountGroupTypeMappingsResponse\x12^\n\x0bCreateGroup\x12&.personhog.types.v1.CreateGroupRequest\x1a'.personhog.types.v1.CreateGroupResponse\x12^\n\x0bUpdateGroup\x12&.personhog.types.v1.UpdateGroupRequest\x1a'.personhog.types.v1.UpdateGroupResponse\x12\x85\x01\n\x18DeleteGroupsBatchForTeam\x123.personhog.types.v1.DeleteGroupsBatchForTeamRequest\x1a4.personhog.types.v1.DeleteGroupsBatchForTeamResponse\x12\x7f\n\x16UpdateGroupTypeMapping\x121.personhog.types.v1.UpdateGroupTypeMappingRequest\x1a2.personhog.types.v1.UpdateGroupTypeMappingResponse\x12\x7f\n\x16DeleteGroupTypeMapping\x121.personhog.types.v1.DeleteGroupTypeMappingRequest\x1a2.personhog.types.v1.DeleteGroupTypeMappingResponse\x12\xa6\x01\n#DeleteGroupTypeMappingsBatchForTeam\x12>.personhog.types.v1.DeleteGroupTypeMappingsBatchForTeamRequest\x1a?.personhog.types.v1.DeleteGroupTypeMappingsBatchForTeamResponse\x12\x7f\n\x16UpdatePersonProperties\x121.personhog.types.v1.UpdatePersonPropertiesRequest\x1a2.personhog.types.v1.UpdatePersonPropertiesResponse\x12^\n\x0bFencePerson\x12&.personhog.types.v1.FencePersonRequest\x1a'.personhog.types.v1.FencePersonResponse\x12a\n\x0cReleaseFence\x12'.personhog.types.v1.ReleaseFenceRequest\x1a(.personhog.types.v1.ReleaseFenceResponse\x12s\n\x12FoldPersonDocument\x12-.personhog.types.v1.FoldPersonDocumentRequest\x1a..personhog.types.v1.FoldPersonDocumentResponse\x12d\n\rDeletePersons\x12(.personhog.types.v1.DeletePersonsRequest\x1a).personhog.types.v1.DeletePersonsResponse\x12\x88\x01\n\x19DeletePersonsBatchForTeam\x124.personhog.types.v1.DeletePersonsBatchForTeamRequest\x1a5.personhog.types.v1.DeletePersonsBatchForTeamResponse\x12^\n\x0bSplitPerson\x12&.personhog.types.v1.SplitPersonRequest\x1a'.personhog.types.v1.SplitPersonResponse\x12\x9a\x01\n\x1fSetPersonDistinctIdVersionFloor\x12:.personhog.types.v1.SetPersonDistinctIdVersionFloorRequest\x1a;.personhog.types.v1.SetPersonDistinctIdVersionFloorResponse\x12|\n\x15SetPersonVersionFloor\x120.personhog.types.v1.SetPersonVersionFloorRequest\x1a1.personhog.types.v1.SetPersonVersionFloorResponseb\x06proto3"
+ b"\n\"personhog/service/v1/service.proto\x12\x14personhog.service.v1\x1a\x1fpersonhog/types/v1/person.proto\x1a\x1epersonhog/types/v1/group.proto\x1a\x1fpersonhog/types/v1/cohort.proto\x1a%personhog/types/v1/feature_flag.proto2\xd7*\n\x10PersonHogService\x12X\n\tGetPerson\x12$.personhog.types.v1.GetPersonRequest\x1a%.personhog.types.v1.GetPersonResponse\x12X\n\nGetPersons\x12%.personhog.types.v1.GetPersonsRequest\x1a#.personhog.types.v1.PersonsResponse\x12d\n\x0fGetPersonByUuid\x12*.personhog.types.v1.GetPersonByUuidRequest\x1a%.personhog.types.v1.GetPersonResponse\x12f\n\x11GetPersonsByUuids\x12,.personhog.types.v1.GetPersonsByUuidsRequest\x1a#.personhog.types.v1.PersonsResponse\x12p\n\x15GetPersonByDistinctId\x120.personhog.types.v1.GetPersonByDistinctIdRequest\x1a%.personhog.types.v1.GetPersonResponse\x12\x91\x01\n\x1dGetPersonsByDistinctIdsInTeam\x128.personhog.types.v1.GetPersonsByDistinctIdsInTeamRequest\x1a6.personhog.types.v1.PersonsByDistinctIdsInTeamResponse\x12\x7f\n\x17GetPersonsByDistinctIds\x122.personhog.types.v1.GetPersonsByDistinctIdsRequest\x1a0.personhog.types.v1.PersonsByDistinctIdsResponse\x12\x82\x01\n\x17GetDistinctIdsForPerson\x122.personhog.types.v1.GetDistinctIdsForPersonRequest\x1a3.personhog.types.v1.GetDistinctIdsForPersonResponse\x12\x85\x01\n\x18GetDistinctIdsForPersons\x123.personhog.types.v1.GetDistinctIdsForPersonsRequest\x1a4.personhog.types.v1.GetDistinctIdsForPersonsResponse\x12\x88\x01\n\x19GetHashKeyOverrideContext\x124.personhog.types.v1.GetHashKeyOverrideContextRequest\x1a5.personhog.types.v1.GetHashKeyOverrideContextResponse\x12\x7f\n\x16UpsertHashKeyOverrides\x121.personhog.types.v1.UpsertHashKeyOverridesRequest\x1a2.personhog.types.v1.UpsertHashKeyOverridesResponse\x12\x94\x01\n\x1dDeleteHashKeyOverridesByTeams\x128.personhog.types.v1.DeleteHashKeyOverridesByTeamsRequest\x1a9.personhog.types.v1.DeleteHashKeyOverridesByTeamsResponse\x12w\n\x15CheckCohortMembership\x120.personhog.types.v1.CheckCohortMembershipRequest\x1a,.personhog.types.v1.CohortMembershipResponse\x12s\n\x12CountCohortMembers\x12-.personhog.types.v1.CountCohortMembersRequest\x1a..personhog.types.v1.CountCohortMembersResponse\x12s\n\x12DeleteCohortMember\x12-.personhog.types.v1.DeleteCohortMemberRequest\x1a..personhog.types.v1.DeleteCohortMemberResponse\x12\x82\x01\n\x17DeleteCohortMembersBulk\x122.personhog.types.v1.DeleteCohortMembersBulkRequest\x1a3.personhog.types.v1.DeleteCohortMembersBulkResponse\x12v\n\x13InsertCohortMembers\x12..personhog.types.v1.InsertCohortMembersRequest\x1a/.personhog.types.v1.InsertCohortMembersResponse\x12v\n\x13ListCohortMemberIds\x12..personhog.types.v1.ListCohortMemberIdsRequest\x1a/.personhog.types.v1.ListCohortMemberIdsResponse\x12U\n\x08GetGroup\x12#.personhog.types.v1.GetGroupRequest\x1a$.personhog.types.v1.GetGroupResponse\x12U\n\tGetGroups\x12$.personhog.types.v1.GetGroupsRequest\x1a\".personhog.types.v1.GroupsResponse\x12g\n\x0eGetGroupsBatch\x12).personhog.types.v1.GetGroupsBatchRequest\x1a*.personhog.types.v1.GetGroupsBatchResponse\x12[\n\nListGroups\x12%.personhog.types.v1.ListGroupsRequest\x1a&.personhog.types.v1.ListGroupsResponse\x12\x86\x01\n\x1cGetGroupTypeMappingsByTeamId\x127.personhog.types.v1.GetGroupTypeMappingsByTeamIdRequest\x1a-.personhog.types.v1.GroupTypeMappingsResponse\x12\x8d\x01\n\x1dGetGroupTypeMappingsByTeamIds\x128.personhog.types.v1.GetGroupTypeMappingsByTeamIdsRequest\x1a2.personhog.types.v1.GroupTypeMappingsBatchResponse\x12\x8c\x01\n\x1fGetGroupTypeMappingsByProjectId\x12:.personhog.types.v1.GetGroupTypeMappingsByProjectIdRequest\x1a-.personhog.types.v1.GroupTypeMappingsResponse\x12\x93\x01\n GetGroupTypeMappingsByProjectIds\x12;.personhog.types.v1.GetGroupTypeMappingsByProjectIdsRequest\x1a2.personhog.types.v1.GroupTypeMappingsBatchResponse\x12\x9d\x01\n GetGroupTypeMappingByDashboardId\x12;.personhog.types.v1.GetGroupTypeMappingByDashboardIdRequest\x1a<.personhog.types.v1.GetGroupTypeMappingByDashboardIdResponse\x12\x7f\n\x16CountGroupTypeMappings\x121.personhog.types.v1.CountGroupTypeMappingsRequest\x1a2.personhog.types.v1.CountGroupTypeMappingsResponse\x12^\n\x0bCreateGroup\x12&.personhog.types.v1.CreateGroupRequest\x1a'.personhog.types.v1.CreateGroupResponse\x12^\n\x0bUpdateGroup\x12&.personhog.types.v1.UpdateGroupRequest\x1a'.personhog.types.v1.UpdateGroupResponse\x12\x85\x01\n\x18DeleteGroupsBatchForTeam\x123.personhog.types.v1.DeleteGroupsBatchForTeamRequest\x1a4.personhog.types.v1.DeleteGroupsBatchForTeamResponse\x12\x7f\n\x16UpdateGroupTypeMapping\x121.personhog.types.v1.UpdateGroupTypeMappingRequest\x1a2.personhog.types.v1.UpdateGroupTypeMappingResponse\x12\x7f\n\x16DeleteGroupTypeMapping\x121.personhog.types.v1.DeleteGroupTypeMappingRequest\x1a2.personhog.types.v1.DeleteGroupTypeMappingResponse\x12\xa6\x01\n#DeleteGroupTypeMappingsBatchForTeam\x12>.personhog.types.v1.DeleteGroupTypeMappingsBatchForTeamRequest\x1a?.personhog.types.v1.DeleteGroupTypeMappingsBatchForTeamResponse\x12\x7f\n\x16UpdatePersonProperties\x121.personhog.types.v1.UpdatePersonPropertiesRequest\x1a2.personhog.types.v1.UpdatePersonPropertiesResponse\x12^\n\x0bFencePerson\x12&.personhog.types.v1.FencePersonRequest\x1a'.personhog.types.v1.FencePersonResponse\x12a\n\x0cFencePersons\x12'.personhog.types.v1.FencePersonsRequest\x1a(.personhog.types.v1.FencePersonsResponse\x12a\n\x0cReleaseFence\x12'.personhog.types.v1.ReleaseFenceRequest\x1a(.personhog.types.v1.ReleaseFenceResponse\x12d\n\rReleaseFences\x12(.personhog.types.v1.ReleaseFencesRequest\x1a).personhog.types.v1.ReleaseFencesResponse\x12s\n\x12FoldPersonDocument\x12-.personhog.types.v1.FoldPersonDocumentRequest\x1a..personhog.types.v1.FoldPersonDocumentResponse\x12d\n\rDeletePersons\x12(.personhog.types.v1.DeletePersonsRequest\x1a).personhog.types.v1.DeletePersonsResponse\x12\x88\x01\n\x19DeletePersonsBatchForTeam\x124.personhog.types.v1.DeletePersonsBatchForTeamRequest\x1a5.personhog.types.v1.DeletePersonsBatchForTeamResponse\x12^\n\x0bSplitPerson\x12&.personhog.types.v1.SplitPersonRequest\x1a'.personhog.types.v1.SplitPersonResponse\x12\x9a\x01\n\x1fSetPersonDistinctIdVersionFloor\x12:.personhog.types.v1.SetPersonDistinctIdVersionFloorRequest\x1a;.personhog.types.v1.SetPersonDistinctIdVersionFloorResponse\x12|\n\x15SetPersonVersionFloor\x120.personhog.types.v1.SetPersonVersionFloorRequest\x1a1.personhog.types.v1.SetPersonVersionFloorResponseb\x06proto3"
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -28,4 +28,4 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "personhog.service.v1.servic
if not _descriptor._USE_C_DESCRIPTORS:
DESCRIPTOR._loaded_options = None
_globals["_PERSONHOGSERVICE"]._serialized_start = 198
- _globals["_PERSONHOGSERVICE"]._serialized_end = 5460
+ _globals["_PERSONHOGSERVICE"]._serialized_end = 5661
diff --git a/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2_grpc.py b/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2_grpc.py
index 8c6a68ea8d31..75dc605c82e9 100644
--- a/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2_grpc.py
+++ b/posthog/personhog_client/proto/generated/personhog/service/v1/service_pb2_grpc.py
@@ -255,12 +255,24 @@ class PersonHogServiceStub:
response_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.FencePersonResponse.FromString,
_registered_method=True,
)
+ self.FencePersons = channel.unary_unary(
+ "/personhog.service.v1.PersonHogService/FencePersons",
+ request_serializer=personhog_dot_types_dot_v1_dot_person__pb2.FencePersonsRequest.SerializeToString,
+ response_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.FencePersonsResponse.FromString,
+ _registered_method=True,
+ )
self.ReleaseFence = channel.unary_unary(
"/personhog.service.v1.PersonHogService/ReleaseFence",
request_serializer=personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFenceRequest.SerializeToString,
response_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFenceResponse.FromString,
_registered_method=True,
)
+ self.ReleaseFences = channel.unary_unary(
+ "/personhog.service.v1.PersonHogService/ReleaseFences",
+ request_serializer=personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFencesRequest.SerializeToString,
+ response_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFencesResponse.FromString,
+ _registered_method=True,
+ )
self.FoldPersonDocument = channel.unary_unary(
"/personhog.service.v1.PersonHogService/FoldPersonDocument",
request_serializer=personhog_dot_types_dot_v1_dot_person__pb2.FoldPersonDocumentRequest.SerializeToString,
@@ -523,12 +535,24 @@ class PersonHogServiceServicer:
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
+ def FencePersons(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details("Method not implemented!")
+ raise NotImplementedError("Method not implemented!")
+
def ReleaseFence(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
+ def ReleaseFences(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details("Method not implemented!")
+ raise NotImplementedError("Method not implemented!")
+
def FoldPersonDocument(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@@ -756,11 +780,21 @@ def add_PersonHogServiceServicer_to_server(servicer, server):
request_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.FencePersonRequest.FromString,
response_serializer=personhog_dot_types_dot_v1_dot_person__pb2.FencePersonResponse.SerializeToString,
),
+ "FencePersons": grpc.unary_unary_rpc_method_handler(
+ servicer.FencePersons,
+ request_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.FencePersonsRequest.FromString,
+ response_serializer=personhog_dot_types_dot_v1_dot_person__pb2.FencePersonsResponse.SerializeToString,
+ ),
"ReleaseFence": grpc.unary_unary_rpc_method_handler(
servicer.ReleaseFence,
request_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFenceRequest.FromString,
response_serializer=personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFenceResponse.SerializeToString,
),
+ "ReleaseFences": grpc.unary_unary_rpc_method_handler(
+ servicer.ReleaseFences,
+ request_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFencesRequest.FromString,
+ response_serializer=personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFencesResponse.SerializeToString,
+ ),
"FoldPersonDocument": grpc.unary_unary_rpc_method_handler(
servicer.FoldPersonDocument,
request_deserializer=personhog_dot_types_dot_v1_dot_person__pb2.FoldPersonDocumentRequest.FromString,
@@ -1882,6 +1916,36 @@ class PersonHogService:
_registered_method=True,
)
+ @staticmethod
+ def FencePersons(
+ request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None,
+ ):
+ return grpc.experimental.unary_unary(
+ request,
+ target,
+ "/personhog.service.v1.PersonHogService/FencePersons",
+ personhog_dot_types_dot_v1_dot_person__pb2.FencePersonsRequest.SerializeToString,
+ personhog_dot_types_dot_v1_dot_person__pb2.FencePersonsResponse.FromString,
+ options,
+ channel_credentials,
+ insecure,
+ call_credentials,
+ compression,
+ wait_for_ready,
+ timeout,
+ metadata,
+ _registered_method=True,
+ )
+
@staticmethod
def ReleaseFence(
request,
@@ -1912,6 +1976,36 @@ class PersonHogService:
_registered_method=True,
)
+ @staticmethod
+ def ReleaseFences(
+ request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None,
+ ):
+ return grpc.experimental.unary_unary(
+ request,
+ target,
+ "/personhog.service.v1.PersonHogService/ReleaseFences",
+ personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFencesRequest.SerializeToString,
+ personhog_dot_types_dot_v1_dot_person__pb2.ReleaseFencesResponse.FromString,
+ options,
+ channel_credentials,
+ insecure,
+ call_credentials,
+ compression,
+ wait_for_ready,
+ timeout,
+ metadata,
+ _registered_method=True,
+ )
+
@staticmethod
def FoldPersonDocument(
request,
diff --git a/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.py b/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.py
index 1e4f2254b5d3..44c12adf7e26 100644
--- a/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.py
+++ b/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.py
@@ -15,17 +15,17 @@ _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(\x08B\r\n\x0b_is_user_idB\x0f\n\r_last_seen_at"N\n\x15DistinctIdWithVersion\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12\x14\n\x07version\x18\x02 \x01(\x03H\x00\x88\x01\x01B\n\n\x08_version"h\n\x15PersonWithDistinctIds\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12/\n\x06person\x18\x02 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"g\n\x11PersonDistinctIds\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12?\n\x0cdistinct_ids\x18\x02 \x03(\x0b2).personhog.types.v1.DistinctIdWithVersion"\x87\x01\n\x18PersonWithTeamDistinctId\x12/\n\x03key\x18\x01 \x01(\x0b2".personhog.types.v1.TeamDistinctId\x12/\n\x06person\x18\x02 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\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\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"O\n\x11GetPersonResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\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\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"S\n\x0fPersonsResponse\x12+\n\x07persons\x18\x01 \x03(\x0b2\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\x125\n\x0cread_options\x18\x03 \x01(\x0b2\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\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"{\n\x1cGetPersonByDistinctIdRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bdistinct_id\x18\x02 \x01(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"\x84\x01\n$GetPersonsByDistinctIdsInTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cdistinct_ids\x18\x02 \x03(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"`\n"PersonsByDistinctIdsInTeamResponse\x12:\n\x07results\x18\x01 \x03(\x0b2).personhog.types.v1.PersonWithDistinctIds"\x96\x01\n\x1eGetPersonsByDistinctIdsRequest\x12=\n\x11team_distinct_ids\x18\x01 \x03(\x0b2".personhog.types.v1.TeamDistinctId\x125\n\x0cread_options\x18\x02 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"]\n\x1cPersonsByDistinctIdsResponse\x12=\n\x07results\x18\x01 \x03(\x0b2,.personhog.types.v1.PersonWithTeamDistinctId"\x99\x01\n\x1eGetDistinctIdsForPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions\x12\x12\n\x05limit\x18\x04 \x01(\x03H\x00\x88\x01\x01B\x08\n\x06_limit"b\n\x1fGetDistinctIdsForPersonResponse\x12?\n\x0cdistinct_ids\x18\x01 \x03(\x0b2).personhog.types.v1.DistinctIdWithVersion"\xb1\x01\n\x1fGetDistinctIdsForPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions\x12\x1d\n\x10limit_per_person\x18\x04 \x01(\x03H\x00\x88\x01\x01B\x13\n\x11_limit_per_person"f\n GetDistinctIdsForPersonsResponse\x12B\n\x13person_distinct_ids\x18\x01 \x03(\x0b2%.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\x0cforce_update\x18\t \x01(\x08B\x10\n\x0e_is_identifiedB\x0f\n\r_last_seen_at"m\n\x1eUpdatePersonPropertiesResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x12\x0f\n\x07updated\x18\x02 \x01(\x08B\t\n\x07_person"=\n\x14DeletePersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t".\n\x15DeletePersonsResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03"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"W\n\x12SplitPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x1d\n\x15distinct_ids_to_split\x18\x03 \x03(\t"\x8e\x01\n\x0bSplitResult\x12\x13\n\x0bdistinct_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(\x0b2\x1f.personhog.types.v1.SplitResult"c\n&SetPersonDistinctIdVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bdistinct_id\x18\x02 \x01(\t\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"e\n\'SetPersonDistinctIdVersionFloorResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\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\x12FencePersonRequest\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\x124\n\x07op_type\x18\x04 \x01(\x0e2#.personhog.types.v1.LifecycleOpType"A\n\x13FencePersonResponse\x12*\n\x06sealed\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.Person"\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\x123\n\x07outcome\x18\x05 \x01(\x0e2".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(\x03B\x11\n\x0f_sealed_version"\x16\n\x14ReleaseFenceResponse"S\n\x14SealedSourceSnapshot\x12*\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.Person\x12\x0f\n\x07ordinal\x18\x02 \x01(\x05"\xbd\x01\n\x19FoldPersonDocumentRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12B\n\x10sealed_snapshots\x18\x03 \x03(\x0b2(.personhog.types.v1.SealedSourceSnapshot\x12\x11\n\tevent_set\x18\x04 \x01(\x0c\x12\x16\n\x0eevent_set_once\x18\x05 \x01(\x0c\x12\r\n\x05op_id\x18\x06 \x01(\t"H\n\x1aFoldPersonDocumentResponse\x12*\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.Person*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\x02b\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(\x08B\r\n\x0b_is_user_idB\x0f\n\r_last_seen_at"N\n\x15DistinctIdWithVersion\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12\x14\n\x07version\x18\x02 \x01(\x03H\x00\x88\x01\x01B\n\n\x08_version"h\n\x15PersonWithDistinctIds\x12\x13\n\x0bdistinct_id\x18\x01 \x01(\t\x12/\n\x06person\x18\x02 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\t\n\x07_person"g\n\x11PersonDistinctIds\x12\x11\n\tperson_id\x18\x01 \x01(\x03\x12?\n\x0cdistinct_ids\x18\x02 \x03(\x0b2).personhog.types.v1.DistinctIdWithVersion"\x87\x01\n\x18PersonWithTeamDistinctId\x12/\n\x03key\x18\x01 \x01(\x0b2".personhog.types.v1.TeamDistinctId\x12/\n\x06person\x18\x02 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\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\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"O\n\x11GetPersonResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\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\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"S\n\x0fPersonsResponse\x12+\n\x07persons\x18\x01 \x03(\x0b2\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\x125\n\x0cread_options\x18\x03 \x01(\x0b2\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\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"{\n\x1cGetPersonByDistinctIdRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bdistinct_id\x18\x02 \x01(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"\x84\x01\n$GetPersonsByDistinctIdsInTeamRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cdistinct_ids\x18\x02 \x03(\t\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"`\n"PersonsByDistinctIdsInTeamResponse\x12:\n\x07results\x18\x01 \x03(\x0b2).personhog.types.v1.PersonWithDistinctIds"\x96\x01\n\x1eGetPersonsByDistinctIdsRequest\x12=\n\x11team_distinct_ids\x18\x01 \x03(\x0b2".personhog.types.v1.TeamDistinctId\x125\n\x0cread_options\x18\x02 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions"]\n\x1cPersonsByDistinctIdsResponse\x12=\n\x07results\x18\x01 \x03(\x0b2,.personhog.types.v1.PersonWithTeamDistinctId"\x99\x01\n\x1eGetDistinctIdsForPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions\x12\x12\n\x05limit\x18\x04 \x01(\x03H\x00\x88\x01\x01B\x08\n\x06_limit"b\n\x1fGetDistinctIdsForPersonResponse\x12?\n\x0cdistinct_ids\x18\x01 \x03(\x0b2).personhog.types.v1.DistinctIdWithVersion"\xb1\x01\n\x1fGetDistinctIdsForPersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x12\n\nperson_ids\x18\x02 \x03(\x03\x125\n\x0cread_options\x18\x03 \x01(\x0b2\x1f.personhog.types.v1.ReadOptions\x12\x1d\n\x10limit_per_person\x18\x04 \x01(\x03H\x00\x88\x01\x01B\x13\n\x11_limit_per_person"f\n GetDistinctIdsForPersonsResponse\x12B\n\x13person_distinct_ids\x18\x01 \x03(\x0b2%.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\x0cforce_update\x18\t \x01(\x08B\x10\n\x0e_is_identifiedB\x0f\n\r_last_seen_at"m\n\x1eUpdatePersonPropertiesResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01\x12\x0f\n\x07updated\x18\x02 \x01(\x08B\t\n\x07_person"=\n\x14DeletePersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x14\n\x0cperson_uuids\x18\x02 \x03(\t".\n\x15DeletePersonsResponse\x12\x15\n\rdeleted_count\x18\x01 \x01(\x03"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"W\n\x12SplitPersonRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12\x1d\n\x15distinct_ids_to_split\x18\x03 \x03(\t"\x8e\x01\n\x0bSplitResult\x12\x13\n\x0bdistinct_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(\x0b2\x1f.personhog.types.v1.SplitResult"c\n&SetPersonDistinctIdVersionFloorRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x13\n\x0bdistinct_id\x18\x02 \x01(\t\x12\x13\n\x0bmin_version\x18\x03 \x01(\x03"e\n\'SetPersonDistinctIdVersionFloorResponse\x12/\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.PersonH\x00\x88\x01\x01B\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\x12FencePersonRequest\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\x124\n\x07op_type\x18\x04 \x01(\x0e2#.personhog.types.v1.LifecycleOpType"A\n\x13FencePersonResponse\x12*\n\x06sealed\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.Person"\x7f\n\x13FencePersonsRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\r\n\x05op_id\x18\x02 \x01(\t\x124\n\x07op_type\x18\x03 \x01(\x0e2#.personhog.types.v1.LifecycleOpType\x12\x12\n\nperson_ids\x18\x04 \x03(\x03"_\n\x14FencePersonsResponse\x124\n\x06sealed\x18\x01 \x03(\x0b2$.personhog.types.v1.FencedPersonSeal\x12\x11\n\tnot_found\x18\x02 \x03(\x03"J\n\x10FencedPersonSeal\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\x123\n\x07outcome\x18\x05 \x01(\x0e2".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(\x03B\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\x123\n\x07outcome\x18\x03 \x01(\x0e2".personhog.types.v1.ReleaseOutcome\x125\n\x07persons\x18\x04 \x03(\x0b2$.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(\x03B\x11\n\x0f_sealed_version"\x17\n\x15ReleaseFencesResponse"S\n\x14SealedSourceSnapshot\x12*\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.Person\x12\x0f\n\x07ordinal\x18\x02 \x01(\x05"\xbd\x01\n\x19FoldPersonDocumentRequest\x12\x0f\n\x07team_id\x18\x01 \x01(\x03\x12\x11\n\tperson_id\x18\x02 \x01(\x03\x12B\n\x10sealed_snapshots\x18\x03 \x03(\x0b2(.personhog.types.v1.SealedSourceSnapshot\x12\x11\n\tevent_set\x18\x04 \x01(\x0c\x12\x16\n\x0eevent_set_once\x18\x05 \x01(\x0c\x12\r\n\x05op_id\x18\x06 \x01(\t"H\n\x1aFoldPersonDocumentResponse\x12*\n\x06person\x18\x01 \x01(\x0b2\x1a.personhog.types.v1.Person*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\x02b\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "personhog.types.v1.person_pb2", _globals)
if not _descriptor._USE_C_DESCRIPTORS:
DESCRIPTOR._loaded_options = None
- _globals["_LIFECYCLEOPTYPE"]._serialized_start = 4660
- _globals["_LIFECYCLEOPTYPE"]._serialized_end = 4771
- _globals["_RELEASEOUTCOME"]._serialized_start = 4773
- _globals["_RELEASEOUTCOME"]._serialized_end = 4882
+ _globals["_LIFECYCLEOPTYPE"]._serialized_start = 5280
+ _globals["_LIFECYCLEOPTYPE"]._serialized_end = 5391
+ _globals["_RELEASEOUTCOME"]._serialized_start = 5393
+ _globals["_RELEASEOUTCOME"]._serialized_end = 5502
_globals["_PERSON"]._serialized_start = 89
_globals["_PERSON"]._serialized_end = 395
_globals["_DISTINCTIDWITHVERSION"]._serialized_start = 397
@@ -96,13 +96,25 @@ if not _descriptor._USE_C_DESCRIPTORS:
_globals["_FENCEPERSONREQUEST"]._serialized_end = 3999
_globals["_FENCEPERSONRESPONSE"]._serialized_start = 4001
_globals["_FENCEPERSONRESPONSE"]._serialized_end = 4066
- _globals["_RELEASEFENCEREQUEST"]._serialized_start = 4069
- _globals["_RELEASEFENCEREQUEST"]._serialized_end = 4283
- _globals["_RELEASEFENCERESPONSE"]._serialized_start = 4285
- _globals["_RELEASEFENCERESPONSE"]._serialized_end = 4307
- _globals["_SEALEDSOURCESNAPSHOT"]._serialized_start = 4309
- _globals["_SEALEDSOURCESNAPSHOT"]._serialized_end = 4392
- _globals["_FOLDPERSONDOCUMENTREQUEST"]._serialized_start = 4395
- _globals["_FOLDPERSONDOCUMENTREQUEST"]._serialized_end = 4584
- _globals["_FOLDPERSONDOCUMENTRESPONSE"]._serialized_start = 4586
- _globals["_FOLDPERSONDOCUMENTRESPONSE"]._serialized_end = 4658
+ _globals["_FENCEPERSONSREQUEST"]._serialized_start = 4068
+ _globals["_FENCEPERSONSREQUEST"]._serialized_end = 4195
+ _globals["_FENCEPERSONSRESPONSE"]._serialized_start = 4197
+ _globals["_FENCEPERSONSRESPONSE"]._serialized_end = 4292
+ _globals["_FENCEDPERSONSEAL"]._serialized_start = 4294
+ _globals["_FENCEDPERSONSEAL"]._serialized_end = 4368
+ _globals["_RELEASEFENCEREQUEST"]._serialized_start = 4371
+ _globals["_RELEASEFENCEREQUEST"]._serialized_end = 4585
+ _globals["_RELEASEFENCERESPONSE"]._serialized_start = 4587
+ _globals["_RELEASEFENCERESPONSE"]._serialized_end = 4609
+ _globals["_RELEASEFENCESREQUEST"]._serialized_start = 4612
+ _globals["_RELEASEFENCESREQUEST"]._serialized_end = 4774
+ _globals["_RELEASEFENCEITEM"]._serialized_start = 4776
+ _globals["_RELEASEFENCEITEM"]._serialized_end = 4902
+ _globals["_RELEASEFENCESRESPONSE"]._serialized_start = 4904
+ _globals["_RELEASEFENCESRESPONSE"]._serialized_end = 4927
+ _globals["_SEALEDSOURCESNAPSHOT"]._serialized_start = 4929
+ _globals["_SEALEDSOURCESNAPSHOT"]._serialized_end = 5012
+ _globals["_FOLDPERSONDOCUMENTREQUEST"]._serialized_start = 5015
+ _globals["_FOLDPERSONDOCUMENTREQUEST"]._serialized_end = 5204
+ _globals["_FOLDPERSONDOCUMENTRESPONSE"]._serialized_start = 5206
+ _globals["_FOLDPERSONDOCUMENTRESPONSE"]._serialized_end = 5278
diff --git a/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.pyi b/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.pyi
index b49cc9727dfd..c4614ee0c3e4 100644
--- a/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.pyi
+++ b/posthog/personhog_client/proto/generated/personhog/types/v1/person_pb2.pyi
@@ -534,6 +534,51 @@ class FencePersonResponse(_message.Message):
def __init__(self, sealed: _Optional[_Union[Person, _Mapping]] = ...) -> None: ...
+class FencePersonsRequest(_message.Message):
+ __slots__ = ("team_id", "op_id", "op_type", "person_ids")
+ TEAM_ID_FIELD_NUMBER: _ClassVar[int]
+ OP_ID_FIELD_NUMBER: _ClassVar[int]
+ OP_TYPE_FIELD_NUMBER: _ClassVar[int]
+ PERSON_IDS_FIELD_NUMBER: _ClassVar[int]
+ team_id: int
+ op_id: str
+ op_type: LifecycleOpType
+ person_ids: _containers.RepeatedScalarFieldContainer[int]
+
+ def __init__(
+ self,
+ team_id: _Optional[int] = ...,
+ op_id: _Optional[str] = ...,
+ op_type: _Optional[_Union[LifecycleOpType, str]] = ...,
+ person_ids: _Optional[_Iterable[int]] = ...,
+ ) -> None: ...
+
+class FencePersonsResponse(_message.Message):
+ __slots__ = ("sealed", "not_found")
+ SEALED_FIELD_NUMBER: _ClassVar[int]
+ NOT_FOUND_FIELD_NUMBER: _ClassVar[int]
+ sealed: _containers.RepeatedCompositeFieldContainer[FencedPersonSeal]
+ not_found: _containers.RepeatedScalarFieldContainer[int]
+
+ def __init__(
+ self,
+ sealed: _Optional[_Iterable[_Union[FencedPersonSeal, _Mapping]]] = ...,
+ not_found: _Optional[_Iterable[int]] = ...,
+ ) -> None: ...
+
+class FencedPersonSeal(_message.Message):
+ __slots__ = ("person_id", "version", "created_at")
+ PERSON_ID_FIELD_NUMBER: _ClassVar[int]
+ VERSION_FIELD_NUMBER: _ClassVar[int]
+ CREATED_AT_FIELD_NUMBER: _ClassVar[int]
+ person_id: int
+ version: int
+ created_at: int
+
+ def __init__(
+ self, person_id: _Optional[int] = ..., version: _Optional[int] = ..., created_at: _Optional[int] = ...
+ ) -> None: ...
+
class ReleaseFenceRequest(_message.Message):
__slots__ = ("team_id", "person_id", "person_uuid", "op_id", "outcome", "sealed_version", "created_at")
TEAM_ID_FIELD_NUMBER: _ClassVar[int]
@@ -567,6 +612,49 @@ class ReleaseFenceResponse(_message.Message):
def __init__(self) -> None: ...
+class ReleaseFencesRequest(_message.Message):
+ __slots__ = ("team_id", "op_id", "outcome", "persons")
+ TEAM_ID_FIELD_NUMBER: _ClassVar[int]
+ OP_ID_FIELD_NUMBER: _ClassVar[int]
+ OUTCOME_FIELD_NUMBER: _ClassVar[int]
+ PERSONS_FIELD_NUMBER: _ClassVar[int]
+ team_id: int
+ op_id: str
+ outcome: ReleaseOutcome
+ persons: _containers.RepeatedCompositeFieldContainer[ReleaseFenceItem]
+
+ def __init__(
+ self,
+ team_id: _Optional[int] = ...,
+ op_id: _Optional[str] = ...,
+ outcome: _Optional[_Union[ReleaseOutcome, str]] = ...,
+ persons: _Optional[_Iterable[_Union[ReleaseFenceItem, _Mapping]]] = ...,
+ ) -> None: ...
+
+class ReleaseFenceItem(_message.Message):
+ __slots__ = ("person_id", "person_uuid", "sealed_version", "created_at")
+ PERSON_ID_FIELD_NUMBER: _ClassVar[int]
+ PERSON_UUID_FIELD_NUMBER: _ClassVar[int]
+ SEALED_VERSION_FIELD_NUMBER: _ClassVar[int]
+ CREATED_AT_FIELD_NUMBER: _ClassVar[int]
+ person_id: int
+ person_uuid: str
+ sealed_version: int
+ created_at: int
+
+ def __init__(
+ self,
+ person_id: _Optional[int] = ...,
+ person_uuid: _Optional[str] = ...,
+ sealed_version: _Optional[int] = ...,
+ created_at: _Optional[int] = ...,
+ ) -> None: ...
+
+class ReleaseFencesResponse(_message.Message):
+ __slots__ = ()
+
+ def __init__(self) -> None: ...
+
class SealedSourceSnapshot(_message.Message):
__slots__ = ("person", "ordinal")
PERSON_FIELD_NUMBER: _ClassVar[int]
diff --git a/proto/personhog/leader/v1/leader.proto b/proto/personhog/leader/v1/leader.proto
index 0c1c68a4aeac..98e60882b0a2 100644
--- a/proto/personhog/leader/v1/leader.proto
+++ b/proto/personhog/leader/v1/leader.proto
@@ -37,6 +37,11 @@ service PersonHogLeader {
// (or the op being observed finished) clears it.
rpc FencePerson(personhog.types.v1.FencePersonRequest) returns (personhog.types.v1.FencePersonResponse);
+ // FencePerson for many persons of one op that share one partition:
+ // every person must hash to the routed partition or the whole batch
+ // is refused INVALID_ARGUMENT; a destroyed person lands in not_found.
+ rpc FencePersons(personhog.types.v1.FencePersonsRequest) returns (personhog.types.v1.FencePersonsResponse);
+
// The closing half of FencePerson. `committed` (the person was
// destroyed): verify the op against its live mark row — the request
// alone is never sufficient to destroy a person; a release whose op
@@ -53,6 +58,11 @@ service PersonHogLeader {
// record.
rpc ReleaseFence(personhog.types.v1.ReleaseFenceRequest) returns (personhog.types.v1.ReleaseFenceResponse);
+ // ReleaseFence for many persons of one op that share one partition,
+ // routed and checked like FencePersons; the marks are read in one
+ // query and the death documents share fencing windows.
+ rpc ReleaseFences(personhog.types.v1.ReleaseFencesRequest) returns (personhog.types.v1.ReleaseFencesResponse);
+
// Internal, saga-runner only. The merge saga's document write: fold the
// sealed source snapshots into the target person's document under the
// owner's per-person lock, produce the folded document to the
diff --git a/proto/personhog/service/v1/service.proto b/proto/personhog/service/v1/service.proto
index 22b3e661855b..b925d1edf864 100644
--- a/proto/personhog/service/v1/service.proto
+++ b/proto/personhog/service/v1/service.proto
@@ -68,7 +68,9 @@ service PersonHogService {
// lifecycle saga runner in personhog-identity — see leader.proto for
// semantics.
rpc FencePerson(personhog.types.v1.FencePersonRequest) returns (personhog.types.v1.FencePersonResponse);
+ rpc FencePersons(personhog.types.v1.FencePersonsRequest) returns (personhog.types.v1.FencePersonsResponse);
rpc ReleaseFence(personhog.types.v1.ReleaseFenceRequest) returns (personhog.types.v1.ReleaseFenceResponse);
+ rpc ReleaseFences(personhog.types.v1.ReleaseFencesRequest) returns (personhog.types.v1.ReleaseFencesResponse);
rpc FoldPersonDocument(personhog.types.v1.FoldPersonDocumentRequest) returns (personhog.types.v1.FoldPersonDocumentResponse);
// Person deletes
diff --git a/proto/personhog/types/v1/person.proto b/proto/personhog/types/v1/person.proto
index 2ba739675fc1..052e9b3ee6d5 100644
--- a/proto/personhog/types/v1/person.proto
+++ b/proto/personhog/types/v1/person.proto
@@ -310,6 +310,38 @@ message FencePersonResponse {
Person sealed = 1;
}
+// FencePersonsRequest freezes many persons of one op in one call (see
+// PersonHogLeader.FencePersons). The saga sends one call per partition
+// of the op, routed by one of the persons like a single fence.
+message FencePersonsRequest {
+ int64 team_id = 1;
+ string op_id = 2;
+ LifecycleOpType op_type = 3;
+ repeated int64 person_ids = 4;
+}
+
+// Every requested person id lands in exactly one of the two lists; a
+// failure any single FencePerson reports through its status, other than
+// NOT_FOUND, fails the whole call the same way.
+message FencePersonsResponse {
+ // The sealed scalars of every person fenced: what the delete saga reads
+ // from a seal. Full documents would not fit a batch, and the merge saga,
+ // which folds the document, fences one person at a time.
+ repeated FencedPersonSeal sealed = 1;
+ // The persons a single FencePerson answers NOT_FOUND for: destroyed, so
+ // no fence was installed.
+ repeated int64 not_found = 2;
+}
+
+message FencedPersonSeal {
+ int64 person_id = 1;
+ // See FencePersonResponse.sealed: the version the fence made final.
+ int64 version = 2;
+ // The person's creation time in epoch milliseconds, as the death
+ // document carries it (see ReleaseFenceRequest.created_at).
+ int64 created_at = 3;
+}
+
// ReleaseFenceRequest closes a fence (see PersonHogLeader.ReleaseFence).
// person_uuid, sealed_version, and created_at travel in the request so a
// leader with no cache entry — after a restart — re-derives the death
@@ -347,6 +379,27 @@ enum ReleaseOutcome {
message ReleaseFenceResponse {}
+// ReleaseFencesRequest closes many fences of one op in one call (see
+// PersonHogLeader.ReleaseFences), one call per partition of the op.
+// Per-person fields carry what ReleaseFenceRequest carries.
+message ReleaseFencesRequest {
+ int64 team_id = 1;
+ string op_id = 2;
+ ReleaseOutcome outcome = 3;
+ repeated ReleaseFenceItem persons = 4;
+}
+
+message ReleaseFenceItem {
+ int64 person_id = 1;
+ string person_uuid = 2;
+ // See ReleaseFenceRequest.sealed_version.
+ optional int64 sealed_version = 3;
+ // See ReleaseFenceRequest.created_at.
+ int64 created_at = 4;
+}
+
+message ReleaseFencesResponse {}
+
// A sealed source snapshot paired with its precedence ordinal — the
// pair order the saga recorded in lifecycle_op_person. The fold sorts
// by ordinal itself rather than trusting request order, so a re-drive
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index 67792abedfb7..73da078b3224 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -8727,6 +8727,7 @@ dependencies = [
name = "personhog-identity"
version = "0.1.0"
dependencies = [
+ "assignment-coordination",
"async-trait",
"axum 0.7.9",
"chrono",
@@ -8739,6 +8740,7 @@ dependencies = [
"lifecycle",
"metrics-exporter-prometheus",
"personhog-common",
+ "personhog-coordination",
"personhog-proto",
"rand 0.8.5",
"serde",
@@ -8768,6 +8770,7 @@ dependencies = [
"dashmap 6.1.0",
"envconfig",
"foyer",
+ "futures",
"health",
"k8s-awareness",
"kube",
diff --git a/rust/personhog-common/src/client.rs b/rust/personhog-common/src/client.rs
index 10b3ce2a0f0d..15df08451bce 100644
--- a/rust/personhog-common/src/client.rs
+++ b/rust/personhog-common/src/client.rs
@@ -19,9 +19,10 @@ use crate::grpc::{code_as_str, CLIENT_NAME_HEADER};
use personhog_proto::personhog::service::v1::person_hog_service_client::PersonHogServiceClient;
use personhog_proto::personhog::types::v1::{
- ConsistencyLevel, FencePersonRequest, FencePersonResponse, FoldPersonDocumentRequest,
- FoldPersonDocumentResponse, GetPersonRequest, Person, ReadOptions, ReleaseFenceRequest,
- ReleaseFenceResponse, UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
+ ConsistencyLevel, FencePersonRequest, FencePersonResponse, FencePersonsRequest,
+ FencePersonsResponse, FoldPersonDocumentRequest, FoldPersonDocumentResponse, GetPersonRequest,
+ Person, ReadOptions, ReleaseFenceRequest, ReleaseFenceResponse, ReleaseFencesRequest,
+ ReleaseFencesResponse, UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
};
/// Routing headers for leader-bound calls through the router.
@@ -177,6 +178,24 @@ impl RouterClient {
Self::timed("FencePerson", self.client().fence_person(request)).await
}
+ /// Leader-routed batch fence (saga runner only) for persons that share
+ /// one partition: the routing headers name the first person, and the
+ /// leader refuses the batch if any person hashes elsewhere.
+ pub async fn fence_persons(
+ &self,
+ request: FencePersonsRequest,
+ ) -> Result<FencePersonsResponse, Status> {
+ let Some(first) = request.person_ids.first() else {
+ return Err(Status::invalid_argument(
+ "FencePersons needs at least one person",
+ ));
+ };
+ let (team_id, person_id) = (request.team_id, *first);
+ let mut request = self.request(request);
+ stamp_person_routing_headers(&mut request, team_id, person_id);
+ Self::timed("FencePersons", self.client().fence_persons(request)).await
+ }
+
/// Leader-routed fence release (saga runner only): committed produces
/// the death document, aborted resumes the person's normal life.
pub async fn release_fence(
@@ -189,6 +208,24 @@ impl RouterClient {
Self::timed("ReleaseFence", self.client().release_fence(request)).await
}
+ /// Leader-routed batch release (saga runner only) for persons that
+ /// share one partition: the routing headers name the first person,
+ /// and the leader refuses the batch if any person hashes elsewhere.
+ pub async fn release_fences(
+ &self,
+ request: ReleaseFencesRequest,
+ ) -> Result<ReleaseFencesResponse, Status> {
+ let Some(first) = request.persons.first() else {
+ return Err(Status::invalid_argument(
+ "ReleaseFences needs at least one person",
+ ));
+ };
+ let (team_id, person_id) = (request.team_id, first.person_id);
+ let mut request = self.request(request);
+ stamp_person_routing_headers(&mut request, team_id, person_id);
+ Self::timed("ReleaseFences", self.client().release_fences(request)).await
+ }
+
/// Leader-routed merge fold (saga runner only): fold sealed source
/// snapshots into the target's document and return the folded result.
pub async fn fold_person_document(
diff --git a/rust/personhog-identity/Cargo.toml b/rust/personhog-identity/Cargo.toml
index da7aed8b58c9..d30bed8ef304 100644
--- a/rust/personhog-identity/Cargo.toml
+++ b/rust/personhog-identity/Cargo.toml
@@ -6,7 +6,9 @@ publish = false
[dependencies]
personhog-common = { path = "../personhog-common" }
+personhog-coordination = { path = "../personhog-coordination" }
personhog-proto = { path = "../personhog-proto" }
+assignment-coordination = { path = "../common/assignment-coordination" }
common-database = { path = "../common/database" }
common-alloc = { path = "../common/alloc" }
common-metrics = { path = "../common/metrics" }
diff --git a/rust/personhog-identity/src/config.rs b/rust/personhog-identity/src/config.rs
index bc19dc8464a1..29a53efc550c 100644
--- a/rust/personhog-identity/src/config.rs
+++ b/rust/personhog-identity/src/config.rs
@@ -103,6 +103,14 @@ pub struct Config {
#[envconfig(default = "5000")]
pub leader_request_timeout_ms: u64,
+ /// etcd endpoints, comma separated. The delete saga groups its fence
+ /// calls by leader partition, and the partition count lives in etcd.
+ #[envconfig(default = "http://localhost:2379")]
+ pub etcd_endpoints: String,
+
+ #[envconfig(default = "/personhog/")]
+ pub etcd_prefix: String,
+
/// Interval between HTTP/2 keepalive pings sent by the gRPC server (0 = disabled)
#[envconfig(default = "30")]
pub grpc_keepalive_interval_secs: u64,
@@ -275,6 +283,14 @@ impl Config {
Duration::from_millis(self.leader_request_timeout_ms)
}
+ pub fn etcd_endpoint_list(&self) -> Vec<String> {
+ self.etcd_endpoints
+ .split(',')
+ .map(|s| s.trim().to_string())
+ .filter(|s| !s.is_empty())
+ .collect()
+ }
+
pub fn grpc_keepalive_interval(&self) -> Option<Duration> {
if self.grpc_keepalive_interval_secs == 0 {
None
diff --git a/rust/personhog-identity/src/leader.rs b/rust/personhog-identity/src/leader.rs
index e9a66b91a972..98babb58d6d9 100644
--- a/rust/personhog-identity/src/leader.rs
+++ b/rust/personhog-identity/src/leader.rs
@@ -3,9 +3,10 @@ use tonic::Status;
use personhog_common::client::RouterClient;
use personhog_proto::personhog::types::v1::{
- FencePersonRequest, FencePersonResponse, FoldPersonDocumentRequest, FoldPersonDocumentResponse,
- ReleaseFenceRequest, ReleaseFenceResponse, UpdatePersonPropertiesRequest,
- UpdatePersonPropertiesResponse,
+ FencePersonRequest, FencePersonResponse, FencePersonsRequest, FencePersonsResponse,
+ FoldPersonDocumentRequest, FoldPersonDocumentResponse, ReleaseFenceRequest,
+ ReleaseFenceResponse, ReleaseFencesRequest, ReleaseFencesResponse,
+ UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
};
/// Writes initial person properties on the creation branch. Production goes
@@ -38,11 +39,21 @@ pub trait LifecycleLeader: Send + Sync {
request: FencePersonRequest,
) -> Result<FencePersonResponse, Status>;
+ async fn fence_persons(
+ &self,
+ request: FencePersonsRequest,
+ ) -> Result<FencePersonsResponse, Status>;
+
async fn release_fence(
&self,
request: ReleaseFenceRequest,
) -> Result<ReleaseFenceResponse, Status>;
+ async fn release_fences(
+ &self,
+ request: ReleaseFencesRequest,
+ ) -> Result<ReleaseFencesResponse, Status>;
+
async fn fold_person_document(
&self,
request: FoldPersonDocumentRequest,
@@ -58,6 +69,13 @@ impl LifecycleLeader for RouterClient {
RouterClient::fence_person(self, request).await
}
+ async fn fence_persons(
+ &self,
+ request: FencePersonsRequest,
+ ) -> Result<FencePersonsResponse, Status> {
+ RouterClient::fence_persons(self, request).await
+ }
+
async fn release_fence(
&self,
request: ReleaseFenceRequest,
@@ -65,6 +83,13 @@ impl LifecycleLeader for RouterClient {
RouterClient::release_fence(self, request).await
}
+ async fn release_fences(
+ &self,
+ request: ReleaseFencesRequest,
+ ) -> Result<ReleaseFencesResponse, Status> {
+ RouterClient::release_fences(self, request).await
+ }
+
async fn fold_person_document(
&self,
request: FoldPersonDocumentRequest,
diff --git a/rust/personhog-identity/src/lifecycle/delete.rs b/rust/personhog-identity/src/lifecycle/delete.rs
index 4298d6cefb19..b880e5d1aa8f 100644
--- a/rust/personhog-identity/src/lifecycle/delete.rs
+++ b/rust/personhog-identity/src/lifecycle/delete.rs
@@ -3,11 +3,11 @@
//! was mutated). Each step is one transaction that commits its work together
//! with the step advance — see the engine's correctness model.
//!
-//! Sealing fences each victim on its owning leader — `FencePerson` rejects
-//! writes while the op lives and returns the exact sealed version, so no
-//! margin is needed — and completion calls `ReleaseFence(committed)` per
-//! victim, which makes the leader produce the death document into the
-//! changelog and evict its cache entry. The unmapped transaction still
+//! Sealing fences the victims on their leaders, one `FencePersons` per
+//! partition — a fence rejects writes while the op lives and returns the
+//! exact sealed version — and completion releases them the same way, one
+//! `ReleaseFences` per partition, which produces the death documents and
+//! evicts the leaders' cache entries. The unmapped transaction still
//! writes the person tombstone directly: it is the durable revival floor
//! the sync plane reads (sanctioned by the RFC); the death document
//! confirms it downstream (writer, ClickHouse) at the same version,
@@ -24,16 +24,12 @@ use std::sync::Arc;
use async_trait::async_trait;
use common_sqlx_macros::{mirrored_query, mirrored_query_as, mirrored_query_scalar};
-use futures::stream::{self, StreamExt};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use sqlx::postgres::PgPool;
-use tonic::Code;
use uuid::Uuid;
-use personhog_proto::personhog::types::v1::{
- FencePersonRequest, LifecycleOpType, ReleaseFenceRequest, ReleaseOutcome,
-};
+use personhog_proto::personhog::types::v1::LifecycleOpType;
use crate::config::IdentityTables;
use crate::leader::LifecycleLeader;
@@ -41,6 +37,9 @@ use crate::lifecycle::engine::{
advance_step_in_tx, complete_op_in_tx, OpDriver, OpRow, SagaError, Tx, STEP_ABORTED,
STEP_COMPLETED,
};
+use crate::lifecycle::leader_calls::{
+ fence_victims, release_fenced, Fenced, FencedVictim, LeaderCalls,
+};
use crate::storage::postgres::begin_timed;
// Derived from the shared enum so the op-type string cannot drift from
@@ -147,17 +146,13 @@ struct PersonStatus {
status: String,
}
-struct FencedVictim {
- person_id: i64,
- person_uuid: Uuid,
- sealed_version: i64,
- sealed_created_at: i64,
-}
-
pub struct DeleteDriver {
leader: Arc<dyn LifecycleLeader>,
tables: IdentityTables,
leader_call_concurrency: usize,
+ /// The leaders' partition count, which decides which victims share a
+ /// fence call.
+ num_partitions: u32,
}
impl DeleteDriver {
@@ -165,15 +160,26 @@ impl DeleteDriver {
leader: Arc<dyn LifecycleLeader>,
tables: IdentityTables,
leader_call_concurrency: usize,
+ num_partitions: u32,
) -> Self {
tables.validate().expect("invalid identity table set");
+ assert!(num_partitions > 0, "num_partitions must be > 0");
Self {
leader,
tables,
// Clamped to 1: a zero-width buffered stream never polls.
leader_call_concurrency: leader_call_concurrency.max(1),
+ num_partitions,
}
}
+
+ fn leader_calls(&self) -> LeaderCalls<'_> {
+ LeaderCalls::new(
+ self.leader.as_ref(),
+ self.leader_call_concurrency,
+ self.num_partitions,
+ )
+ }
}
#[async_trait]
@@ -195,27 +201,9 @@ impl OpDriver for DeleteDriver {
})?;
match step {
DeleteStep::Started => mark(pool, &self.tables, op).await,
- DeleteStep::Marked => {
- seal(
- pool,
- self.leader.as_ref(),
- &self.tables,
- self.leader_call_concurrency,
- op,
- )
- .await
- }
+ DeleteStep::Marked => seal(pool, self.leader_calls(), &self.tables, op).await,
DeleteStep::Sealed => unmap(pool, &self.tables, op).await,
- DeleteStep::Unmapped => {
- complete(
- pool,
- self.leader.as_ref(),
- &self.tables,
- self.leader_call_concurrency,
- op,
- )
- .await
- }
+ DeleteStep::Unmapped => complete(pool, self.leader_calls(), &self.tables, op).await,
}
}
}
@@ -399,7 +387,7 @@ async fn mark(pool: &PgPool, tables: &IdentityTables, op: &OpRow) -> Result<(),
Ok(())
}
-/// `marked → sealed`: fence every victim's owning leader and
+/// `marked → sealed`: fence every victim on its owning leader and
/// persist the exact sealed versions. The fences are the step's only
/// external effect and a same-op re-fence is a re-seal returning fresh
/// state, so the fan-out is safe to repeat; the sealed values and the step
@@ -407,7 +395,7 @@ async fn mark(pool: &PgPool, tables: &IdentityTables, op: &OpRow) -> Result<(),
/// (epoch milliseconds, as the leader seals it) alongside `version`; its
/// presence is what marks a victim as fenced when the release runs.
///
-/// A victim the leader reports NOT_FOUND vanished between the claim
+/// A victim the leader reports not found vanished between the claim
/// recheck and its fence (destroyed by another actor) — its mark row is
/// removed so it settles as `not_found`, mirroring the merge driver's
/// vanished-source handling. A definitive refusal propagates and parks the
@@ -416,9 +404,8 @@ async fn mark(pool: &PgPool, tables: &IdentityTables, op: &OpRow) -> Result<(),
/// customer flow.
async fn seal(
pool: &PgPool,
- leader: &dyn LifecycleLeader,
+ calls: LeaderCalls<'_>,
tables: &IdentityTables,
- leader_call_concurrency: usize,
op: &OpRow,
) -> Result<(), SagaError> {
let victims: Vec<i64> = mirrored_query_scalar!(
@@ -431,41 +418,24 @@ async fn seal(
op.op_id
=> fetch_all(pool)
)?;
+ let fenced = fence_victims(calls, op, &victims).await?;
- let fence_calls: Vec<_> = victims
- .iter()
- .map(|&person_id| {
- let request = FencePersonRequest {
- team_id: op.team_id,
- person_id,
- op_id: op.op_id.to_string(),
- op_type: LifecycleOpType::Delete.into(),
- };
- async move { (person_id, leader.fence_person(request).await) }
- })
- .collect();
- let fence_results: Vec<_> = stream::iter(fence_calls)
- .buffer_unordered(leader_call_concurrency)
- .collect()
- .await;
-
- let mut sealed_ids: Vec<i64> = Vec::with_capacity(fence_results.len());
- let mut sealed_versions: Vec<i64> = Vec::with_capacity(fence_results.len());
- let mut sealed_created_ats: Vec<i64> = Vec::with_capacity(fence_results.len());
+ let mut sealed_ids: Vec<i64> = Vec::with_capacity(fenced.len());
+ let mut sealed_versions: Vec<i64> = Vec::with_capacity(fenced.len());
+ let mut sealed_created_ats: Vec<i64> = Vec::with_capacity(fenced.len());
let mut vanished: Vec<i64> = Vec::new();
- for (person_id, result) in fence_results {
- match result {
- Ok(response) => {
- let sealed = response.sealed.ok_or_else(|| {
- SagaError::CorruptState(format!(
- "fence response for person {person_id} carries no sealed state"
- ))
- })?;
+ for outcome in fenced {
+ match outcome {
+ Fenced::Sealed {
+ person_id,
+ version,
+ created_at,
+ } => {
sealed_ids.push(person_id);
- sealed_versions.push(sealed.version);
- sealed_created_ats.push(sealed.created_at);
+ sealed_versions.push(version);
+ sealed_created_ats.push(created_at);
}
- Err(status) if status.code() == Code::NotFound => {
+ Fenced::Vanished(person_id) => {
tracing::error!(
op_id = %op.op_id,
person_id,
@@ -473,9 +443,6 @@ async fn seal(
);
vanished.push(person_id);
}
- // FencePerson mints no semantic refusal today; adding one
- // needs an abort path first (see the merge driver's).
- Err(status) => return Err(SagaError::leader(status)),
}
}
@@ -698,9 +665,8 @@ async fn unmap(pool: &PgPool, tables: &IdentityTables, op: &OpRow) -> Result<(),
/// across a kill-switch flip) completes without phantom release calls.
async fn complete(
pool: &PgPool,
- leader: &dyn LifecycleLeader,
+ calls: LeaderCalls<'_>,
tables: &IdentityTables,
- leader_call_concurrency: usize,
op: &OpRow,
) -> Result<(), SagaError> {
let request = parse_request(op)?;
@@ -719,28 +685,7 @@ async fn complete(
op.op_id
=> fetch_all(pool)
)?;
- let release_calls: Vec<_> = fenced
- .iter()
- .map(|victim| {
- let request = ReleaseFenceRequest {
- team_id: op.team_id,
- person_id: victim.person_id,
- person_uuid: victim.person_uuid.to_string(),
- op_id: op.op_id.to_string(),
- outcome: ReleaseOutcome::Committed.into(),
- sealed_version: Some(victim.sealed_version),
- created_at: victim.sealed_created_at,
- };
- async move { leader.release_fence(request).await }
- })
- .collect();
- let release_results: Vec<_> = stream::iter(release_calls)
- .buffer_unordered(leader_call_concurrency)
- .collect()
- .await;
- for result in release_results {
- result.map_err(SagaError::leader)?;
- }
+ release_fenced(calls, op, &fenced).await?;
let mut tx = begin_timed(pool).await?;
diff --git a/rust/personhog-identity/src/lifecycle/leader_calls.rs b/rust/personhog-identity/src/lifecycle/leader_calls.rs
new file mode 100644
index 000000000000..4bb5d7a80dad
--- /dev/null
+++ b/rust/personhog-identity/src/lifecycle/leader_calls.rs
@@ -0,0 +1,374 @@
+//! How the delete saga reaches the leaders: victims grouped into one
+//! batch call per partition, with single calls for any batch a leader
+//! refuses.
+
+use std::collections::{BTreeMap, HashMap};
+
+use futures::stream::{self, StreamExt};
+use tonic::{Code, Status};
+use uuid::Uuid;
+
+use personhog_common::grpc::is_semantic_refusal;
+use personhog_common::partitioning::partition_for_person;
+use personhog_proto::personhog::types::v1::{
+ FencePersonRequest, FencePersonsRequest, FencePersonsResponse, LifecycleOpType,
+ ReleaseFenceItem, ReleaseFenceRequest, ReleaseFencesRequest, ReleaseOutcome,
+};
+
+use crate::leader::LifecycleLeader;
+use crate::lifecycle::engine::{OpRow, SagaError};
+
+/// Persons per `FencePersons` or `ReleaseFences` call. Equal to the
+/// leader's batch cap, which refuses larger batches outright.
+pub(crate) const LIFECYCLE_BATCH_SIZE: usize = 100;
+
+const BATCH_FALLBACKS_TOTAL: &str = "personhog_lifecycle_delete_batch_fallbacks_total";
+
+/// How a step reaches the leaders: the client, the calls it keeps in
+/// flight at once, and the partition count its batches are grouped by.
+#[derive(Clone, Copy)]
+pub(crate) struct LeaderCalls<'a> {
+ leader: &'a dyn LifecycleLeader,
+ concurrency: usize,
+ num_partitions: u32,
+}
+
+impl<'a> LeaderCalls<'a> {
+ pub(crate) fn new(
+ leader: &'a dyn LifecycleLeader,
+ concurrency: usize,
+ num_partitions: u32,
+ ) -> Self {
+ Self {
+ leader,
+ concurrency,
+ num_partitions,
+ }
+ }
+}
+
+pub(crate) enum Fenced {
+ Sealed {
+ person_id: i64,
+ version: i64,
+ created_at: i64,
+ },
+ Vanished(i64),
+}
+
+/// The batches one leader call may carry: one partition's victims, at
+/// most [`LIFECYCLE_BATCH_SIZE`] per batch. The leader refuses a batch
+/// whose members hash to different partitions.
+fn partition_batches<T>(
+ team_id: i64,
+ items: &[T],
+ num_partitions: u32,
+ person_id: impl Fn(&T) -> i64,
+) -> Vec<Vec<&T>> {
+ let mut by_partition: BTreeMap<u32, Vec<&T>> = BTreeMap::new();
+ for item in items {
+ let partition = partition_for_person(team_id, person_id(item), num_partitions);
+ by_partition.entry(partition).or_default().push(item);
+ }
+ by_partition
+ .into_values()
+ .flat_map(|group| {
+ group
+ .chunks(LIFECYCLE_BATCH_SIZE)
+ .map(<[&T]>::to_vec)
+ .collect::<Vec<_>>()
+ })
+ .collect()
+}
+
+/// Whether a failed batch is retried as single calls: an old fleet, a
+/// routing mismatch from a stale partition count, or one member's semantic
+/// refusal. Anything else fails the step, as a single call's failure would.
+fn falls_back_to_singles(status: &Status) -> bool {
+ matches!(status.code(), Code::Unimplemented | Code::InvalidArgument)
+ || is_semantic_refusal(status)
+}
+
+fn record_batch_fallback(rpc: &str, status: &Status) {
+ common_metrics::inc(
+ BATCH_FALLBACKS_TOTAL,
+ &[
+ ("rpc".to_string(), rpc.to_string()),
+ ("code".to_string(), format!("{:?}", status.code())),
+ ],
+ 1,
+ );
+}
+
+/// One `FencePersons` call's outcome: the victims it answered for, and the
+/// victims left to single calls.
+type BatchFenced<'a> = Result<(Vec<Fenced>, Vec<&'a i64>), SagaError>;
+
+/// Fence the victims in one `FencePersons` call per partition batch, then
+/// fence one call each the members of any batch a leader refused.
+pub(crate) async fn fence_victims(
+ calls: LeaderCalls<'_>,
+ op: &OpRow,
+ person_ids: &[i64],
+) -> Result<Vec<Fenced>, SagaError> {
+ let leader = calls.leader;
+ let batch_calls: Vec<_> =
+ partition_batches(op.team_id, person_ids, calls.num_partitions, |id| *id)
+ .into_iter()
+ .map(|batch| async move {
+ let request = FencePersonsRequest {
+ team_id: op.team_id,
+ op_id: op.op_id.to_string(),
+ op_type: LifecycleOpType::Delete.into(),
+ person_ids: batch.iter().map(|id| **id).collect(),
+ };
+ match leader.fence_persons(request).await {
+ Ok(response) => {
+ fenced_from_batch(&batch, response).map(|fenced| (fenced, Vec::new()))
+ }
+ Err(status) if falls_back_to_singles(&status) => {
+ record_batch_fallback("FencePersons", &status);
+ Ok((Vec::new(), batch))
+ }
+ Err(status) => Err(SagaError::leader(status)),
+ }
+ })
+ .collect();
+ let batch_results: Vec<BatchFenced<'_>> = stream::iter(batch_calls)
+ .buffer_unordered(calls.concurrency)
+ .collect()
+ .await;
+ let mut fenced: Vec<Fenced> = Vec::with_capacity(person_ids.len());
+ let mut singles: Vec<i64> = Vec::new();
+ for result in batch_results {
+ let (batch_fenced, refused) = result?;
+ fenced.extend(batch_fenced);
+ singles.extend(refused.into_iter().copied());
+ }
+ if !singles.is_empty() {
+ fenced.extend(fence_each_victim(calls, op, &singles).await?);
+ }
+ Ok(fenced)
+}
+
+/// The batch's answer as per-victim outcomes. A person in neither list was
+/// neither fenced nor found destroyed, and sealing without it would leave
+/// that person unfenced through the delete.
+fn fenced_from_batch(
+ person_ids: &[&i64],
+ response: FencePersonsResponse,
+) -> Result<Vec<Fenced>, SagaError> {
+ let mut by_person: HashMap<i64, Fenced> = HashMap::with_capacity(person_ids.len());
+ for seal in response.sealed {
+ by_person.insert(
+ seal.person_id,
+ Fenced::Sealed {
+ person_id: seal.person_id,
+ version: seal.version,
+ created_at: seal.created_at,
+ },
+ );
+ }
+ for person_id in response.not_found {
+ by_person.insert(person_id, Fenced::Vanished(person_id));
+ }
+ person_ids
+ .iter()
+ .map(|person_id| {
+ by_person.remove(person_id).ok_or_else(|| {
+ SagaError::CorruptState(format!(
+ "fence batch response carries no outcome for person {person_id}"
+ ))
+ })
+ })
+ .collect()
+}
+
+async fn fence_each_victim(
+ calls: LeaderCalls<'_>,
+ op: &OpRow,
+ person_ids: &[i64],
+) -> Result<Vec<Fenced>, SagaError> {
+ let leader = calls.leader;
+ let fence_calls: Vec<_> = person_ids
+ .iter()
+ .map(|person_id| {
+ let request = FencePersonRequest {
+ team_id: op.team_id,
+ person_id: *person_id,
+ op_id: op.op_id.to_string(),
+ op_type: LifecycleOpType::Delete.into(),
+ };
+ let person_id = *person_id;
+ async move { (person_id, leader.fence_person(request).await) }
+ })
+ .collect();
+ let fence_results: Vec<_> = stream::iter(fence_calls)
+ .buffer_unordered(calls.concurrency)
+ .collect()
+ .await;
+
+ let mut fenced = Vec::with_capacity(fence_results.len());
+ for (person_id, result) in fence_results {
+ match result {
+ Ok(response) => {
+ let sealed = response.sealed.ok_or_else(|| {
+ SagaError::CorruptState(format!(
+ "fence response for person {person_id} carries no sealed state"
+ ))
+ })?;
+ fenced.push(Fenced::Sealed {
+ person_id,
+ version: sealed.version,
+ created_at: sealed.created_at,
+ });
+ }
+ Err(status) if status.code() == Code::NotFound => {
+ fenced.push(Fenced::Vanished(person_id));
+ }
+ // FencePerson mints no semantic refusal today; adding one
+ // needs an abort path first (see the merge driver's).
+ Err(status) => return Err(SagaError::leader(status)),
+ }
+ }
+ Ok(fenced)
+}
+
+/// A victim whose fence must be released at completion.
+pub(crate) struct FencedVictim {
+ pub(crate) person_id: i64,
+ pub(crate) person_uuid: Uuid,
+ pub(crate) sealed_version: i64,
+ pub(crate) sealed_created_at: i64,
+}
+
+impl FencedVictim {
+ fn release_item(&self) -> ReleaseFenceItem {
+ ReleaseFenceItem {
+ person_id: self.person_id,
+ person_uuid: self.person_uuid.to_string(),
+ sealed_version: Some(self.sealed_version),
+ created_at: self.sealed_created_at,
+ }
+ }
+
+ fn release_request(&self, op: &OpRow) -> ReleaseFenceRequest {
+ ReleaseFenceRequest {
+ team_id: op.team_id,
+ person_id: self.person_id,
+ person_uuid: self.person_uuid.to_string(),
+ op_id: op.op_id.to_string(),
+ outcome: ReleaseOutcome::Committed.into(),
+ sealed_version: Some(self.sealed_version),
+ created_at: self.sealed_created_at,
+ }
+ }
+}
+
+/// Release the fenced victims with the committed outcome, one
+/// `ReleaseFences` per partition batch, so each leader verifies the marks
+/// in one query and shares one fencing window. Refused batches go single.
+pub(crate) async fn release_fenced(
+ calls: LeaderCalls<'_>,
+ op: &OpRow,
+ victims: &[FencedVictim],
+) -> Result<(), SagaError> {
+ let leader = calls.leader;
+ let batch_calls: Vec<_> =
+ partition_batches(op.team_id, victims, calls.num_partitions, |v| v.person_id)
+ .into_iter()
+ .map(|batch| async move {
+ let request = ReleaseFencesRequest {
+ team_id: op.team_id,
+ op_id: op.op_id.to_string(),
+ outcome: ReleaseOutcome::Committed.into(),
+ persons: batch.iter().map(|v| v.release_item()).collect(),
+ };
+ match leader.release_fences(request).await {
+ Ok(_) => Ok(Vec::new()),
+ Err(status) if falls_back_to_singles(&status) => {
+ record_batch_fallback("ReleaseFences", &status);
+ Ok(batch)
+ }
+ Err(status) => Err(status),
+ }
+ })
+ .collect();
+ let batch_results: Vec<Result<Vec<&FencedVictim>, Status>> = stream::iter(batch_calls)
+ .buffer_unordered(calls.concurrency)
+ .collect()
+ .await;
+ let mut singles: Vec<&FencedVictim> = Vec::new();
+ for result in batch_results {
+ singles.extend(result.map_err(SagaError::leader)?);
+ }
+
+ let single_calls: Vec<_> = singles
+ .into_iter()
+ .map(|victim| {
+ let request = victim.release_request(op);
+ async move { leader.release_fence(request).await }
+ })
+ .collect();
+ let single_results: Vec<_> = stream::iter(single_calls)
+ .buffer_unordered(calls.concurrency)
+ .collect()
+ .await;
+ for result in single_results {
+ result.map_err(SagaError::leader)?;
+ }
+ Ok(())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use personhog_common::grpc::semantic_refusal;
+
+ #[test]
+ fn partition_batches_never_mix_partitions() {
+ let team_id = 7;
+ let ids: Vec<i64> = (1..=50).collect();
+ let batches = partition_batches(team_id, &ids, 4, |id| *id);
+ let mut seen: Vec<i64> = Vec::new();
+ for batch in &batches {
+ let partition = partition_for_person(team_id, *batch[0], 4);
+ assert!(batch
+ .iter()
+ .all(|id| partition_for_person(team_id, **id, 4) == partition));
+ seen.extend(batch.iter().map(|id| **id));
+ }
+ seen.sort_unstable();
+ assert_eq!(seen, ids);
+ }
+
+ #[test]
+ fn partition_batches_split_a_partition_at_the_cap() {
+ let ids: Vec<i64> = (1..=(2 * LIFECYCLE_BATCH_SIZE as i64 + 1)).collect();
+ let sizes: Vec<usize> = partition_batches(7, &ids, 1, |id| *id)
+ .iter()
+ .map(Vec::len)
+ .collect();
+ assert_eq!(sizes, vec![LIFECYCLE_BATCH_SIZE, LIFECYCLE_BATCH_SIZE, 1]);
+ }
+
+ #[test]
+ fn only_refusals_a_single_call_can_isolate_fall_back() {
+ for code in [Code::Unimplemented, Code::InvalidArgument] {
+ assert!(falls_back_to_singles(&Status::new(code, "")), "{code:?}");
+ }
+ assert!(falls_back_to_singles(&semantic_refusal(
+ "no live mark",
+ "release-unverified"
+ )));
+ for code in [
+ Code::Unavailable,
+ Code::DeadlineExceeded,
+ Code::FailedPrecondition,
+ Code::ResourceExhausted,
+ Code::Internal,
+ ] {
+ assert!(!falls_back_to_singles(&Status::new(code, "")), "{code:?}");
+ }
+ }
+}
diff --git a/rust/personhog-identity/src/lifecycle/mod.rs b/rust/personhog-identity/src/lifecycle/mod.rs
index d89986848608..fa06096a5434 100644
--- a/rust/personhog-identity/src/lifecycle/mod.rs
+++ b/rust/personhog-identity/src/lifecycle/mod.rs
@@ -9,6 +9,7 @@
pub mod delete;
pub mod engine;
+pub(crate) mod leader_calls;
pub mod merge;
pub mod validation;
@@ -39,10 +40,16 @@ impl PersonHogLifecycleService {
leader: Arc<dyn LifecycleLeader>,
tables: crate::config::IdentityTables,
leader_call_concurrency: usize,
+ num_partitions: u32,
) -> Self {
Self {
engine,
- delete_driver: DeleteDriver::new(leader, tables, leader_call_concurrency),
+ delete_driver: DeleteDriver::new(
+ leader,
+ tables,
+ leader_call_concurrency,
+ num_partitions,
+ ),
}
}
}
diff --git a/rust/personhog-identity/src/main.rs b/rust/personhog-identity/src/main.rs
index 31990f7283fc..136b2fd61a4f 100644
--- a/rust/personhog-identity/src/main.rs
+++ b/rust/personhog-identity/src/main.rs
@@ -1,6 +1,7 @@
use std::sync::Arc;
use std::time::Duration;
+use assignment_coordination::store::{EtcdStore, StoreConfig};
use axum::{routing::get, Router};
use common_database::{get_pool_with_config, PoolConfig};
use envconfig::Envconfig;
@@ -19,6 +20,7 @@ use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::EnvFilter;
use personhog_common::client::RouterClient;
+use personhog_coordination::store::PersonhogStore;
use personhog_identity::config::Config;
use personhog_identity::leader::LifecycleLeader;
use personhog_identity::lifecycle::delete::DeleteDriver;
@@ -84,6 +86,23 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
);
tracing::info!("Tables: {:?}", config.tables());
+ // The delete saga groups its fence calls by the leaders' partition
+ // count, which lives in etcd; a service that cannot read it would
+ // batch wrong, so refuse to start instead.
+ let num_partitions = {
+ let etcd_store = EtcdStore::connect(StoreConfig {
+ endpoints: config.etcd_endpoint_list(),
+ prefix: config.etcd_prefix.clone(),
+ })
+ .await
+ .expect("Failed to connect to etcd");
+ PersonhogStore::new(etcd_store)
+ .get_total_partitions()
+ .await
+ .expect("Failed to read total_partitions from etcd")
+ };
+ tracing::info!(num_partitions, "loaded partition count from etcd");
+
// Build lifecycle manager and register components
let mut manager = Manager::builder("personhog-identity").build();
@@ -245,6 +264,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
lifecycle_leader.clone(),
config.tables(),
config.lifecycle_leader_call_concurrency,
+ num_partitions,
);
let sweeper_engine = engine.clone();
let sweep_interval = config.lifecycle_sweep_interval();
@@ -302,6 +322,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
lifecycle_leader,
config.tables(),
config.lifecycle_leader_call_concurrency,
+ num_partitions,
);
let service = PersonHogIdentityService::new(
storage,
diff --git a/rust/personhog-identity/tests/common/mod.rs b/rust/personhog-identity/tests/common/mod.rs
index 1faafd0bd5c1..a0958f703a2d 100644
--- a/rust/personhog-identity/tests/common/mod.rs
+++ b/rust/personhog-identity/tests/common/mod.rs
@@ -16,6 +16,8 @@ use personhog_identity::storage::postgres::PostgresIdentityStorage;
/// helpers in the test binaries assume it.
/// Leader fan-out width the suites run with; production reads it from config.
pub const FAN_OUT_CONCURRENCY: usize = 8;
+/// Partition count the delete driver groups its fence batches by.
+pub const NUM_PARTITIONS: u32 = 4;
pub fn default_tables() -> IdentityTables {
IdentityTables::real()
@@ -242,6 +244,13 @@ impl personhog_identity::leader::LifecycleLeader for UnusedLeader {
Err(tonic::Status::unimplemented("not exercised by this test"))
}
+ async fn fence_persons(
+ &self,
+ _request: personhog_proto::personhog::types::v1::FencePersonsRequest,
+ ) -> Result<personhog_proto::personhog::types::v1::FencePersonsResponse, tonic::Status> {
+ Err(tonic::Status::unimplemented("not exercised by this test"))
+ }
+
async fn release_fence(
&self,
_request: personhog_proto::personhog::types::v1::ReleaseFenceRequest,
@@ -249,6 +258,13 @@ impl personhog_identity::leader::LifecycleLeader for UnusedLeader {
Err(tonic::Status::unimplemented("not exercised by this test"))
}
+ async fn release_fences(
+ &self,
+ _request: personhog_proto::personhog::types::v1::ReleaseFencesRequest,
+ ) -> Result<personhog_proto::personhog::types::v1::ReleaseFencesResponse, tonic::Status> {
+ Err(tonic::Status::unimplemented("not exercised by this test"))
+ }
+
async fn fold_person_document(
&self,
_request: personhog_proto::personhog::types::v1::FoldPersonDocumentRequest,
diff --git a/rust/personhog-identity/tests/common/sim_leader.rs b/rust/personhog-identity/tests/common/sim_leader.rs
index 1f432da464c0..e90c8e5ad5e5 100644
--- a/rust/personhog-identity/tests/common/sim_leader.rs
+++ b/rust/personhog-identity/tests/common/sim_leader.rs
@@ -22,6 +22,7 @@
//! as authoritative not-found exactly like the real cache's tombstones.
use std::collections::{HashMap, VecDeque};
+use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Mutex;
use async_trait::async_trait;
@@ -34,9 +35,10 @@ use personhog_common::grpc::semantic_refusal;
use personhog_identity::config::IdentityTables;
use personhog_identity::leader::{LifecycleLeader, PropertyWriter};
use personhog_proto::personhog::types::v1::{
- FencePersonRequest, FencePersonResponse, FoldPersonDocumentRequest, FoldPersonDocumentResponse,
- LifecycleOpType, Person, ReleaseFenceRequest, ReleaseFenceResponse, ReleaseOutcome,
- UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
+ FencePersonRequest, FencePersonResponse, FencePersonsRequest, FencePersonsResponse,
+ FencedPersonSeal, FoldPersonDocumentRequest, FoldPersonDocumentResponse, LifecycleOpType,
+ Person, ReleaseFenceRequest, ReleaseFenceResponse, ReleaseFencesRequest, ReleaseFencesResponse,
+ ReleaseOutcome, UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
};
/// Which RPC a scripted failure applies to.
@@ -70,6 +72,10 @@ pub enum LeaderCall {
person_id: i64,
op_type: LifecycleOpType,
},
+ /// A `FencePersons` call, recorded before its per-person fences.
+ FenceBatch {
+ person_ids: Vec<i64>,
+ },
Fold {
target_person_id: i64,
snapshot_versions: Vec<i64>,
@@ -87,6 +93,10 @@ pub enum LeaderCall {
ReleaseAborted {
person_id: i64,
},
+ /// A `ReleaseFences` call, recorded before its per-person releases.
+ ReleaseBatch {
+ person_ids: Vec<i64>,
+ },
PropertyPush {
person_id: i64,
is_identified: Option<bool>,
@@ -133,6 +143,9 @@ pub struct SimLeader {
/// Injected `last_seen_at` per person: leader-side state with no
/// Postgres column.
last_seen: Mutex<HashMap<i64, i64>>,
+ /// Whether the batch RPCs are served; off, they answer UNIMPLEMENTED
+ /// like a router or leader that predates them.
+ batch_rpcs_supported: AtomicBool,
}
impl SimLeader {
@@ -146,6 +159,7 @@ impl SimLeader {
scripted: Mutex::new(HashMap::new()),
sealed_identified: Mutex::new(HashMap::new()),
last_seen: Mutex::new(HashMap::new()),
+ batch_rpcs_supported: AtomicBool::new(true),
}
}
@@ -153,6 +167,10 @@ impl SimLeader {
self.calls.lock().unwrap().clone()
}
+ pub fn disable_batch_rpcs(&self) {
+ self.batch_rpcs_supported.store(false, Ordering::SeqCst);
+ }
+
/// Script the next matching call for `person_id` (the fold matches on
/// the target's id) to fail with `status`. Queued failures pop in
/// order, one per call.
@@ -341,6 +359,85 @@ impl LifecycleLeader for SimLeader {
})
}
+ async fn fence_persons(
+ &self,
+ request: FencePersonsRequest,
+ ) -> Result<FencePersonsResponse, Status> {
+ if !self.batch_rpcs_supported.load(Ordering::SeqCst) {
+ return Err(Status::unimplemented("unknown method: FencePersons"));
+ }
+ if request.person_ids.is_empty() {
+ return Err(Status::invalid_argument(
+ "FencePersons needs at least one person",
+ ));
+ }
+ self.record(LeaderCall::FenceBatch {
+ person_ids: request.person_ids.clone(),
+ });
+ let mut response = FencePersonsResponse::default();
+ for person_id in request.person_ids {
+ let single = self
+ .fence_person(FencePersonRequest {
+ team_id: request.team_id,
+ person_id,
+ op_id: request.op_id.clone(),
+ op_type: request.op_type,
+ })
+ .await;
+ match single {
+ Ok(fenced) => {
+ let sealed = fenced.sealed.expect("the sim always seals");
+ response.sealed.push(FencedPersonSeal {
+ person_id,
+ version: sealed.version,
+ created_at: sealed.created_at,
+ });
+ }
+ Err(status) if status.code() == tonic::Code::NotFound => {
+ response.not_found.push(person_id);
+ }
+ Err(status) => return Err(status),
+ }
+ }
+ Ok(response)
+ }
+
+ async fn release_fences(
+ &self,
+ request: ReleaseFencesRequest,
+ ) -> Result<ReleaseFencesResponse, Status> {
+ if !self.batch_rpcs_supported.load(Ordering::SeqCst) {
+ return Err(Status::unimplemented("unknown method: ReleaseFences"));
+ }
+ let ReleaseFencesRequest {
+ team_id,
+ op_id,
+ outcome,
+ persons,
+ } = request;
+ if persons.is_empty() {
+ return Err(Status::invalid_argument(
+ "ReleaseFences needs at least one person",
+ ));
+ }
+ self.record(LeaderCall::ReleaseBatch {
+ person_ids: persons.iter().map(|p| p.person_id).collect(),
+ });
+ for person in persons {
+ self.release_fence(ReleaseFenceRequest {
+ team_id,
+ person_id: person.person_id,
+ person_uuid: person.person_uuid,
+ op_id: op_id.clone(),
+ outcome,
+ sealed_version: person.sealed_version,
+ created_at: person.created_at,
+ })
+ .await?;
+ }
+ Ok(ReleaseFencesResponse {})
+ }
+
async fn release_fence(
&self,
request: ReleaseFenceRequest,
diff --git a/rust/personhog-identity/tests/lifecycle_delete_tests.rs b/rust/personhog-identity/tests/lifecycle_delete_tests.rs
index 1c1e69f51978..264297b1b0b2 100644
--- a/rust/personhog-identity/tests/lifecycle_delete_tests.rs
+++ b/rust/personhog-identity/tests/lifecycle_delete_tests.rs
@@ -3,11 +3,13 @@
mod common;
+use std::collections::BTreeMap;
use std::sync::Arc;
use chrono::Utc;
use common::sim_leader::{LeaderCall, Rpc, SimLeader, FENCED_METADATA_KEY};
use common::TestContext;
+use personhog_common::partitioning::partition_for_person;
use tonic::{Request, Status};
use uuid::Uuid;
@@ -28,6 +30,7 @@ impl TestContext {
leader.clone(),
self.tables.clone(),
common::FAN_OUT_CONCURRENCY,
+ common::NUM_PARTITIONS,
)
}
@@ -559,6 +562,7 @@ impl FencedHarness {
leader.clone(),
ctx.tables.clone(),
common::FAN_OUT_CONCURRENCY,
+ common::NUM_PARTITIONS,
);
Self {
ctx,
@@ -635,6 +639,114 @@ async fn fenced_delete_seals_the_exact_version_and_produces_the_death_document()
h.ctx.cleanup().await.expect("cleanup");
}
+/// The person ids every batch call of one kind carried, in call order.
+fn batch_calls(calls: &[LeaderCall], fence: bool) -> Vec<Vec<i64>> {
+ calls
+ .iter()
+ .filter_map(|call| match call {
+ LeaderCall::FenceBatch { person_ids } if fence => Some(person_ids.clone()),
+ LeaderCall::ReleaseBatch { person_ids } if !fence => Some(person_ids.clone()),
+ _ => None,
+ })
+ .collect()
+}
+
+/// Sealing fences and completion releases the victims one call per
+/// partition: a leader refuses a batch that mixes partitions, so the saga
+/// must group by the leaders' own hash before it calls.
+#[tokio::test]
+async fn a_fenced_delete_fences_and_releases_one_batch_per_partition() {
+ let h = FencedHarness::new().await;
+ // Enough victims that the hash spreads them over more than one
+ // partition; the bound only guards against a pathological sequence.
+ let mut person_ids = Vec::new();
+ let mut expected: BTreeMap<u32, Vec<i64>> = BTreeMap::new();
+ while person_ids.len() < 4 || expected.len() < 2 {
+ assert!(
+ person_ids.len() < 32,
+ "victims never spread over two partitions"
+ );
+ let distinct_id = format!("batched-victim-{}-{}", person_ids.len(), Uuid::now_v7());
+ let person_id = h.ctx.create_person_via_stub(&distinct_id).await;
+ person_ids.push(person_id);
+ expected
+ .entry(partition_for_person(
+ h.ctx.team_id,
+ person_id,
+ common::NUM_PARTITIONS,
+ ))
+ .or_default()
+ .push(person_id);
+ }
+
+ let row = h
+ .execute(Uuid::now_v7(), &person_ids)
+ .await
+ .expect("fenced delete completes");
+ let outcome = FencedHarness::outcome(&row);
+ assert!(outcome.results.iter().all(|r| r.outcome == "deleted"));
+ assert_eq!(h.leader.death_documents().len(), person_ids.len());
+
+ let calls = h.leader.calls();
+ for (label, fence) in [("fence", true), ("release", false)] {
+ let mut batched: BTreeMap<u32, Vec<i64>> = BTreeMap::new();
+ for mut batch in batch_calls(&calls, fence) {
+ batch.sort_unstable();
+ let partition = partition_for_person(h.ctx.team_id, batch[0], common::NUM_PARTITIONS);
+ assert!(
+ batched.insert(partition, batch).is_none(),
+ "one {label} call per partition"
+ );
+ }
+ assert_eq!(
+ batched, expected,
+ "each {label} call carries its partition's victims"
+ );
+ }
+
+ h.ctx.cleanup().await.expect("cleanup");
+}
+
+/// A router or leader that predates the batch RPCs answers UNIMPLEMENTED;
+/// the saga must still complete, fencing and releasing one person at a
+/// time.
+#[tokio::test]
+async fn a_fleet_without_batch_rpcs_falls_back_to_single_calls() {
+ let h = FencedHarness::new().await;
+ h.leader.disable_batch_rpcs();
+ let mut person_ids = Vec::new();
+ for i in 0..2 {
+ let distinct_id = format!("single-call-{i}-{}", Uuid::now_v7());
+ person_ids.push(h.ctx.create_person_via_stub(&distinct_id).await);
+ }
+
+ let row = h
+ .execute(Uuid::now_v7(), &person_ids)
+ .await
+ .expect("delete completes without the batch RPCs");
+ let outcome = FencedHarness::outcome(&row);
+ assert!(outcome.results.iter().all(|r| r.outcome == "deleted"));
+ assert_eq!(h.leader.death_documents().len(), person_ids.len());
+
+ let calls = h.leader.calls();
+ assert!(!calls.iter().any(|c| matches!(
+ c,
+ LeaderCall::FenceBatch { .. } | LeaderCall::ReleaseBatch { .. }
+ )));
+ let fences = calls
+ .iter()
+ .filter(|c| matches!(c, LeaderCall::Fence { .. }))
+ .count();
+ assert_eq!(fences, person_ids.len());
+ let releases = calls
+ .iter()
+ .filter(|c| matches!(c, LeaderCall::ReleaseCommitted { .. }))
+ .count();
+ assert_eq!(releases, person_ids.len());
+
+ h.ctx.cleanup().await.expect("cleanup");
+}
+
#[tokio::test]
async fn a_fenced_victim_rejects_writes_until_the_op_completes() {
let h = FencedHarness::new().await;
diff --git a/rust/personhog-identity/tests/lifecycle_service_tests.rs b/rust/personhog-identity/tests/lifecycle_service_tests.rs
index 933e3c3d04c0..31eb16b06815 100644
--- a/rust/personhog-identity/tests/lifecycle_service_tests.rs
+++ b/rust/personhog-identity/tests/lifecycle_service_tests.rs
@@ -45,6 +45,7 @@ async fn delete_status(request: DeletePersonsRequest) -> Code {
Arc::new(SimLeader::new(pool, tables.clone())),
tables,
common::FAN_OUT_CONCURRENCY,
+ common::NUM_PARTITIONS,
);
service
.delete_persons(Request::new(request))
diff --git a/rust/personhog-leader/Cargo.toml b/rust/personhog-leader/Cargo.toml
index ec234a3c1ae8..20937bec5f95 100644
--- a/rust/personhog-leader/Cargo.toml
+++ b/rust/personhog-leader/Cargo.toml
@@ -28,6 +28,7 @@ common-database = { path = "../common/database" }
dashmap = { workspace = true }
envconfig = { workspace = true }
foyer = "0.22.3"
+futures = { workspace = true }
metrics = { workspace = true }
prost = { workspace = true }
rdkafka = { workspace = true }
diff --git a/rust/personhog-leader/src/fence.rs b/rust/personhog-leader/src/fence.rs
index 1aa7f6b27009..5ae3d7436554 100644
--- a/rust/personhog-leader/src/fence.rs
+++ b/rust/personhog-leader/src/fence.rs
@@ -40,6 +40,7 @@
//! dropped, so the next write goes through instead of waiting for the
//! partition to change hands.
+use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;
@@ -342,6 +343,30 @@ pub async fn mark_status(
.await
}
+/// [`mark_status`] for a whole batch in one pool acquire, keyed by person
+/// id. A person with no row is absent from the map, which the caller
+/// reads as it reads `None` from the single lookup.
+pub async fn mark_statuses(
+ fallback: &PgFallback,
+ op_id: Uuid,
+ team_id: i64,
+ person_ids: &[i64],
+) -> Result<HashMap<i64, String>, sqlx::Error> {
+ let mut conn = crate::pg::acquire_timed(&fallback.pool, "mark_statuses").await?;
+ let sql = format!(
+ "SELECT person_id, status FROM {} \
+ WHERE op_id = $1 AND team_id = $2 AND person_id = ANY($3) AND role <> 'target'",
+ fallback.lifecycle.op_person
+ );
+ let rows: Vec<(i64, String)> = sqlx::query_as(&sql)
+ .bind(op_id)
+ .bind(team_id as i32)
+ .bind(person_ids)
+ .fetch_all(&mut *conn)
+ .await?;
+ Ok(rows.into_iter().collect())
+}
+
/// The fold's check: the status of the op's mark row claiming this person
/// as its merge target. `None` when the op never claimed the person as
/// target — including when it holds the person under another role, which
diff --git a/rust/personhog-leader/src/service.rs b/rust/personhog-leader/src/service.rs
index d5e46028595d..13c2fbd5f083 100644
--- a/rust/personhog-leader/src/service.rs
+++ b/rust/personhog-leader/src/service.rs
@@ -6,10 +6,10 @@ use dashmap::DashMap;
use metrics::{counter, histogram};
use personhog_proto::personhog::leader::v1::person_hog_leader_server::PersonHogLeader;
use personhog_proto::personhog::types::v1::{
- FencePersonRequest, FencePersonResponse, FoldPersonDocumentRequest, FoldPersonDocumentResponse,
- GetPersonRequest, GetPersonResponse, LifecycleOpType, Person, ReleaseFenceRequest,
- ReleaseFenceResponse, ReleaseOutcome, SealedSourceSnapshot, UpdatePersonPropertiesRequest,
- UpdatePersonPropertiesResponse,
+ FencePersonRequest, FencePersonResponse, FencePersonsRequest, FencePersonsResponse,
+ FoldPersonDocumentRequest, FoldPersonDocumentResponse, GetPersonRequest, GetPersonResponse,
+ Person, ReleaseFenceRequest, ReleaseFenceResponse, ReleaseFencesRequest, ReleaseFencesResponse,
+ SealedSourceSnapshot, UpdatePersonPropertiesRequest, UpdatePersonPropertiesResponse,
};
use rdkafka::producer::FutureProducer;
use tokio::sync::Mutex;
@@ -26,8 +26,7 @@ use crate::cache::{
};
use crate::emitted::{EmittedVersionGuard, EmittedVersions};
use crate::fence::{
- fenced_status, mark_status, semantic_refusal, target_mark_status, FenceHealer, FenceMap,
- FenceState,
+ fenced_status, semantic_refusal, target_mark_status, FenceHealer, FenceMap, FenceState,
};
use crate::fencing::{FencedChangelogProducers, FencedProduceError};
use crate::inflight::InflightTracker;
@@ -41,6 +40,8 @@ use personhog_common::properties::{
trim_properties_with_candidates, SanitizeStats, TrimResult,
};
+mod lifecycle;
+
/// Mirrors the config's `fence_map_max_entries` default; production
/// overrides via [`PersonHogLeaderService::with_fence_capacity`].
const DEFAULT_FENCE_MAP_MAX_ENTRIES: usize = 250_000;
@@ -172,13 +173,19 @@ impl PersonHogLeaderService {
)))
}
+ /// The gate every ack passes: a valid lease and in-process ownership.
+ #[allow(clippy::result_large_err)]
+ fn assert_authoritative(&self, partition: u32) -> Result<(), Status> {
+ self.check_authority(partition)?;
+ self.validate_ownership(partition)
+ }
+
/// The fence RPCs' exit gate: a success answer re-proves authority at
/// the moment it is given. Only a stale Ok can wrongly settle a saga;
/// errors bounce and retry.
#[allow(clippy::result_large_err)]
fn authoritative_ok<T>(&self, partition: u32, resp: T) -> Result<Response<T>, Status> {
- self.check_authority(partition)?;
- self.validate_ownership(partition)?;
+ self.assert_authoritative(partition)?;
Ok(Response::new(resp))
}
@@ -887,13 +894,6 @@ fn partition_from_metadata<T>(request: &Request<T>) -> Result<u32, Status> {
.map_err(|_| Status::invalid_argument("x-partition metadata is not a valid u32"))
}
-/// Per-phase wall time of a committed release; the RPC histogram alone
-/// cannot separate the lock, the load, the mark check, and the produce.
-fn record_release_phase(phase: &'static str, started: Instant) {
- histogram!("personhog_leader_release_phase_ms", "phase" => phase)
- .record(started.elapsed().as_secs_f64() * 1000.0);
-}
-
#[tonic::async_trait]
impl PersonHogLeader for PersonHogLeaderService {
async fn get_person(
@@ -1627,329 +1627,28 @@ impl PersonHogLeader for PersonHogLeaderService {
&self,
request: Request<FencePersonRequest>,
) -> Result<Response<FencePersonResponse>, Status> {
- let partition = partition_from_metadata(&request)?;
- let req = request.into_inner();
- self.validate_partition(partition, req.team_id, req.person_id)?;
- // Ownership below is in-process state, which is what a lease
- // lapse makes stale: a fence installed here gates no writes.
- self.check_authority(partition)?;
- let op_id = Uuid::parse_str(&req.op_id)
- .map_err(|_| Status::invalid_argument("op_id must be a valid UUID"))?;
- let op_type = req.op_type();
- if op_type == LifecycleOpType::Unspecified {
- return Err(Status::invalid_argument("op_type must be specified"));
- }
- // A fence installed anywhere but the current owner protects
- // nothing: the map that gates writes is the owner's. Both guards
- // are needed — ownership covers a pod that already handed the
- // partition off (release unfences), the handoff guard covers the
- // drain window before that. Refusing is what makes "a mark
- // committed after the takeover scan arrives as a FencePerson call
- // to the current owner" true: the saga's retry re-routes to the
- // new owner.
- self.validate_ownership(partition)?;
- let Some(_inflight_guard) = self.inflight.try_begin(partition) else {
- return Err(Status::failed_precondition(format!(
- "partition {partition} is fenced for handoff; writes are rejected"
- )));
- };
-
- let cache_key = PersonCacheKey {
- team_id: req.team_id,
- person_id: req.person_id,
- };
- let mutex = self
- .locks
- .entry(cache_key.clone())
- .or_default()
- .value()
- .clone();
- let _guard = mutex.lock().await;
-
- let refence = if let Some(entry) = self.fences.get(&cache_key) {
- if entry.op_id != op_id {
- let holder = *entry.value();
- drop(entry);
- // At most one lifecycle op holds a person; the loser backs
- // off or aborts. The holder may also be a ghost (its op
- // settled without this leader hearing); kick the lazy heal
- // like the write paths do, since on a low-traffic person
- // no other caller will.
- if let Some(healer) = &self.fence_healer {
- healer.maybe_heal(cache_key.clone(), holder);
- }
- return Err(fenced_status(&holder));
- }
- true
- } else {
- false
- };
-
- // The memory fuse: the map has no eviction, so a surge of ops is
- // bounded here, by shedding new fences. Re-seals are exempt — the
- // person is already fenced, refusing frees nothing — and so is
- // the takeover scan, whose marks are already live. The saga's
- // retry absorbs the backpressure.
- if !refence && self.fences.len() >= self.fence_map_max_entries {
- counter!("personhog_leader_fences_total", "action" => "shed_capacity").increment(1);
- return Err(Status::resource_exhausted(format!(
- "fence map at capacity ({} live fences); retry later",
- self.fence_map_max_entries
- )));
- }
-
- // The seal: the newest cached state, captured under the same lock
- // that admits writes — no gap for a write to sneak into. Fencing
- // produces nothing and does not advance the version; the sealed
- // version is the person's current one raised to the emitted
- // floor, made final by the fence. The floor matters because a
- // pre-fence write with an indeterminate outcome leaves a version
- // spent above the cache's — sealing below it would derive the
- // death document at a version that may already be live. A
- // same-op re-fence takes this path too, re-sealing with fresh
- // state (the saga's seal step is safe to repeat).
- let person = self.lookup_or_load_locked(partition, &cache_key).await?;
- // The load can park on the per-key lock or a recovery; the seal,
- // not the arrival, must be backed by ownership.
- self.check_authority(partition)?;
- if person.is_deleted {
- return Err(Status::not_found("person is destroyed"));
- }
-
- let mut sealed = cached_person_to_proto(&person);
- sealed.version = self
- .emitted_versions
- .floor_for(partition, &cache_key, person.version);
-
- self.fences.insert(cache_key, FenceState { op_id, op_type });
- counter!("personhog_leader_fences_total", "action" => "fenced").increment(1);
+ self.fence_person_rpc(request).await
+ }
- self.authoritative_ok(
- partition,
- FencePersonResponse {
- sealed: Some(sealed),
- },
- )
+ async fn fence_persons(
+ &self,
+ request: Request<FencePersonsRequest>,
+ ) -> Result<Response<FencePersonsResponse>, Status> {
+ self.fence_persons_rpc(request).await
}
async fn release_fence(
&self,
request: Request<ReleaseFenceRequest>,
) -> Result<Response<ReleaseFenceResponse>, Status> {
- let partition = partition_from_metadata(&request)?;
- let req = request.into_inner();
- self.validate_partition(partition, req.team_id, req.person_id)?;
- // The aborted arm would otherwise ack under a lapsed lease; the
- // committed arm's produce and durable-fact acks need no cover.
- self.check_authority(partition)?;
- let op_id = Uuid::parse_str(&req.op_id)
- .map_err(|_| Status::invalid_argument("op_id must be a valid UUID"))?;
- let outcome = req.outcome();
-
- let cache_key = PersonCacheKey {
- team_id: req.team_id,
- person_id: req.person_id,
- };
- let mutex = self
- .locks
- .entry(cache_key.clone())
- .or_default()
- .value()
- .clone();
- let lock_started = Instant::now();
- let _guard = mutex.lock().await;
-
- // Releasing another op's fence would break that op's seal.
- if let Some(entry) = self.fences.get(&cache_key) {
- if entry.op_id != op_id {
- return Err(fenced_status(entry.value()));
- }
- }
-
- match outcome {
- ReleaseOutcome::Committed => {
- record_release_phase("lock_wait", lock_started);
- // 0 is a legitimate sealed version (a fresh stub's),
- // which is why the field is explicitly optional in the proto.
- let Some(sealed_version) = req.sealed_version else {
- return Err(Status::invalid_argument(
- "sealed_version is required for a committed release",
- ));
- };
- if sealed_version < 0 {
- return Err(Status::invalid_argument(
- "sealed_version must not be negative",
- ));
- }
- if req.created_at <= 0 {
- return Err(Status::invalid_argument(
- "created_at is required for a committed release",
- ));
- }
- if Uuid::parse_str(&req.person_uuid).is_err() {
- return Err(Status::invalid_argument(
- "person_uuid must be a valid UUID for a committed release",
- ));
- }
- // Producing to the changelog must respect the handoff
- // write freeze like any write.
- let Some(_inflight_guard) = self.inflight.try_begin(partition) else {
- return Err(Status::failed_precondition(format!(
- "partition {partition} is fenced for handoff; writes are rejected"
- )));
- };
-
- // Release must stay idempotent for the saga's retry and the
- // sweeper, so a person the leader cannot load anymore is
- // tolerated.
- let load_started = Instant::now();
- let loaded = self.lookup_or_load_locked(partition, &cache_key).await;
- record_release_phase("load", load_started);
- let current = match loaded {
- Ok(person) => Some(person),
- Err(status) if status.code() == tonic::Code::NotFound => None,
- Err(status) => return Err(status),
- };
-
- // Duplicate release: the death document already exists;
- // producing another would only bump the version. Gate
- // first — a refused release must leave the fence.
- if current.as_ref().is_some_and(|p| p.is_deleted) {
- let resp = self.authoritative_ok(partition, ReleaseFenceResponse {})?;
- self.fences.remove(&cache_key);
- return Ok(resp);
- }
-
- // The death document's identity comes from the request (a
- // cold leader has nothing else), so when the leader DOES
- // hold the person, the request must agree with it — the
- // writer upserts uuid verbatim, and a mismatched request
- // would rewrite the row's identity on its way out.
- if let Some(person) = &current {
- if person.uuid != req.person_uuid {
- return Err(semantic_refusal(
- "person_uuid does not match the person being released",
- "uuid-mismatch",
- ));
- }
- }
-
- // The mark row — the fence's source of truth — must vouch
- // for the op before anything is destroyed. The in-memory
- // fence is not enough: FencePerson never verified the op
- // either, so the request (plus a fence it installed
- // itself) must never be sufficient to produce a death
- // document. Unverifiable requests are refused — fail
- // closed.
- let Some(fallback) = &self.fallback else {
- return Err(semantic_refusal(
- "no lifecycle database configured; refusing to produce a death document",
- "no-lifecycle-db",
- ));
- };
- let verify_started = Instant::now();
- let mark = mark_status(fallback, op_id, req.team_id, req.person_id).await;
- record_release_phase("verify_mark", verify_started);
- match mark {
- // A live mark: the op holds the person; proceed.
- Ok(Some(status)) if status == "marked" || status == "sealed" => {}
- // The mark already settled as deleted: this release
- // already happened and the tombstone is durable;
- // absorb the retry.
- Ok(Some(status)) if status == "deleted" => {
- let resp = self.authoritative_ok(partition, ReleaseFenceResponse {})?;
- self.fences.remove(&cache_key);
- return Ok(resp);
- }
- Ok(_) => {
- counter!("personhog_leader_fences_total", "action" => "release_unverified")
- .increment(1);
- return Err(semantic_refusal(
- "op holds no live mark for this person; \
- refusing to produce a death document",
- "release-unverified",
- ));
- }
- Err(e) => {
- tracing::warn!(error = %e, "mark verification failed; rejecting (fail closed)");
- return Err(Status::unavailable(
- "could not verify the lifecycle op against its mark; retry",
- ));
- }
- }
-
- if !self.dirty_index.can_admit(&cache_key) {
- counter!("personhog_leader_writes_shed_total", "reason" => "dirty_index_full")
- .increment(1);
- return Err(Status::resource_exhausted(
- "dirty index at capacity: the writer is behind and this death document \
- cannot be tracked; retry later",
- ));
- }
- // The death version: sealed + 1 per the RFC — the fence
- // makes the sealed version final. The max over the current
- // version and the emitted floor is defense in depth until
- // broker producer fencing lands (a deposed leader's
- // produce could otherwise still advance the version, and
- // an indeterminate one leaves a version spent that the
- // cache never learned of); a cold leader with no state
- // falls back to the sealed version carried by the
- // request, reproducing the death document
- // deterministically.
- let base_version = self.emitted_versions.floor_for(
- partition,
- &cache_key,
- current
- .as_ref()
- .map(|p| p.version)
- .unwrap_or(0)
- .max(sealed_version),
- );
- let death_version = base_version.checked_add(1).ok_or_else(|| {
- Status::invalid_argument("sealed_version leaves no room for the death version")
- })?;
- let death = CachedPerson {
- id: req.person_id,
- uuid: req.person_uuid.clone(),
- team_id: req.team_id,
- properties: b"{}".to_vec(),
- // The sealed value, not the cached one: cold and warm
- // leaders must produce the same document.
- created_at: req.created_at,
- version: death_version,
- is_identified: false,
- is_deleted: true,
- last_seen_at: None,
- approx_bytes: approx_person_bytes(2),
- };
- let produce_started = Instant::now();
- let committed = self.commit_document(partition, &cache_key, death).await;
- record_release_phase("produce", produce_started);
- committed?;
- // The death document stays cached while its mark stands,
- // answering an authoritative not-found from memory; the
- // prune-time settle drops it once the writer confirms,
- // and PG answers from then on — revival included.
- self.fences.remove(&cache_key);
- counter!("personhog_leader_fences_total", "action" => "released_committed")
- .increment(1);
- }
- ReleaseOutcome::Aborted => {
- // The op backed out: drop the fence, keep the entry,
- // produce nothing. Gate first — a refused release must
- // leave the fence (pinned).
- let resp = self.authoritative_ok(partition, ReleaseFenceResponse {})?;
- self.fences.remove(&cache_key);
- counter!("personhog_leader_fences_total", "action" => "released_aborted")
- .increment(1);
- return Ok(resp);
- }
- ReleaseOutcome::Unspecified => {
- return Err(Status::invalid_argument("outcome must be specified"));
- }
- }
+ self.release_fence_rpc(request).await
+ }
- self.authoritative_ok(partition, ReleaseFenceResponse {})
+ async fn release_fences(
+ &self,
+ request: Request<ReleaseFencesRequest>,
+ ) -> Result<Response<ReleaseFencesResponse>, Status> {
+ self.release_fences_rpc(request).await
}
}
@@ -1974,6 +1673,7 @@ mod tests {
use common_kafka::config::KafkaConfig;
use envconfig::Envconfig;
use health::HealthRegistry;
+ use personhog_proto::personhog::types::v1::{LifecycleOpType, ReleaseOutcome};
use rdkafka::ClientConfig;
use tonic::Code;
diff --git a/rust/personhog-leader/src/service/lifecycle.rs b/rust/personhog-leader/src/service/lifecycle.rs
new file mode 100644
index 000000000000..194135d67578
--- /dev/null
+++ b/rust/personhog-leader/src/service/lifecycle.rs
@@ -0,0 +1,606 @@
+//! The lifecycle fence RPCs: a fence freezes a person for one op and
+//! seals its state, and a release closes the fence with the op's outcome.
+//! The single-call and batch handlers share the per-person helpers here.
+
+use std::time::Instant;
+
+use futures::StreamExt;
+use metrics::{counter, histogram};
+use personhog_common::grpc::is_semantic_refusal;
+use personhog_proto::personhog::types::v1::{
+ FencePersonRequest, FencePersonResponse, FencePersonsRequest, FencePersonsResponse,
+ FencedPersonSeal, LifecycleOpType, Person, ReleaseFenceRequest, ReleaseFenceResponse,
+ ReleaseFencesRequest, ReleaseFencesResponse, ReleaseOutcome,
+};
+use tonic::{Request, Response, Status};
+use uuid::Uuid;
+
+use crate::cache::{approx_person_bytes, CachedPerson, PersonCacheKey};
+use crate::fence::{fenced_status, mark_status, mark_statuses, semantic_refusal, FenceState};
+use crate::pg::PgFallback;
+
+use super::{cached_person_to_proto, partition_from_metadata, PersonHogLeaderService};
+
+/// The ceiling on persons per `FencePersons` or `ReleaseFences` call. The
+/// lifecycle service splits its calls at this size, so a larger batch is a
+/// caller bug, not load.
+const MAX_LIFECYCLE_BATCH_SIZE: usize = 100;
+
+/// Fences or releases of one batch call in flight at once. Above the
+/// fallback pool's size, extra loads only queue at the pool while the
+/// batch holds the partition's handoff drain.
+const LIFECYCLE_BATCH_CONCURRENCY: usize = 16;
+
+/// The one error a batch answers for: a semantic refusal is the final
+/// answer for its person and must not hide behind a sibling's transient
+/// error, which the saga would retry.
+#[allow(clippy::result_large_err)]
+fn first_batch_failure(failures: Vec<Status>) -> Result<(), Status> {
+ let mut failures = failures.into_iter();
+ let Some(first) = failures.next() else {
+ return Ok(());
+ };
+ Err(failures
+ .find(is_semantic_refusal)
+ .filter(|_| !is_semantic_refusal(&first))
+ .unwrap_or(first))
+}
+
+/// The per-person inputs of a committed release, validated the same way
+/// whether they arrive alone or in a batch.
+struct CommittedRelease {
+ person_id: i64,
+ person_uuid: String,
+ sealed_version: i64,
+ created_at: i64,
+}
+
+impl CommittedRelease {
+ #[allow(clippy::result_large_err)]
+ fn validate(
+ person_id: i64,
+ person_uuid: String,
+ sealed_version: Option<i64>,
+ created_at: i64,
+ ) -> Result<Self, Status> {
+ // 0 is a legitimate sealed version (a fresh stub's), which is why
+ // the field is explicitly optional in the proto.
+ let Some(sealed_version) = sealed_version else {
+ return Err(Status::invalid_argument(
+ "sealed_version is required for a committed release",
+ ));
+ };
+ if sealed_version < 0 {
+ return Err(Status::invalid_argument(
+ "sealed_version must not be negative",
+ ));
+ }
+ if created_at <= 0 {
+ return Err(Status::invalid_argument(
+ "created_at is required for a committed release",
+ ));
+ }
+ if Uuid::parse_str(&person_uuid).is_err() {
+ return Err(Status::invalid_argument(
+ "person_uuid must be a valid UUID for a committed release",
+ ));
+ }
+ Ok(Self {
+ person_id,
+ person_uuid,
+ sealed_version,
+ created_at,
+ })
+ }
+}
+
+/// A mark lookup that failed is rejected retriably: the op may well hold
+/// the person, but the leader could not prove it — fail closed.
+fn mark_lookup_failed(e: sqlx::Error) -> Status {
+ tracing::warn!(error = %e, "mark verification failed; rejecting (fail closed)");
+ Status::unavailable("could not verify the lifecycle op against its mark; retry")
+}
+
+/// Per-phase wall time of a committed release; the RPC histogram alone
+/// cannot separate the lock, the load, the mark check, and the produce.
+fn record_release_phase(phase: &'static str, started: Instant) {
+ histogram!("personhog_leader_release_phase_ms", "phase" => phase)
+ .record(started.elapsed().as_secs_f64() * 1000.0);
+}
+
+impl PersonHogLeaderService {
+ #[allow(clippy::result_large_err)]
+ fn lifecycle_db(&self) -> Result<&PgFallback, Status> {
+ self.fallback.as_ref().ok_or_else(|| {
+ semantic_refusal(
+ "no lifecycle database configured; refusing to produce a death document",
+ "no-lifecycle-db",
+ )
+ })
+ }
+
+ /// The committed half of a release for one person, given its mark
+ /// row's status. Shared by `ReleaseFence` and `ReleaseFences` so what
+ /// destroys a person is decided in one place.
+ async fn release_committed(
+ &self,
+ partition: u32,
+ team_id: i64,
+ op_id: Uuid,
+ release: &CommittedRelease,
+ mark: Option<&str>,
+ ) -> Result<(), Status> {
+ let cache_key = PersonCacheKey {
+ team_id,
+ person_id: release.person_id,
+ };
+ let mutex = self
+ .locks
+ .entry(cache_key.clone())
+ .or_default()
+ .value()
+ .clone();
+ let lock_started = Instant::now();
+ let _guard = mutex.lock().await;
+ record_release_phase("lock_wait", lock_started);
+
+ // Releasing another op's fence would break that op's seal.
+ if let Some(entry) = self.fences.get(&cache_key) {
+ if entry.op_id != op_id {
+ return Err(fenced_status(entry.value()));
+ }
+ }
+
+ // Release must stay idempotent for the saga's retry and the
+ // sweeper, so a person the leader cannot load anymore is
+ // tolerated.
+ let load_started = Instant::now();
+ let loaded = self.lookup_or_load_locked(partition, &cache_key).await;
+ record_release_phase("load", load_started);
+ let current = match loaded {
+ Ok(person) => Some(person),
+ Err(status) if status.code() == tonic::Code::NotFound => None,
+ Err(status) => return Err(status),
+ };
+
+ // Duplicate release: the death document already exists;
+ // producing another would only bump the version. Gate
+ // first — a refused release must leave the fence.
+ if current.as_ref().is_some_and(|p| p.is_deleted) {
+ self.assert_authoritative(partition)?;
+ self.fences.remove(&cache_key);
+ return Ok(());
+ }
+
+ // The request carries the identity a cold leader has nothing else
+ // for; when the leader does hold the person, the two must agree, or
+ // the death document would rewrite the row's uuid on its way out.
+ if let Some(person) = &current {
+ if person.uuid != release.person_uuid {
+ return Err(semantic_refusal(
+ "person_uuid does not match the person being released",
+ "uuid-mismatch",
+ ));
+ }
+ }
+
+ // The mark row must vouch for the op before anything is destroyed:
+ // the in-memory fence was installed on the request's word alone, so
+ // request plus fence is never enough. Unverifiable is refused.
+ match mark {
+ // A live mark: the op holds the person; proceed.
+ Some("marked") | Some("sealed") => {}
+ // The mark already settled as deleted: this release
+ // already happened and the tombstone is durable;
+ // absorb the retry.
+ Some("deleted") => {
+ self.assert_authoritative(partition)?;
+ self.fences.remove(&cache_key);
+ return Ok(());
+ }
+ _ => {
+ counter!("personhog_leader_fences_total", "action" => "release_unverified")
+ .increment(1);
+ return Err(semantic_refusal(
+ "op holds no live mark for this person; \
+ refusing to produce a death document",
+ "release-unverified",
+ ));
+ }
+ }
+
+ if !self.dirty_index.can_admit(&cache_key) {
+ counter!("personhog_leader_writes_shed_total", "reason" => "dirty_index_full")
+ .increment(1);
+ return Err(Status::resource_exhausted(
+ "dirty index at capacity: the writer is behind and this death document \
+ cannot be tracked; retry later",
+ ));
+ }
+ // The death version is sealed + 1, floored by the emitted floor and
+ // the cached version in case a deposed or indeterminate produce spent
+ // a higher version; a cold leader falls back to the request's seal.
+ let base_version = self.emitted_versions.floor_for(
+ partition,
+ &cache_key,
+ current
+ .as_ref()
+ .map(|p| p.version)
+ .unwrap_or(0)
+ .max(release.sealed_version),
+ );
+ let death_version = base_version.checked_add(1).ok_or_else(|| {
+ Status::invalid_argument("sealed_version leaves no room for the death version")
+ })?;
+ let death = CachedPerson {
+ id: release.person_id,
+ uuid: release.person_uuid.clone(),
+ team_id,
+ properties: b"{}".to_vec(),
+ // The sealed value, not the cached one: cold and warm
+ // leaders must produce the same document.
+ created_at: release.created_at,
+ version: death_version,
+ is_identified: false,
+ is_deleted: true,
+ last_seen_at: None,
+ approx_bytes: approx_person_bytes(2),
+ };
+ let produce_started = Instant::now();
+ let committed = self.commit_document(partition, &cache_key, death).await;
+ record_release_phase("produce", produce_started);
+ committed?;
+ // The death document stays cached while its mark stands, answering
+ // not-found from memory; the prune-time settle drops it once the
+ // writer confirms, and PG answers from then on.
+ self.fences.remove(&cache_key);
+ counter!("personhog_leader_fences_total", "action" => "released_committed").increment(1);
+ Ok(())
+ }
+
+ /// Fence one person and seal its state under its per-person lock,
+ /// shared by `FencePerson` and `FencePersons`. The caller has admitted
+ /// the partition: routing, authority, ownership, and the inflight guard.
+ async fn fence_one(
+ &self,
+ partition: u32,
+ cache_key: PersonCacheKey,
+ op_id: Uuid,
+ op_type: LifecycleOpType,
+ ) -> Result<Person, Status> {
+ let mutex = self
+ .locks
+ .entry(cache_key.clone())
+ .or_default()
+ .value()
+ .clone();
+ let _guard = mutex.lock().await;
+
+ let refence = if let Some(entry) = self.fences.get(&cache_key) {
+ if entry.op_id != op_id {
+ let holder = *entry.value();
+ drop(entry);
+ // One op holds a person at a time; the loser backs off. The
+ // holder may be a ghost whose op settled unheard, so kick the
+ // lazy heal, since a quiet person gets no other caller.
+ if let Some(healer) = &self.fence_healer {
+ healer.maybe_heal(cache_key.clone(), holder);
+ }
+ return Err(fenced_status(&holder));
+ }
+ true
+ } else {
+ false
+ };
+
+ // The map has no eviction, so a surge of ops is bounded by shedding
+ // new fences; re-seals are exempt because refusing them frees
+ // nothing. The saga's retry absorbs the backpressure.
+ if !refence && self.fences.len() >= self.fence_map_max_entries {
+ counter!("personhog_leader_fences_total", "action" => "shed_capacity").increment(1);
+ return Err(Status::resource_exhausted(format!(
+ "fence map at capacity ({} live fences); retry later",
+ self.fence_map_max_entries
+ )));
+ }
+
+ // The seal is the newest cached state under the write lock, raised
+ // to the emitted floor: an indeterminate pre-fence write may have
+ // spent a higher version. A same-op re-fence re-seals the same way.
+ let person = self.lookup_or_load_locked(partition, &cache_key).await?;
+ // The load can park on the per-key lock or a recovery; the seal,
+ // not the arrival, must be backed by ownership.
+ self.check_authority(partition)?;
+ if person.is_deleted {
+ return Err(Status::not_found("person is destroyed"));
+ }
+
+ let mut sealed = cached_person_to_proto(&person);
+ sealed.version = self
+ .emitted_versions
+ .floor_for(partition, &cache_key, person.version);
+
+ self.fences.insert(cache_key, FenceState { op_id, op_type });
+ counter!("personhog_leader_fences_total", "action" => "fenced").increment(1);
+ Ok(sealed)
+ }
+
+ /// The aborted half of a release for one person: drop the fence, keep
+ /// the entry, produce nothing. Gated first — a refused release must
+ /// leave the fence (pinned).
+ async fn release_aborted(
+ &self,
+ partition: u32,
+ team_id: i64,
+ person_id: i64,
+ op_id: Uuid,
+ ) -> Result<(), Status> {
+ let cache_key = PersonCacheKey { team_id, person_id };
+ let mutex = self
+ .locks
+ .entry(cache_key.clone())
+ .or_default()
+ .value()
+ .clone();
+ let _guard = mutex.lock().await;
+
+ // Releasing another op's fence would break that op's seal.
+ if let Some(entry) = self.fences.get(&cache_key) {
+ if entry.op_id != op_id {
+ return Err(fenced_status(entry.value()));
+ }
+ }
+ self.assert_authoritative(partition)?;
+ self.fences.remove(&cache_key);
+ counter!("personhog_leader_fences_total", "action" => "released_aborted").increment(1);
+ Ok(())
+ }
+
+ pub(super) async fn fence_person_rpc(
+ &self,
+ request: Request<FencePersonRequest>,
+ ) -> Result<Response<FencePersonResponse>, Status> {
+ let partition = partition_from_metadata(&request)?;
+ let req = request.into_inner();
+ self.validate_partition(partition, req.team_id, req.person_id)?;
+ // Ownership below is in-process state, which is what a lease
+ // lapse makes stale: a fence installed here gates no writes.
+ self.check_authority(partition)?;
+ let op_id = Uuid::parse_str(&req.op_id)
+ .map_err(|_| Status::invalid_argument("op_id must be a valid UUID"))?;
+ let op_type = req.op_type();
+ if op_type == LifecycleOpType::Unspecified {
+ return Err(Status::invalid_argument("op_type must be specified"));
+ }
+ // A fence installed anywhere but the current owner gates nothing:
+ // ownership covers a pod that already handed the partition off, the
+ // inflight guard covers the drain window; the saga's retry re-routes.
+ self.validate_ownership(partition)?;
+ let Some(_inflight_guard) = self.inflight.try_begin(partition) else {
+ return Err(Status::failed_precondition(format!(
+ "partition {partition} is fenced for handoff; writes are rejected"
+ )));
+ };
+
+ let cache_key = PersonCacheKey {
+ team_id: req.team_id,
+ person_id: req.person_id,
+ };
+ let sealed = self.fence_one(partition, cache_key, op_id, op_type).await?;
+
+ self.authoritative_ok(
+ partition,
+ FencePersonResponse {
+ sealed: Some(sealed),
+ },
+ )
+ }
+
+ pub(super) async fn fence_persons_rpc(
+ &self,
+ request: Request<FencePersonsRequest>,
+ ) -> Result<Response<FencePersonsResponse>, Status> {
+ let partition = partition_from_metadata(&request)?;
+ let req = request.into_inner();
+ if req.person_ids.len() > MAX_LIFECYCLE_BATCH_SIZE {
+ return Err(Status::invalid_argument(format!(
+ "FencePersons carries {} persons; the cap is {MAX_LIFECYCLE_BATCH_SIZE}",
+ req.person_ids.len()
+ )));
+ }
+ let team_id = req.team_id;
+ // The caller grouped its batch by partition and routed it by one
+ // member, so every member must hash to the routed partition; a
+ // stale partition count refuses the whole batch before any fence.
+ for person_id in &req.person_ids {
+ self.validate_partition(partition, team_id, *person_id)?;
+ }
+ self.check_authority(partition)?;
+ let op_id = Uuid::parse_str(&req.op_id)
+ .map_err(|_| Status::invalid_argument("op_id must be a valid UUID"))?;
+ let op_type = req.op_type();
+ if op_type == LifecycleOpType::Unspecified {
+ return Err(Status::invalid_argument("op_type must be specified"));
+ }
+ self.validate_ownership(partition)?;
+ let Some(_inflight_guard) = self.inflight.try_begin(partition) else {
+ return Err(Status::failed_precondition(format!(
+ "partition {partition} is fenced for handoff; writes are rejected"
+ )));
+ };
+ histogram!("personhog_leader_fence_batch_size").record(req.person_ids.len() as f64);
+
+ // Every fence runs to completion before the batch answers, so a
+ // sibling's refusal cancels no load in flight under a lock; the
+ // bound keeps the fallback pool's queue and the drain hold shallow.
+ let fence_futures = req.person_ids.into_iter().map(|person_id| async move {
+ let cache_key = PersonCacheKey { team_id, person_id };
+ (
+ person_id,
+ self.fence_one(partition, cache_key, op_id, op_type).await,
+ )
+ });
+ let results: Vec<_> = futures::stream::iter(fence_futures)
+ .buffer_unordered(LIFECYCLE_BATCH_CONCURRENCY)
+ .collect()
+ .await;
+
+ let mut sealed = Vec::with_capacity(results.len());
+ let mut not_found = Vec::new();
+ let mut failures = Vec::new();
+ for (person_id, result) in results {
+ match result {
+ Ok(person) => sealed.push(FencedPersonSeal {
+ person_id,
+ version: person.version,
+ created_at: person.created_at,
+ }),
+ Err(status) if status.code() == tonic::Code::NotFound => not_found.push(person_id),
+ Err(status) => failures.push(status),
+ }
+ }
+ first_batch_failure(failures)?;
+
+ self.authoritative_ok(partition, FencePersonsResponse { sealed, not_found })
+ }
+
+ pub(super) async fn release_fence_rpc(
+ &self,
+ request: Request<ReleaseFenceRequest>,
+ ) -> Result<Response<ReleaseFenceResponse>, Status> {
+ let partition = partition_from_metadata(&request)?;
+ let req = request.into_inner();
+ self.validate_partition(partition, req.team_id, req.person_id)?;
+ // The aborted arm would otherwise ack under a lapsed lease; the
+ // committed arm's produce and durable-fact acks need no cover.
+ self.check_authority(partition)?;
+ let op_id = Uuid::parse_str(&req.op_id)
+ .map_err(|_| Status::invalid_argument("op_id must be a valid UUID"))?;
+
+ match req.outcome() {
+ ReleaseOutcome::Committed => {
+ let release = CommittedRelease::validate(
+ req.person_id,
+ req.person_uuid,
+ req.sealed_version,
+ req.created_at,
+ )?;
+ // Producing to the changelog must respect the handoff
+ // write freeze like any write.
+ let Some(_inflight_guard) = self.inflight.try_begin(partition) else {
+ return Err(Status::failed_precondition(format!(
+ "partition {partition} is fenced for handoff; writes are rejected"
+ )));
+ };
+ let lifecycle_db = self.lifecycle_db()?;
+ let verify_started = Instant::now();
+ let mark = mark_status(lifecycle_db, op_id, req.team_id, req.person_id).await;
+ record_release_phase("verify_mark", verify_started);
+ let mark = mark.map_err(mark_lookup_failed)?;
+ self.release_committed(partition, req.team_id, op_id, &release, mark.as_deref())
+ .await?;
+ }
+ ReleaseOutcome::Aborted => {
+ self.release_aborted(partition, req.team_id, req.person_id, op_id)
+ .await?;
+ }
+ ReleaseOutcome::Unspecified => {
+ return Err(Status::invalid_argument("outcome must be specified"));
+ }
+ }
+
+ self.authoritative_ok(partition, ReleaseFenceResponse {})
+ }
+
+ pub(super) async fn release_fences_rpc(
+ &self,
+ request: Request<ReleaseFencesRequest>,
+ ) -> Result<Response<ReleaseFencesResponse>, Status> {
+ let partition = partition_from_metadata(&request)?;
+ let req = request.into_inner();
+ if req.persons.len() > MAX_LIFECYCLE_BATCH_SIZE {
+ return Err(Status::invalid_argument(format!(
+ "ReleaseFences carries {} persons; the cap is {MAX_LIFECYCLE_BATCH_SIZE}",
+ req.persons.len()
+ )));
+ }
+ let team_id = req.team_id;
+ // Same strict routing check as a batched fence: every member hashes
+ // to the routed partition or the whole batch is refused untouched.
+ for person in &req.persons {
+ self.validate_partition(partition, team_id, person.person_id)?;
+ }
+ // The aborted arm would otherwise ack under a lapsed lease; the
+ // committed arm's produce and durable-fact acks need no cover.
+ self.check_authority(partition)?;
+ self.validate_ownership(partition)?;
+ let op_id = Uuid::parse_str(&req.op_id)
+ .map_err(|_| Status::invalid_argument("op_id must be a valid UUID"))?;
+ histogram!("personhog_leader_release_batch_size").record(req.persons.len() as f64);
+
+ match req.outcome() {
+ ReleaseOutcome::Committed => {
+ let releases = req
+ .persons
+ .into_iter()
+ .map(|person| {
+ CommittedRelease::validate(
+ person.person_id,
+ person.person_uuid,
+ person.sealed_version,
+ person.created_at,
+ )
+ })
+ .collect::<Result<Vec<_>, Status>>()?;
+ if releases.is_empty() {
+ return self.authoritative_ok(partition, ReleaseFencesResponse {});
+ }
+ // Producing to the changelog must respect the handoff
+ // write freeze like any write.
+ let Some(_inflight_guard) = self.inflight.try_begin(partition) else {
+ return Err(Status::failed_precondition(format!(
+ "partition {partition} is fenced for handoff; writes are rejected"
+ )));
+ };
+ let lifecycle_db = self.lifecycle_db()?;
+ let person_ids: Vec<i64> = releases.iter().map(|r| r.person_id).collect();
+ let verify_started = Instant::now();
+ let marks = mark_statuses(lifecycle_db, op_id, team_id, &person_ids).await;
+ record_release_phase("verify_mark", verify_started);
+ let marks = marks.map_err(mark_lookup_failed)?;
+ // The releases run together so their death documents share
+ // fencing windows, and every one runs to completion: a
+ // sibling's failure cancels no produce in flight.
+ let release_futures: Vec<_> = releases
+ .iter()
+ .map(|release| {
+ let mark = marks.get(&release.person_id).map(String::as_str);
+ self.release_committed(partition, team_id, op_id, release, mark)
+ })
+ .collect();
+ let results: Vec<_> = futures::stream::iter(release_futures)
+ .buffer_unordered(LIFECYCLE_BATCH_CONCURRENCY)
+ .collect()
+ .await;
+ first_batch_failure(results.into_iter().filter_map(Result::err).collect())?;
+ }
+ ReleaseOutcome::Aborted => {
+ let mut failures = Vec::new();
+ for person in &req.persons {
+ if let Err(status) = self
+ .release_aborted(partition, team_id, person.person_id, op_id)
+ .await
+ {
+ failures.push(status);
+ }
+ }
+ first_batch_failure(failures)?;
+ }
+ ReleaseOutcome::Unspecified => {
+ return Err(Status::invalid_argument("outcome must be specified"));
+ }
+ }
+
+ self.authoritative_ok(partition, ReleaseFencesResponse {})
+ }
+}
diff --git a/rust/personhog-leader/tests/fence_integration.rs b/rust/personhog-leader/tests/fence_integration.rs
index 2e0ea6475cfc..8b494d60873c 100644
--- a/rust/personhog-leader/tests/fence_integration.rs
+++ b/rust/personhog-leader/tests/fence_integration.rs
@@ -25,8 +25,9 @@ use personhog_leader::warnings::WarningsProducer;
use personhog_proto::personhog::leader::v1::person_hog_leader_client::PersonHogLeaderClient;
use personhog_proto::personhog::leader::v1::person_hog_leader_server::PersonHogLeaderServer;
use personhog_proto::personhog::types::v1::{
- FencePersonRequest, FoldPersonDocumentRequest, GetPersonRequest, LifecycleOpType, Person,
- ReleaseFenceRequest, ReleaseOutcome, SealedSourceSnapshot, UpdatePersonPropertiesRequest,
+ FencePersonRequest, FencePersonsRequest, FoldPersonDocumentRequest, GetPersonRequest,
+ LifecycleOpType, Person, ReleaseFenceItem, ReleaseFenceRequest, ReleaseFencesRequest,
+ ReleaseOutcome, SealedSourceSnapshot, UpdatePersonPropertiesRequest,
};
use prost::Message;
use rdkafka::consumer::{BaseConsumer, Consumer};
@@ -2650,3 +2651,401 @@ async fn a_release_after_a_cache_eviction_still_produces_the_death_document() {
.await
.expect("cleanup person");
}
+
+/// The mark rows a committed release verifies against — committed by the
+/// saga before the fence in the real flow.
+async fn insert_delete_marks(
+ pool: &sqlx::postgres::PgPool,
+ op: Uuid,
+ team_id: i64,
+ person_ids: &[i64],
+) {
+ sqlx::query(
+ "INSERT INTO lifecycle_op (op_id, op_type, team_id, step, request) \
+ VALUES ($1, 'delete', $2, 'sealed', '{}'::jsonb)",
+ )
+ .bind(op)
+ .bind(team_id as i32)
+ .execute(pool)
+ .await
+ .expect("insert op");
+ for person_id in person_ids {
+ sqlx::query(
+ "INSERT INTO lifecycle_op_person (op_id, team_id, person_id, person_uuid, role, status) \
+ VALUES ($1, $2, $3, gen_random_uuid(), 'victim', 'sealed')",
+ )
+ .bind(op)
+ .bind(team_id as i32)
+ .bind(person_id)
+ .execute(pool)
+ .await
+ .expect("insert mark");
+ }
+}
+
+/// A person id on a partition other than the harness person's, with that
+/// partition.
+fn person_on_other_partition(harness: &FenceHarness) -> (i64, u32) {
+ let mut id = harness.person_id + 1;
+ loop {
+ let partition = partition_for_person(harness.team_id, id, NUM_PARTITIONS);
+ if partition != harness.partition {
+ return (id, partition);
+ }
+ id += 1;
+ }
+}
+
+/// A person id above `after` on the harness person's partition.
+fn another_person_on_harness_partition(harness: &FenceHarness, after: i64) -> i64 {
+ let mut id = after + 1;
+ loop {
+ if partition_for_person(harness.team_id, id, NUM_PARTITIONS) == harness.partition {
+ return id;
+ }
+ id += 1;
+ }
+}
+
+/// One `FencePersons` call fences every listed person of the routed
+/// partition, sealing each exactly as a single fence would, and reports a
+/// destroyed person in its answer instead of failing the batch for it.
+#[tokio::test]
+async fn a_batched_fence_seals_every_person_of_the_routed_partition() {
+ let mut harness = start_fence_harness(test_cached_person(), None).await;
+ let team_id = harness.team_id;
+ let partition = harness.partition;
+ let first_id = harness.person_id;
+ let second_id = another_person_on_harness_partition(&harness, first_id);
+ seed_person(
+ &harness.cache,
+ partition,
+ CachedPerson {
+ id: second_id,
+ uuid: Uuid::now_v7().to_string(),
+ team_id,
+ version: 5,
+ ..test_cached_person()
+ },
+ );
+ let destroyed_id = another_person_on_harness_partition(&harness, second_id);
+ seed_person(
+ &harness.cache,
+ partition,
+ CachedPerson {
+ id: destroyed_id,
+ uuid: Uuid::now_v7().to_string(),
+ team_id,
+ is_deleted: true,
+ ..test_cached_person()
+ },
+ );
+ let op = Uuid::now_v7();
+
+ let response = harness
+ .client
+ .fence_persons(with_partition(
+ FencePersonsRequest {
+ team_id,
+ op_id: op.to_string(),
+ op_type: LifecycleOpType::Delete.into(),
+ person_ids: vec![first_id, second_id, destroyed_id],
+ },
+ partition,
+ ))
+ .await
+ .expect("batched fence succeeds")
+ .into_inner();
+
+ let mut sealed: Vec<(i64, i64)> = response
+ .sealed
+ .iter()
+ .map(|seal| (seal.person_id, seal.version))
+ .collect();
+ sealed.sort_unstable();
+ assert_eq!(
+ sealed,
+ vec![(first_id, 1), (second_id, 5)],
+ "each seal is that person's current version"
+ );
+ assert_eq!(response.not_found, vec![destroyed_id]);
+ assert_eq!(
+ response.sealed[0].created_at,
+ test_cached_person().created_at
+ );
+
+ // Both persons are fenced by the op: writes are rejected with the
+ // typed fence, and a same-op re-fence re-seals.
+ for person_id in [first_id, second_id] {
+ let status = harness
+ .client
+ .update_person_properties(with_partition(
+ update_request(team_id, person_id),
+ partition,
+ ))
+ .await
+ .expect_err("a batch-fenced person rejects writes");
+ assert_eq!(status.code(), Code::FailedPrecondition);
+ assert_eq!(
+ status.metadata().get(FENCED_OP_ID_METADATA_KEY).unwrap(),
+ op.to_string().as_str()
+ );
+ harness
+ .client
+ .fence_person(with_partition(
+ fence_request(team_id, person_id, &op),
+ partition,
+ ))
+ .await
+ .expect("a same-op re-fence re-seals");
+ }
+}
+
+/// Every member of a batch must hash to the routed partition: one that
+/// hashes elsewhere refuses the whole call before anything is fenced, even
+/// when this pod serves that partition too.
+#[tokio::test]
+async fn a_batched_fence_with_a_person_off_the_routed_partition_is_refused_whole() {
+ let mut harness = start_fence_harness(test_cached_person(), None).await;
+ let team_id = harness.team_id;
+ let partition = harness.partition;
+ let person_id = harness.person_id;
+ let (foreign_id, foreign_partition) = person_on_other_partition(&harness);
+ harness.cache.create_partition(foreign_partition);
+ seed_person(
+ &harness.cache,
+ foreign_partition,
+ CachedPerson {
+ id: foreign_id,
+ uuid: Uuid::now_v7().to_string(),
+ team_id,
+ ..test_cached_person()
+ },
+ );
+
+ let status = harness
+ .client
+ .fence_persons(with_partition(
+ FencePersonsRequest {
+ team_id,
+ op_id: Uuid::now_v7().to_string(),
+ op_type: LifecycleOpType::Delete.into(),
+ person_ids: vec![person_id, foreign_id],
+ },
+ partition,
+ ))
+ .await
+ .expect_err("a batch with a person off the routed partition is refused");
+ assert_eq!(status.code(), Code::InvalidArgument);
+ assert!(status.metadata().get(FENCED_METADATA_KEY).is_none());
+
+ // Neither person was fenced: the local one still takes writes and the
+ // foreign one is free for another op.
+ harness
+ .client
+ .update_person_properties(with_partition(
+ update_request(team_id, person_id),
+ partition,
+ ))
+ .await
+ .expect("the local person is still writable");
+ harness
+ .client
+ .fence_person(with_partition(
+ fence_request(team_id, foreign_id, &Uuid::now_v7()),
+ foreign_partition,
+ ))
+ .await
+ .expect("the foreign person carries no fence from the refused batch");
+}
+
+/// One `ReleaseFences` call closes every fence of an op on the routed
+/// partition, producing each death document exactly as a single release
+/// would.
+#[tokio::test]
+async fn a_batched_release_closes_every_fence_of_the_routed_partition() {
+ let pool = common::create_persons_pool().await;
+ let mut harness = start_fence_harness(
+ test_cached_person(),
+ Some(PgFallback {
+ pool: pool.clone(),
+ table: "posthog_person".to_string(),
+ lifecycle: LifecycleTables::new("lifecycle_op", "lifecycle_op_person"),
+ }),
+ )
+ .await;
+ let team_id = harness.team_id;
+ let partition = harness.partition;
+ let first_id = harness.person_id;
+ let second_id = another_person_on_harness_partition(&harness, first_id);
+ let second_uuid = Uuid::now_v7().to_string();
+ seed_person(
+ &harness.cache,
+ partition,
+ CachedPerson {
+ id: second_id,
+ uuid: second_uuid.clone(),
+ team_id,
+ ..test_cached_person()
+ },
+ );
+ let op = Uuid::now_v7();
+ insert_delete_marks(&pool, op, team_id, &[first_id, second_id]).await;
+
+ let mut persons = Vec::new();
+ for (person_id, uuid) in [
+ (first_id, test_cached_person().uuid),
+ (second_id, second_uuid),
+ ] {
+ let sealed = harness
+ .client
+ .fence_person(with_partition(
+ fence_request(team_id, person_id, &op),
+ partition,
+ ))
+ .await
+ .expect("fence succeeds")
+ .into_inner()
+ .sealed
+ .expect("sealed state returned");
+ persons.push(ReleaseFenceItem {
+ person_id,
+ person_uuid: uuid,
+ sealed_version: Some(sealed.version),
+ created_at: sealed.created_at,
+ });
+ }
+
+ harness
+ .client
+ .release_fences(with_partition(
+ ReleaseFencesRequest {
+ team_id,
+ op_id: op.to_string(),
+ outcome: ReleaseOutcome::Committed.into(),
+ persons: persons.clone(),
+ },
+ partition,
+ ))
+ .await
+ .expect("batched release succeeds");
+
+ let records = changelog_records(&harness);
+ for person in &persons {
+ let death = records
+ .iter()
+ .find(|r| r.id == person.person_id && r.is_deleted)
+ .expect("a death document per released person");
+ assert_eq!(death.version, person.sealed_version.unwrap() + 1);
+ // The fence is gone: a new op finds a destroyed person, not a fence.
+ let status = harness
+ .client
+ .fence_person(with_partition(
+ fence_request(team_id, person.person_id, &Uuid::now_v7()),
+ partition,
+ ))
+ .await
+ .expect_err("a destroyed person cannot be fenced");
+ assert_eq!(status.code(), Code::NotFound);
+ }
+
+ sqlx::query("DELETE FROM lifecycle_op WHERE op_id = $1")
+ .bind(op)
+ .execute(&pool)
+ .await
+ .expect("cleanup op");
+}
+
+/// Every member of a release batch must hash to the routed partition. One
+/// that hashes elsewhere refuses the whole call before anything is
+/// destroyed, even when this pod serves that partition too.
+#[tokio::test]
+async fn a_batched_release_with_a_person_off_the_routed_partition_is_refused_whole() {
+ let pool = common::create_persons_pool().await;
+ let mut harness = start_fence_harness(
+ test_cached_person(),
+ Some(PgFallback {
+ pool: pool.clone(),
+ table: "posthog_person".to_string(),
+ lifecycle: LifecycleTables::new("lifecycle_op", "lifecycle_op_person"),
+ }),
+ )
+ .await;
+ let team_id = harness.team_id;
+ let partition = harness.partition;
+ let person_id = harness.person_id;
+ let (foreign_id, foreign_partition) = person_on_other_partition(&harness);
+ harness.cache.create_partition(foreign_partition);
+ let op = Uuid::now_v7();
+ insert_delete_marks(&pool, op, team_id, &[person_id]).await;
+
+ let sealed = harness
+ .client
+ .fence_person(with_partition(
+ fence_request(team_id, person_id, &op),
+ partition,
+ ))
+ .await
+ .expect("fence succeeds")
+ .into_inner()
+ .sealed
+ .expect("sealed state returned");
+
+ let status = harness
+ .client
+ .release_fences(with_partition(
+ ReleaseFencesRequest {
+ team_id,
+ op_id: op.to_string(),
+ outcome: ReleaseOutcome::Committed.into(),
+ persons: vec![
+ ReleaseFenceItem {
+ person_id,
+ person_uuid: test_cached_person().uuid,
+ sealed_version: Some(sealed.version),
+ created_at: sealed.created_at,
+ },
+ ReleaseFenceItem {
+ person_id: foreign_id,
+ person_uuid: Uuid::now_v7().to_string(),
+ sealed_version: Some(0),
+ created_at: sealed.created_at,
+ },
+ ],
+ },
+ partition,
+ ))
+ .await
+ .expect_err("a batch with a person off the routed partition is refused");
+ assert_eq!(status.code(), Code::InvalidArgument);
+
+ // The local person is untouched and still fenced by the op.
+ let read = harness
+ .client
+ .get_person(with_partition(
+ GetPersonRequest {
+ team_id,
+ person_id,
+ read_options: None,
+ },
+ partition,
+ ))
+ .await
+ .expect("the person is still alive");
+ assert_eq!(read.into_inner().person.unwrap().version, sealed.version);
+ let refenced = harness
+ .client
+ .fence_person(with_partition(
+ fence_request(team_id, person_id, &Uuid::now_v7()),
+ partition,
+ ))
+ .await
+ .expect_err("the op's fence still stands");
+ assert!(refenced.metadata().contains_key(FENCED_METADATA_KEY));
+
+ sqlx::query("DELETE FROM lifecycle_op WHERE op_id = $1")
+ .bind(op)
+ .execute(&pool)
+ .await
+ .expect("cleanup op");
+}
diff --git a/rust/personhog-router/src/proxy.rs b/rust/personhog-router/src/proxy.rs
index f091f69432f4..5a6049ec0079 100644
--- a/rust/personhog-router/src/proxy.rs
+++ b/rust/personhog-router/src/proxy.rs
@@ -40,6 +40,7 @@ pub const KNOWN_METHODS: &[&str] = &[
"DeletePersons",
"DeletePersonsBatchForTeam",
"FencePerson",
+ "FencePersons",
"FoldPersonDocument",
"GetDistinctIdsForPerson",
"GetDistinctIdsForPersons",
@@ -63,6 +64,7 @@ pub const KNOWN_METHODS: &[&str] = &[
"ListCohortMemberIds",
"ListGroups",
"ReleaseFence",
+ "ReleaseFences",
"SetPersonDistinctIdVersionFloor",
"SetPersonVersionFloor",
"SplitPerson",
@@ -251,15 +253,25 @@ impl RawProxyInner {
(resp, "leader", call_ms)
}
// Lifecycle fence RPCs: person writes, so they route to the
- // owning leader and share the handoff stash discipline.
+ // owning leader and share the handoff stash discipline. A batch
+ // is routed by the one person its headers name, like any other
+ // leader call; the leader checks the rest hash there too.
(Target::Service, "FencePerson") => {
let (resp, call_ms) = self.raw_proxy_to_leader(req, "FencePerson").await;
(resp, "leader", call_ms)
}
+ (Target::Service, "FencePersons") => {
+ let (resp, call_ms) = self.raw_proxy_to_leader(req, "FencePersons").await;
+ (resp, "leader", call_ms)
+ }
(Target::Service, "ReleaseFence") => {
let (resp, call_ms) = self.raw_proxy_to_leader(req, "ReleaseFence").await;
(resp, "leader", call_ms)
}
+ (Target::Service, "ReleaseFences") => {
+ let (resp, call_ms) = self.raw_proxy_to_leader(req, "ReleaseFences").await;
+ (resp, "leader", call_ms)
+ }
// The merge saga's document write: leader-routed like every
// person write.
(Target::Service, "FoldPersonDocument") => {
diff --git a/rust/personhog-router/tests/common/mod.rs b/rust/personhog-router/tests/common/mod.rs
index b8bee2c9deef..bb27979abe60 100644
--- a/rust/personhog-router/tests/common/mod.rs
+++ b/rust/personhog-router/tests/common/mod.rs
@@ -715,6 +715,14 @@ impl PersonHogLeader for TestLeaderService {
Err(Status::unimplemented("not exercised by router tests"))
}
+ async fn fence_persons(
+ &self,
+ request: Request<personhog_proto::personhog::types::v1::FencePersonsRequest>,
+ ) -> Result<Response<personhog_proto::personhog::types::v1::FencePersonsResponse>, Status> {
+ require_partition_metadata(&request)?;
+ Err(Status::unimplemented("not exercised by router tests"))
+ }
+
async fn release_fence(
&self,
request: Request<personhog_proto::personhog::types::v1::ReleaseFenceRequest>,
@@ -723,6 +731,15 @@ impl PersonHogLeader for TestLeaderService {
Err(Status::unimplemented("not exercised by router tests"))
}
+ async fn release_fences(
+ &self,
+ request: Request<personhog_proto::personhog::types::v1::ReleaseFencesRequest>,
+ ) -> Result<Response<personhog_proto::personhog::types::v1::ReleaseFencesResponse>, Status>
+ {
+ require_partition_metadata(&request)?;
+ Err(Status::unimplemented("not exercised by router tests"))
+ }
+
async fn fold_person_document(
&self,
request: Request<personhog_proto::personhog::types::v1::FoldPersonDocumentRequest>,
diff --git a/rust/personhog-test-harness/src/stack/mod.rs b/rust/personhog-test-harness/src/stack/mod.rs
index 7cd80f31e9b5..f2b224faa884 100644
--- a/rust/personhog-test-harness/src/stack/mod.rs
+++ b/rust/personhog-test-harness/src/stack/mod.rs
@@ -261,8 +261,8 @@ impl Stack {
let router_url = format!("http://127.0.0.1:{traffic_router_port}");
// Identity resolves and creates on the Postgres primary and pushes
- // initial properties through the traffic router; it holds no etcd
- // state, so it can come up alongside the routers. Its table set is
+ // initial properties through the traffic router; from etcd it reads
+ // only the partition count the reset above wrote. Its table set is
// derived from the stack's person table so identity, writer, and the
// leader fallback agree on one id namespace.
let identity_url = if config.spawn_identity {
@@ -274,6 +274,8 @@ impl Stack {
("GRPC_ADDRESS", format!("127.0.0.1:{IDENTITY_GRPC_PORT}")),
("PRIMARY_DATABASE_URL", config.persons_db_url.clone()),
("ROUTER_URL", router_url.clone()),
+ ("ETCD_ENDPOINTS", config.etcd_endpoints.clone()),
+ ("ETCD_PREFIX", ETCD_PREFIX.to_string()),
("METRICS_PORT", IDENTITY_METRICS_PORT.to_string()),
("PERSON_TABLE", config.pg_target_table.clone()),
(
diff --git a/rust/property-defs-rs/tests/group_type_resolver.rs b/rust/property-defs-rs/tests/group_type_resolver.rs
index 10a15b665903..d0720096f517 100644
--- a/rust/property-defs-rs/tests/group_type_resolver.rs
+++ b/rust/property-defs-rs/tests/group_type_resolver.rs
@@ -130,6 +130,21 @@ impl PersonHogService for MockPersonHogService {
Err(Status::unimplemented("not exercised by this mock"))
}
+ async fn fence_persons(
+ &self,
+ _req: Request<personhog_proto::personhog::types::v1::FencePersonsRequest>,
+ ) -> Result<Response<personhog_proto::personhog::types::v1::FencePersonsResponse>, Status> {
+ Err(Status::unimplemented("not exercised by this mock"))
+ }
+
+ async fn release_fences(
+ &self,
+ _req: Request<personhog_proto::personhog::types::v1::ReleaseFencesRequest>,
+ ) -> Result<Response<personhog_proto::personhog::types::v1::ReleaseFencesResponse>, Status>
+ {
+ Err(Status::unimplemented("not exercised by this mock"))
+ }
+
async fn fold_person_document(
&self,
_req: Request<personhog_proto::personhog::types::v1::FoldPersonDocumentRequest>,