-
Notifications
You must be signed in to change notification settings - Fork 336
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
Adding internal config to retain non-logged stores on container start #1229
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 |
---|---|---|
|
@@ -74,9 +74,12 @@ public class StorageConfig extends MapConfig { | |
static final String INMEMORY_KV_STORAGE_ENGINE_FACTORY = | ||
"org.apache.samza.storage.kv.inmemory.InMemoryKeyValueStorageEngineFactory"; | ||
|
||
// Internal config to clean storeDirs of a store on container start. This is used to benchmark bootstrap performance. | ||
// Internal config to clean storeDirs of a logged store on container start. This is used to benchmark bootstrap performance. | ||
static final String CLEAN_LOGGED_STOREDIRS_ON_START = STORE_PREFIX + "%s.clean.on.container.start"; | ||
|
||
// Internal config to clean storeDirs of a logged store on container start. This is used to benchmark bootstrap performance. | ||
static final String RETAIN_NONLOGGED_STOREDIRS_ON_START = STORE_PREFIX + "%s.retain.on.container.start"; | ||
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. should we name this config to reflect the non-logged only case ? |
||
|
||
public StorageConfig(Config config) { | ||
super(config); | ||
} | ||
|
@@ -266,4 +269,13 @@ public int getNumPersistentStores() { | |
public boolean getCleanLoggedStoreDirsOnStart(String storeName) { | ||
return getBoolean(String.format(CLEAN_LOGGED_STOREDIRS_ON_START, storeName), false); | ||
} | ||
|
||
/** | ||
* Helper method to get if nonlogged store dirs should not be deleted on container start. | ||
* @param storeName | ||
* @return | ||
*/ | ||
public boolean getRetainNonloggedStoreDirsOnStart(String storeName) { | ||
return getBoolean(String.format(RETAIN_NONLOGGED_STOREDIRS_ON_START, storeName), false); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,7 +132,7 @@ private void cleanBaseDirsAndReadOffsetFiles() { | |
storageManagerUtil.getTaskStoreDir(nonLoggedStoreBaseDirectory, storeName, taskModel.getTaskName(), taskModel.getTaskMode()); | ||
LOG.info("Got non logged storage partition directory as " + nonLoggedStorePartitionDir.toPath().toString()); | ||
|
||
if (nonLoggedStorePartitionDir.exists()) { | ||
if (nonLoggedStorePartitionDir.exists() || !storageConfig.getRetainNonloggedStoreDirsOnStart(storeName)) { | ||
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. update doc string to indicate that deletion is conditional. 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. Should this be |
||
LOG.info("Deleting non logged storage partition directory " + nonLoggedStorePartitionDir.toPath().toString()); | ||
fileUtil.rm(nonLoggedStorePartitionDir); | ||
} | ||
|
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.
/s/logged/non-logged/