Disable writing of compressed checkpoints.

Snappy compression (and decompression) was enabled after the
1.1 release (in commit 63b2f999d3).
This means that checkpoints produced by the 1.2.0 release candidates
will cause TensorFlow 1.1 (and prior) binaries to crash as they
CHECK fail when trying to load snappy-compressed tables.

To ease transition, disable writing of compressed checkpoints in
1.2.0 for now.

Reconsider this in the next release.

PiperOrigin-RevId: 157675189
This commit is contained in:
Asim Shankar 2017-05-31 21:56:30 -07:00 committed by TensorFlower Gardener
parent 6db400bbcf
commit d3e840a6c1

View File

@ -255,6 +255,16 @@ Status CorruptFileError(const Status& in_status, const string& filename,
detail, "): ", in_status.error_message()));
}
table::Options TableBuilderOptions() {
table::Options o;
// Compressed tables cannot be read by TensorFlow releases prior to 1.1.
// To smoothen the transition, compressed writes are disabled for now
// (version 1.2) with the intention that they will be enabled again at
// some point (perhaps the 1.3 release?).
o.compression = table::kNoCompression;
return o;
}
} // namespace
BundleWriter::BundleWriter(Env* env, StringPiece prefix)
@ -442,7 +452,7 @@ static Status MergeOneBundle(Env* env, StringPiece prefix,
table::Table* table = nullptr;
TF_RETURN_IF_ERROR(
table::Table::Open(table::Options(), file.get(), file_size, &table));
table::Table::Open(TableBuilderOptions(), file.get(), file_size, &table));
std::unique_ptr<table::Table> table_deleter(table);
std::unique_ptr<table::Iterator> iter(table->NewIterator());
@ -555,7 +565,7 @@ Status MergeBundles(Env* env, gtl::ArraySlice<string> prefixes,
TF_RETURN_IF_ERROR(
env->NewWritableFile(MetaFilename(merged_prefix), &merged_metadata));
{
table::TableBuilder builder(table::Options(), merged_metadata.get());
table::TableBuilder builder(TableBuilderOptions(), merged_metadata.get());
// Header entry.
BundleHeaderProto header;
header.set_num_shards(merge.num_shards);