Skip to content

Commit 1b5197f

Browse files
author
babenko
committed
Avoid uninitialized fields in TTableUploadOptions
commit_hash:560a4aa2f6f6e37f23c3fefe08f7648e9379c4d8
1 parent 7df51c0 commit 1b5197f

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

yt/yt/client/table_client/table_upload_options.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,6 @@ TTableUploadOptions GetFileUploadOptions(
359359
auto enableStripedErasure = cypressTableAttributes.Get<bool>("enable_striped_erasure", false);
360360
auto erasureCodec = cypressTableAttributes.Get<NErasure::ECodec>("erasure_codec", NErasure::ECodec::None);
361361

362-
TTableUploadOptions result;
363-
364362
if (path.GetAppend()) {
365363
THROW_ERROR_EXCEPTION("Attribute \"append\" is not supported for files")
366364
<< TErrorAttribute("path", path);
@@ -374,13 +372,11 @@ TTableUploadOptions GetFileUploadOptions(
374372
<< TErrorAttribute("path", path);
375373
}
376374

375+
TTableUploadOptions result;
377376
result.CompressionCodec = compressionCodec;
378377
result.ErasureCodec = erasureCodec;
379378
result.EnableStripedErasure = enableStripedErasure;
380379
result.SecurityTags = path.GetSecurityTags();
381-
result.LockMode = ELockMode::Exclusive;
382-
result.UpdateMode = EUpdateMode::Overwrite;
383-
384380
return result;
385381
}
386382

yt/yt/client/table_client/table_upload_options.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ class TEpochSchema
5050

5151
struct TTableUploadOptions
5252
{
53-
NChunkClient::EUpdateMode UpdateMode;
54-
NCypressClient::ELockMode LockMode;
53+
NChunkClient::EUpdateMode UpdateMode = NChunkClient::EUpdateMode::Overwrite;
54+
NCypressClient::ELockMode LockMode = NCypressClient::ELockMode::Exclusive;
5555
TEpochSchema TableSchema;
5656
TMasterTableSchemaId SchemaId;
57-
ETableSchemaModification SchemaModification;
57+
ETableSchemaModification SchemaModification = ETableSchemaModification::None;
5858
TVersionedWriteOptions VersionedWriteOptions;
59-
ETableSchemaMode SchemaMode;
60-
EOptimizeFor OptimizeFor;
59+
ETableSchemaMode SchemaMode = ETableSchemaMode::Strong;
60+
EOptimizeFor OptimizeFor = EOptimizeFor::Lookup;
6161
std::optional<NChunkClient::EChunkFormat> ChunkFormat;
62-
NCompression::ECodec CompressionCodec;
63-
NErasure::ECodec ErasureCodec;
64-
bool EnableStripedErasure;
62+
NCompression::ECodec CompressionCodec = NCompression::ECodec::None;
63+
NErasure::ECodec ErasureCodec = NErasure::ECodec::None;
64+
bool EnableStripedErasure = false;
6565
std::optional<std::vector<NSecurityClient::TSecurityTag>> SecurityTags;
66-
bool PartiallySorted;
66+
bool PartiallySorted = false;
6767

6868
TTableSchemaPtr GetUploadSchema() const;
6969

0 commit comments

Comments
 (0)