-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-38336][state/forst] Avoid data copy during failover for ForSt statebackend #27042
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.state.forst; | ||
|
||
import org.apache.flink.core.fs.Path; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** Container for ForSt paths. */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it would be worth describing each path here. The text talks of Forst paths , but there are only 2 of the 6 that mention Forst - |
||
public class ForStPathContainer { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(ForStResourceContainer.class); | ||
public static final String DB_DIR_STRING = "db"; | ||
|
||
@Nullable final Path localJobPath; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this not private? |
||
@Nullable private final Path localBasePath; | ||
@Nullable private final Path localForStPath; | ||
|
||
@Nullable private final Path remoteJobPath; | ||
@Nullable private final Path remoteBasePath; | ||
@Nullable private final Path remoteForStPath; | ||
|
||
public static ForStPathContainer empty() { | ||
return of(null, null, null, null); | ||
} | ||
|
||
public static ForStPathContainer ofLocal( | ||
@Nullable Path localJobPath, @Nullable Path localBasePath) { | ||
return new ForStPathContainer(localJobPath, localBasePath, null, null); | ||
} | ||
|
||
public static ForStPathContainer of( | ||
@Nullable Path localJobPath, | ||
@Nullable Path localBasePath, | ||
@Nullable Path remoteJobPath, | ||
@Nullable Path remoteBasePath) { | ||
return new ForStPathContainer(localJobPath, localBasePath, remoteJobPath, remoteBasePath); | ||
} | ||
|
||
public ForStPathContainer( | ||
@Nullable Path localJobPath, | ||
@Nullable Path localBasePath, | ||
@Nullable Path remoteJobPath, | ||
@Nullable Path remoteBasePath) { | ||
this.localJobPath = localJobPath; | ||
this.localBasePath = localBasePath; | ||
this.localForStPath = localBasePath != null ? new Path(localBasePath, DB_DIR_STRING) : null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have localJobPath, localBasePath and localForStPath which is derived from localBasePath. I was expecting localJobpath to be a subfolder of localBasePath, is this true? Is this the bean to validate that? I see localBasePath can be null, in this case localForStPath is set to null, but localJobPath can have a value. What does this mean? The code indicates that it is possible to run without Forst but have a . Have I understood this correctly? |
||
|
||
this.remoteJobPath = remoteJobPath; | ||
this.remoteBasePath = remoteBasePath; | ||
this.remoteForStPath = | ||
remoteBasePath != null ? new Path(remoteBasePath, DB_DIR_STRING) : null; | ||
|
||
LOG.info( | ||
"ForStPathContainer: localJobPath: {}, localBasePath: {}, localForStPath:{}, remoteJobPath: {}, remoteBasePath: {}, remoteForStPath: {}", | ||
localJobPath, | ||
localBasePath, | ||
localForStPath, | ||
remoteJobPath, | ||
remoteBasePath, | ||
remoteForStPath); | ||
} | ||
|
||
public @Nullable Path getLocalJobPath() { | ||
return localJobPath; | ||
} | ||
|
||
public @Nullable Path getLocalBasePath() { | ||
return localBasePath; | ||
} | ||
|
||
public @Nullable Path getLocalForStPath() { | ||
return localForStPath; | ||
} | ||
|
||
public @Nullable Path getRemoteJobPath() { | ||
return remoteJobPath; | ||
} | ||
|
||
public @Nullable Path getRemoteBasePath() { | ||
return remoteBasePath; | ||
} | ||
|
||
public @Nullable Path getRemoteForStPath() { | ||
return remoteForStPath; | ||
} | ||
|
||
public Path getJobPath() { | ||
if (remoteJobPath != null) { | ||
return remoteJobPath; | ||
} else { | ||
return localJobPath; | ||
} | ||
} | ||
|
||
public Path getBasePath() { | ||
if (remoteBasePath != null) { | ||
return remoteBasePath; | ||
} else { | ||
return localBasePath; | ||
} | ||
} | ||
|
||
public Path getDbPath() { | ||
if (remoteForStPath != null) { | ||
return remoteForStPath; | ||
} else { | ||
return localForStPath; | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe add equals and hashcode standard methods for beans |
||
return "ForStPathContainer(localJobPath = [" | ||
+ localJobPath | ||
+ "] localBasePath = [" | ||
+ localBasePath | ||
+ "] localForStPath = [" | ||
+ localForStPath | ||
+ "] remoteJobPath = [" | ||
+ remoteJobPath | ||
+ "] remoteBasePath = [" | ||
+ remoteBasePath | ||
+ "] remoteForStPath = [" | ||
+ remoteForStPath | ||
+ "])"; | ||
} | ||
} |
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 optionsContainer.getPathContainer() ever null?