Bug 1815637

Summary: etcd: mvcc/backend: Fix corruption bug in defrag
Product: OpenShift Container Platform Reporter: Sam Batschelet <sbatsche>
Component: EtcdAssignee: Sam Batschelet <sbatsche>
Status: CLOSED ERRATA QA Contact: ge liu <geliu>
Severity: high Docs Contact:
Priority: high    
Version: 4.4CC: dmace, geliu, mfojtik, skolicha
Target Milestone: ---Keywords: Reopened
Target Release: 4.4.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1815638 1855896 (view as bug list) Environment:
Last Closed: 2020-07-21 10:31:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1855897    
Bug Blocks: 1815638    

Description Sam Batschelet 2020-03-20 19:09:38 UTC
Description of problem:

If etcd is terminated during the defrag operation, the db.tmp file that it creates can be orphaned. If this happens, the next defragmentation operation that occurs will open the orphaned db.tmp instead of creating an empty db.tmp file, and starting with a fresh slate, as it should.

Once the defragmentation operation opens db.tmp , it traverses all key-values in the main db file and writes them to db.tmp. Any key-values already in the db.tmp file that are not overwritten by this copy remain in it, corrupting the boltdb keyspace. When the defragmentation operation completes successfully, db.tmp replaces db via file move and the main db file is now corrupt.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results: etcd state is not corrupted by defrag.


Additional info:

Comment 3 Sam Batschelet 2020-04-10 03:37:36 UTC
*** Bug 1822832 has been marked as a duplicate of this bug. ***

Comment 9 Dan Mace 2020-06-18 17:41:36 UTC
Fixed upstream in v3.3.19 (commit b0a4038).

Comment 12 Michal Fojtik 2020-06-19 13:08:59 UTC
This is not 4.5.0 blocker, moving to target 4.6.0 and we backport to 4.4.0.

Comment 18 ge liu 2020-07-17 08:49:32 UTC
Execute regression test have not hit issues.

Comment 20 errata-xmlrpc 2020-07-21 10:31:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2913

Comment 21 Sam Batschelet 2020-08-21 16:08:10 UTC
*** Bug 1815638 has been marked as a duplicate of this bug. ***