-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{backup,changefeed,streaming}ccl: start populating pts target #74248
{backup,changefeed,streaming}ccl: start populating pts target #74248
Conversation
c7dde69
to
3d7425b
Compare
First two commits from #74281. |
3d7425b
to
ed08564
Compare
This is RFAL! I have a test for the backup target selection in a follow-up PR over in c7dde69. I also moved the |
@@ -64,12 +66,26 @@ func createProtectedTimestampRecord( | |||
progress.ProtectedTimestampRecord = uuid.MakeV4() | |||
log.VEventf(ctx, 2, "creating protected timestamp %v at %v", | |||
progress.ProtectedTimestampRecord, resolved) | |||
spansToProtect := makeSpansToProtect(codec, targets) | |||
deprecatedSpansToProtect := makeSpansToProtect(codec, targets) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need both targets and spans?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until we run the migration in #74281 we want to continue protecting spans so that jobs started in a mixed version state do not fail. Once the migration is complete, the Protect
method in the protected ts Storage
interface will stop writing these passed in spans to the underlying system.pts_records
table (this will come as a follow up PR). So all jobs started after the migration might pass in a record with the spans field set, but this will not be persisted.
The idea is that GC for 22.1 will continue to respect both spans protected by the old subsystem, and targets protected by the new subsystem since this simplifies the migration in a mixed version state. In 22.2 with some elbow grease, we should be able to stop populating the spans field in the record entirely.
@@ -89,28 +89,6 @@ message Metadata { | |||
|
|||
// Record corresponds to a protected timestamp. | |||
message Record { | |||
message SchemaObjectsTarget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it safe to change proto like this? we have serialized records stored in protected keys, don't we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fields were added only a couple days ago in #74211, since this is unreleased code I think it is safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If nobody generated and serialized those, then it's fine (i'm thinking roachtests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as an outsider to backup/changefeed/streaming.
@gh-casper adding you for the streaming diff, thanks! |
Also, <img class="emoji" title=":lgtm:" alt=":lgtm:" align="absmiddle" src="https://reviewable.io/lgtm.png" height="20" width="61"/> for the streaming stuff.
…On Wed, Jan 5, 2022 at 3:38 PM Aditya Maru ***@***.***> wrote:
@gh-casper <https://github.com/gh-casper> adding you for the streaming
diff, thanks!
—
Reply to this email directly, view it on GitHub
<#74248 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANA4FVGJF4HUYDM57VFSTP3UUST3XANCNFSM5KVK5VIA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
This change touches all jobs that create a protected timestamp record before calling `Protect`. Previously, the created record would contain the spans that the record was going to protect. With this change, the record will also populate the `Target` field on `ptpb.Record` with the object it is going to protect. The `Target` field is a proto message defined in `ptpb.Target` and can be one of: - Cluster - Tenants - Schema object (database or table) For backups, this target field is determined based on the targets passed in by the user via the `BACKUP <target>` query. For changefeeds, this target is the group of tables on which the changefeed is being started + `system.descriptors` table. For the streaming job, this target is the tenant that is being streamed. This change does not touch any test files that create a raw `ptpb.Record` for testing purposes. That will come in a follow up PR where we actually teach `Protect` to validate and make use of this `Target` field. A test for how backup chooses its target will also come in a follow up PR once Protect actually writes the encoded protobuf target field to the underlying system table. Informs: cockroachdb#73727 Release note: None
ed08564
to
2528c38
Compare
@dt friendly ping for the backup stuff, I'll be adding a test in a follow-up PR once we start persisting these targets in the system tables. |
for _, tenant := range backupManifest.Tenants { | ||
tenantID = append(tenantID, roachpb.MakeTenantID(tenant.ID)) | ||
} | ||
return ptpb.MakeTenantsTarget(tenantID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently BACKUP syntax doesn't allow backing up table 245 and tenant 123, but that is a valid backup job. It looks like however that is not possible with the ptpb.Target? i.e. tenants target and schema object targets are mutually exclusive?
Not blocking, since it's unreachable with current syntax, just wondering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not possible today yeah, we could in the future switch the Record to hold a repeated Target
instead of a single target to accommodate for this.
TFTR! bors r+ |
Build succeeded: |
This change touches all jobs that create a protected timestamp
record before calling
Protect
. Previously, the created recordwould contain the spans that the record was going to protect.
With this change, the record will also populate the
Target
field on
ptpb.Record
with the object it is going to protect.The
Target
field is a proto message defined inptpb.Target
and can be one of:
For backups, this target field is determined based on the targets
passed in by the user via the
BACKUP <target>
query.For changefeeds, this target is the group of tables on which the
changefeed is being started +
system.descriptors
table.For the streaming job, this target is the tenant that is being
streamed.
This change does not touch any test files that create
a raw
ptpb.Record
for testing purposes. That will come in a followup PR where we actually teach
Protect
to validate and make useof this
Target
field. A test for how backup chooses its targetwill also come in a follow up PR once Protect actually writes
the encoded protobuf target field to the underlying system table.
Informs: #73727
Release note: None