Skip to content

Commit

Permalink
Avoid uninitialized fields in TTableUploadOptions
Browse files Browse the repository at this point in the history
commit_hash:560a4aa2f6f6e37f23c3fefe08f7648e9379c4d8
  • Loading branch information
maxim-babenko committed Oct 15, 2024
1 parent 26f654d commit 75dc6b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 1 addition & 5 deletions yt/yt/client/table_client/table_upload_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,6 @@ TTableUploadOptions GetFileUploadOptions(
auto enableStripedErasure = cypressTableAttributes.Get<bool>("enable_striped_erasure", false);
auto erasureCodec = cypressTableAttributes.Get<NErasure::ECodec>("erasure_codec", NErasure::ECodec::None);

TTableUploadOptions result;

if (path.GetAppend()) {
THROW_ERROR_EXCEPTION("Attribute \"append\" is not supported for files")
<< TErrorAttribute("path", path);
Expand All @@ -374,13 +372,11 @@ TTableUploadOptions GetFileUploadOptions(
<< TErrorAttribute("path", path);
}

TTableUploadOptions result;
result.CompressionCodec = compressionCodec;
result.ErasureCodec = erasureCodec;
result.EnableStripedErasure = enableStripedErasure;
result.SecurityTags = path.GetSecurityTags();
result.LockMode = ELockMode::Exclusive;
result.UpdateMode = EUpdateMode::Overwrite;

return result;
}

Expand Down
18 changes: 9 additions & 9 deletions yt/yt/client/table_client/table_upload_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ class TEpochSchema

struct TTableUploadOptions
{
NChunkClient::EUpdateMode UpdateMode;
NCypressClient::ELockMode LockMode;
NChunkClient::EUpdateMode UpdateMode = NChunkClient::EUpdateMode::Overwrite;
NCypressClient::ELockMode LockMode = NCypressClient::ELockMode::Exclusive;
TEpochSchema TableSchema;
TMasterTableSchemaId SchemaId;
ETableSchemaModification SchemaModification;
ETableSchemaModification SchemaModification = ETableSchemaModification::None;
TVersionedWriteOptions VersionedWriteOptions;
ETableSchemaMode SchemaMode;
EOptimizeFor OptimizeFor;
ETableSchemaMode SchemaMode = ETableSchemaMode::Strong;
EOptimizeFor OptimizeFor = EOptimizeFor::Lookup;
std::optional<NChunkClient::EChunkFormat> ChunkFormat;
NCompression::ECodec CompressionCodec;
NErasure::ECodec ErasureCodec;
bool EnableStripedErasure;
NCompression::ECodec CompressionCodec = NCompression::ECodec::None;
NErasure::ECodec ErasureCodec = NErasure::ECodec::None;
bool EnableStripedErasure = false;
std::optional<std::vector<NSecurityClient::TSecurityTag>> SecurityTags;
bool PartiallySorted;
bool PartiallySorted = false;

TTableSchemaPtr GetUploadSchema() const;

Expand Down

0 comments on commit 75dc6b7

Please sign in to comment.