简体   繁体   English

提升序列化库升级

[英]Boost Serialization Library upgrade

How do I know that I can safely upgrade Boost Serialization Library on a production system without breaking compatibility with the existing data ? 我怎么知道我可以安全地升级生产系统上的Boost Serialization Library而不破坏与现有数据的兼容性? Is there any test that I should perform in order to be sure that all data stored in the binary format by previous version of the library will be successfully read by the new one ? 是否有任何测试我应该执行以确保新版本的库成功读取以前版本的库以二进制格式存储的所有数据? Does Boost Serialization library itself guarantee some sort of compatibility between versions ? Boost Serialization库本身是否保证了版本之间的某种兼容性?

Boost.serialization is backward-compatible but is not guaranteed to be forwards compatible . Boost.serialization是向后兼容的,但保证是向前兼容的

This means: 这意味着:

  • you can create an archive with an older version of boost.serialization that can be read with a newer version. 您可以使用较旧版本的boost.serialization创建一个可以使用较新版本读取的存档。
  • There is no guarantee that an archive created with a newer version of boost.serialization will be readable by a older one. 无法保证使用较新版本的boost.serialization创建的存档可以被较旧版本读取。

If you send messages between a client and a server in both directions, for instance, you may have to upgrade the version of boost on both in lockstep. 例如,如果您在两个方向上在客户端和服务器之间发送消息,则可能必须以锁步方式升级两者的boost版本。

The 'wire format' does not change with every version of boost. 每种版本的boost都不会改变“有线格式”。 So between 2 specific versions of boost, you may have no problem - I can't find specific documentation of which version of the archive format is used within which version of boost. 因此,在2个特定版本的boost之间,您可能没有问题 - 我找不到哪个版本的boost在哪个版本的存档格式中使用的具体文档。

Note also that while backwards compatibility is 'guaranteed', that's just expressing an intent - although I guess you could get your money back ;-). 另请注意,虽然向后兼容性是“保证”,但这只是表达意图 - 尽管我猜你可以收回你的钱;-)。 Boost versions 1.42 and 1.43 had a bug that meant later versions cannot read them back - see the 1.45 release notes . Boost版本1.42和1.43有一个错误,意味着以后的版本无法读取它们 - 请参阅1.45发行说明

The initial Release was in Boost 1.32. 最初的发布是在Boost 1.32中。 It appears you can view the release history since then here: http://www.boost.org/doc/libs/1_43_0/libs/serialization/doc/release.html 从那时起,您可以查看发布历史记录: http//www.boost.org/doc/libs/1_43_0/libs/serialization/doc/release.html

Other than that I'd suggest asking on the boost mailing list: http://www.boost.org/community/groups.html#users 除此之外,我建议在boost邮件列表上询问: http//www.boost.org/community/groups.html#users

You can create test files using your current version of the software and store them. 您可以使用当前版本的软件创建测试文件并存储它们。 Then include loading of this files into your automatic tests. 然后包括将这些文件加载​​到自动测试中。

Unfortunately, even if your code will pass this test, you can not be 100% sure at compatibility, because there still can be some sort of serialized content that can not be loaded. 不幸的是,即使您的代码将通过此测试,您也无法100%确保兼容性,因为仍然可能存在某些无法加载的序列化内容。 Well, it is still better than nothing. 嗯,它总比没有好。

This test will automatically cover only backward compatibility. 此测试将自动仅涵盖向后兼容性。 Testing forward (upward) compatibility will be more complicated. 测试向前(向上)兼容性将更加复杂。 One will need to create test data for every new release and try to load it by every old version... 人们需要为每个新版本创建测试数据,并尝试按旧版本加载它...

Extended forward compatibility for boost::serialization is answered here 这里回答了boost :: serialization的扩展前向兼容性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM