Skip to content
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

DBSync Initial Implemetation #737

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

DBSync Initial Implemetation #737

wants to merge 2 commits into from

Conversation

samdgupi
Copy link
Collaborator

No description provided.

try {
exec(session, "mkdir -p /tmp/dbsync/");

ProductMetadata productMetadata = new ProductMetadata();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this to get client jar

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

}
}

message OpenRequest {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

message OpenRequest {
}

message OpenResponse {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ClientMain {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed

getChecksumURI(stagingBucket, targetUri)
);
ChecksumGenerator generator = new ChecksumGenerator(CHECKSUM_BLOCK_SIZE);
List<Checksum> checksums = new ArrayList<>();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should go direct to output stream

generator.generate(checksums::add, source);
try (OutputStream checksumStream = checksumSink.openBufferedStream()) {
for (Checksum checksum : checksums) {
checksum.writeDelimitedTo(checksumStream);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try without delimited

);

String receiveCommand =
String.format(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative to string format

@samdgupi samdgupi changed the title [DO NOT REVIEW] DBSync Initial Implemetation DBSync Initial Implemetation Feb 14, 2025
@samdgupi samdgupi marked this pull request as ready for review February 14, 2025 16:48
@@ -0,0 +1,10 @@
plugins {
id 'idea'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't want to commit the idea plugin

);
}

public static void runRsyncJob(String projectId, String location, Mode mode)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can split into server and client classes as discussed

}
}

private static final String PRODUCT_GROUP = "com.google.edwmigration.dumper";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to dbsync

@SuppressWarnings("UnusedVariable")
private static final Logger LOG = LoggerFactory.getLogger(DefaultArguments.class);

public static class BooleanValueConverter implements ValueConverter<Boolean> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't need this since we aren't accepting any boolean options


public class RsyncClient {

private static final int MIN_SIZE_TO_RSYNC = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update with valid min size - I think we said ~10KB but I could be wrong
cc @shevek-google

throws IOException, URISyntaxException {
// deploy all cloudrun jobs
try {
CloudRunHelper.deployRsyncJobs(projectId, stagingBucket, targetUri);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So IIUC for each file you are deploying and running 2 Rsync jobs (generate + receive). Could we deploy both jobs first, and then run them per file instead? i.e re-use the CR deployment but change the flags per execution with stagingBucket, targetURI, etc.

I think this would involve using ExecutionsClient and supplying the CLI args for targetUri, stagingUri per execution.

id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
}

rootProject.name = 'dbsync'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to top level settings.gradle as discussed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants