-
Notifications
You must be signed in to change notification settings - Fork 46
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
base: main
Are you sure you want to change the base?
Conversation
try { | ||
exec(session, "mkdir -p /tmp/dbsync/"); | ||
|
||
ProductMetadata productMetadata = new ProductMetadata(); |
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.
Use this to get client jar
dbsync/client/src/main/java/com/google/edwmigration/dbsync/client/SshManager.java
Outdated
Show resolved
Hide resolved
dbsync/client/src/main/java/com/google/edwmigration/dbsync/impl/DbsyncTargetImpl.java
Outdated
Show resolved
Hide resolved
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.
not needed
} | ||
} | ||
|
||
message OpenRequest { |
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.
not needed
message OpenRequest { | ||
} | ||
|
||
message OpenResponse { |
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.
not needed
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class ClientMain { |
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.
Not needed
getChecksumURI(stagingBucket, targetUri) | ||
); | ||
ChecksumGenerator generator = new ChecksumGenerator(CHECKSUM_BLOCK_SIZE); | ||
List<Checksum> checksums = new ArrayList<>(); |
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.
Should go direct to output stream
generator.generate(checksums::add, source); | ||
try (OutputStream checksumStream = checksumSink.openBufferedStream()) { | ||
for (Checksum checksum : checksums) { | ||
checksum.writeDelimitedTo(checksumStream); |
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.
Try without delimited
); | ||
|
||
String receiveCommand = | ||
String.format( |
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.
Alternative to string format
@@ -0,0 +1,10 @@ | |||
plugins { | |||
id 'idea' |
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.
Probably don't want to commit the idea plugin
); | ||
} | ||
|
||
public static void runRsyncJob(String projectId, String location, Mode mode) |
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.
Can split into server and client classes as discussed
} | ||
} | ||
|
||
private static final String PRODUCT_GROUP = "com.google.edwmigration.dumper"; |
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.
Update to dbsync
@SuppressWarnings("UnusedVariable") | ||
private static final Logger LOG = LoggerFactory.getLogger(DefaultArguments.class); | ||
|
||
public static class BooleanValueConverter implements ValueConverter<Boolean> { |
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.
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; |
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.
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); |
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.
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.
dbsync/settings.gradle
Outdated
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' | ||
} | ||
|
||
rootProject.name = 'dbsync' |
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.
Move to top level settings.gradle as discussed
No description provided.