-
Notifications
You must be signed in to change notification settings - Fork 593
HDDS-11259. [hsync] DataNode should verify HBASE_SUPPORT layout version for every PutBlock. #7012
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
Changes from 1 commit
280a77d
99b6274
038380c
7c5b9c2
9b94f0e
e36387f
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 |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| import java.io.IOException; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
|
|
||
| import org.apache.hadoop.hdds.client.BlockID; | ||
| import org.apache.hadoop.hdds.conf.ConfigurationSource; | ||
|
|
@@ -65,7 +66,7 @@ public class BlockManagerImpl implements BlockManager { | |
| // Default Read Buffer capacity when Checksum is not present | ||
| private final int defaultReadBufferCapacity; | ||
| private final int readMappedBufferThreshold; | ||
| private boolean incrementalEnabled; | ||
| private final AtomicBoolean incrementalEnabled; | ||
|
|
||
| /** | ||
| * Constructs a Block Manager. | ||
|
|
@@ -81,15 +82,9 @@ public BlockManagerImpl(ConfigurationSource conf) { | |
| this.readMappedBufferThreshold = config.getBufferSize( | ||
| ScmConfigKeys.OZONE_CHUNK_READ_MAPPED_BUFFER_THRESHOLD_KEY, | ||
| ScmConfigKeys.OZONE_CHUNK_READ_MAPPED_BUFFER_THRESHOLD_DEFAULT); | ||
| incrementalEnabled = | ||
| incrementalEnabled = new AtomicBoolean( | ||
| config.getBoolean(OZONE_CHUNK_LIST_INCREMENTAL, | ||
| OZONE_CHUNK_LIST_INCREMENTAL_DEFAULT); | ||
| if (incrementalEnabled && !VersionedDatanodeFeatures.isFinalized( | ||
| HDDSLayoutFeature.HBASE_SUPPORT)) { | ||
| LOG.warn("DataNode has not finalized upgrading to a version that " + | ||
| "supports incremental chunk list. Fallback to full chunk list"); | ||
| incrementalEnabled = false; | ||
| } | ||
| OZONE_CHUNK_LIST_INCREMENTAL_DEFAULT)); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -162,7 +157,13 @@ public long persistPutBlock(KeyValueContainer container, | |
| } | ||
| } | ||
|
|
||
| db.getStore().putBlockByID(batch, incrementalEnabled, localID, data, | ||
| if (incrementalEnabled.get() && !VersionedDatanodeFeatures.isFinalized( | ||
| HDDSLayoutFeature.HBASE_SUPPORT)) { | ||
| LOG.warn("DataNode has not finalized upgrading to a version that " + | ||
| "supports incremental chunk list. Fallback to full chunk list"); | ||
| incrementalEnabled.set(false); | ||
|
||
| } | ||
| db.getStore().putBlockByID(batch, incrementalEnabled.get(), localID, data, | ||
| containerData, endOfBlock); | ||
| if (bcsId != 0) { | ||
| db.getStore().getMetadataTable().putWithBatch( | ||
|
|
@@ -258,7 +259,7 @@ private void mergeLastChunkForBlockFinalization(BlockID blockId, DBHandle db, | |
| if (blockData.getMetadata().containsKey(INCREMENTAL_CHUNK_LIST)) { | ||
| BlockData emptyBlockData = new BlockData(blockId); | ||
| emptyBlockData.addMetadata(INCREMENTAL_CHUNK_LIST, ""); | ||
| db.getStore().putBlockByID(batch, incrementalEnabled, localID, | ||
| db.getStore().putBlockByID(batch, incrementalEnabled.get(), localID, | ||
| emptyBlockData, kvContainer.getContainerData(), true); | ||
| } | ||
| } | ||
|
|
||
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.
finalizeBlock(..)inBlockManagerImplcan also have this check and return error before finalize.Uh oh!
There was an error while loading. Please reload this page.
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.
But since OM also checks upgrade finalize before and call will fail in OM itself, So in this case client will not call DN and I think this check is not required in DN in case of
finalizeBlock.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.
Agree. We should add the HDDSLayoutFeature.HBASE_SUPPORT check in finalizeBlock too. Although there is check in OM, the check in DN is also preferred. It's like the double insurance.