diff --git a/packages/orchestrator/orchestrator.proto b/packages/orchestrator/orchestrator.proto index 227a2665ee..c3fd6db6cb 100644 --- a/packages/orchestrator/orchestrator.proto +++ b/packages/orchestrator/orchestrator.proto @@ -128,9 +128,10 @@ message SandboxPauseRequest { } message SchedulingMetadata { - // base_build_id is the root layer (shared across the template's sandboxes); - // build_id is the final/current layer. Both also appear in the lists below. - string base_build_id = 1; + // memfile_base_build_id / rootfs_base_build_id are each artifact's root layer + // (shared across the template's sandboxes); they can differ. build_id is the + // final/current layer. All also appear in the lists below. + string memfile_base_build_id = 1; string build_id = 2; // Deduplicated build IDs whose data each artifact references (all ancestor // layers plus the build itself). Sorted; order is not significant. When a @@ -144,6 +145,7 @@ message SchedulingMetadata { // new memfile layer's bytes are a pre-dedup, block-granular upper bound. repeated uint64 memfile_build_bytes = 7; repeated uint64 rootfs_build_bytes = 8; + string rootfs_base_build_id = 9; } message SandboxPauseResponse { diff --git a/packages/orchestrator/pkg/scheduling/metadata.go b/packages/orchestrator/pkg/scheduling/metadata.go index 01f3f0bbb2..de6111ef4f 100644 --- a/packages/orchestrator/pkg/scheduling/metadata.go +++ b/packages/orchestrator/pkg/scheduling/metadata.go @@ -25,16 +25,15 @@ func FromHeaders(buildID uuid.UUID, memfileHeader, rootfsHeader *header.Header, return nil } - base := memfileHeader.Metadata.BaseBuildId - if base == uuid.Nil { - base = rootfsHeader.Metadata.BaseBuildId - } + memfileBase := memfileHeader.Metadata.BaseBuildId + rootfsBase := rootfsHeader.Metadata.BaseBuildId - memIDs, memBytes, memDropped := artifactBuilds(memfileHeader, base, buildID, newMemfileBytes) - rootIDs, rootBytes, rootDropped := artifactBuilds(rootfsHeader, base, buildID, 0) + memIDs, memBytes, memDropped := artifactBuilds(memfileHeader, memfileBase, buildID, newMemfileBytes) + rootIDs, rootBytes, rootDropped := artifactBuilds(rootfsHeader, rootfsBase, buildID, 0) return &orchestrator.SchedulingMetadata{ - BaseBuildId: base.String(), + MemfileBaseBuildId: memfileBase.String(), + RootfsBaseBuildId: rootfsBase.String(), BuildId: buildID.String(), MemfileBuildIds: memIDs, RootfsBuildIds: rootIDs, diff --git a/packages/shared/pkg/grpc/orchestrator/orchestrator.pb.go b/packages/shared/pkg/grpc/orchestrator/orchestrator.pb.go index d725a42e06..29e3c041bc 100644 --- a/packages/shared/pkg/grpc/orchestrator/orchestrator.pb.go +++ b/packages/shared/pkg/grpc/orchestrator/orchestrator.pb.go @@ -1015,10 +1015,11 @@ type SchedulingMetadata struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // base_build_id is the root layer (shared across the template's sandboxes); - // build_id is the final/current layer. Both also appear in the lists below. - BaseBuildId string `protobuf:"bytes,1,opt,name=base_build_id,json=baseBuildId,proto3" json:"base_build_id,omitempty"` - BuildId string `protobuf:"bytes,2,opt,name=build_id,json=buildId,proto3" json:"build_id,omitempty"` + // memfile_base_build_id / rootfs_base_build_id are each artifact's root layer + // (shared across the template's sandboxes); they can differ. build_id is the + // final/current layer. All also appear in the lists below. + MemfileBaseBuildId string `protobuf:"bytes,1,opt,name=memfile_base_build_id,json=memfileBaseBuildId,proto3" json:"memfile_base_build_id,omitempty"` + BuildId string `protobuf:"bytes,2,opt,name=build_id,json=buildId,proto3" json:"build_id,omitempty"` // Deduplicated build IDs whose data each artifact references (all ancestor // layers plus the build itself). Sorted; order is not significant. When a // list exceeds the cap, the lightest layers are dropped first and the count @@ -1031,6 +1032,7 @@ type SchedulingMetadata struct { // new memfile layer's bytes are a pre-dedup, block-granular upper bound. MemfileBuildBytes []uint64 `protobuf:"varint,7,rep,packed,name=memfile_build_bytes,json=memfileBuildBytes,proto3" json:"memfile_build_bytes,omitempty"` RootfsBuildBytes []uint64 `protobuf:"varint,8,rep,packed,name=rootfs_build_bytes,json=rootfsBuildBytes,proto3" json:"rootfs_build_bytes,omitempty"` + RootfsBaseBuildId string `protobuf:"bytes,9,opt,name=rootfs_base_build_id,json=rootfsBaseBuildId,proto3" json:"rootfs_base_build_id,omitempty"` } func (x *SchedulingMetadata) Reset() { @@ -1065,9 +1067,9 @@ func (*SchedulingMetadata) Descriptor() ([]byte, []int) { return file_orchestrator_proto_rawDescGZIP(), []int{14} } -func (x *SchedulingMetadata) GetBaseBuildId() string { +func (x *SchedulingMetadata) GetMemfileBaseBuildId() string { if x != nil { - return x.BaseBuildId + return x.MemfileBaseBuildId } return "" } @@ -1121,6 +1123,13 @@ func (x *SchedulingMetadata) GetRootfsBuildBytes() []uint64 { return nil } +func (x *SchedulingMetadata) GetRootfsBaseBuildId() string { + if x != nil { + return x.RootfsBaseBuildId + } + return "" +} + type SandboxPauseResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1689,31 +1698,35 @@ var file_orchestrator_proto_rawDesc = []byte{ 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x22, 0xf1, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x22, 0xb1, 0x03, 0x0a, 0x12, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x22, 0x0a, 0x0d, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x62, 0x75, 0x69, - 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x73, - 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x75, 0x69, 0x6c, - 0x64, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, - 0x64, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x62, - 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, - 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x73, 0x12, - 0x28, 0x0a, 0x10, 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, - 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x6f, 0x6f, 0x74, 0x66, - 0x73, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x6d, 0x65, 0x6d, - 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69, - 0x6c, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x6d, 0x65, 0x6d, 0x66, 0x69, - 0x6c, 0x65, 0x44, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x12, - 0x32, 0x0a, 0x15, 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, - 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x13, - 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x44, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x42, 0x75, 0x69, - 0x6c, 0x64, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x62, - 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, - 0x52, 0x11, 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x5f, 0x62, 0x75, - 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x04, 0x52, - 0x10, 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x42, 0x79, 0x74, 0x65, - 0x73, 0x22, 0x5c, 0x0a, 0x14, 0x53, 0x61, 0x6e, 0x64, 0x62, 0x6f, 0x78, 0x50, 0x61, 0x75, 0x73, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x31, 0x0a, 0x15, 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x5f, + 0x62, 0x61, 0x73, 0x65, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x12, 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x61, 0x73, 0x65, + 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x6d, + 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x73, 0x12, 0x28, + 0x0a, 0x10, 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, + 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x6d, 0x65, 0x6d, 0x66, + 0x69, 0x6c, 0x65, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, + 0x65, 0x44, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x12, 0x32, + 0x0a, 0x15, 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, + 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x13, 0x72, + 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x44, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, + 0x64, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, 0x52, + 0x11, 0x6d, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x5f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x04, 0x52, 0x10, + 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, + 0x12, 0x2f, 0x0a, 0x14, 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, + 0x72, 0x6f, 0x6f, 0x74, 0x66, 0x73, 0x42, 0x61, 0x73, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x49, + 0x64, 0x22, 0x5c, 0x0a, 0x14, 0x53, 0x61, 0x6e, 0x64, 0x62, 0x6f, 0x78, 0x50, 0x61, 0x75, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x13, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c,