-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-13949. Move dbTxSequenceNumber from SnapshotInfo to LocalDataYaml file #9313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6e241f6
a869500
252d338
4099bc6
e02670c
5a66cfc
79580e9
2a331ef
c4f69e2
afbc592
70ac2c7
b554cc7
49eccfa
51eda04
25f766c
96689fa
0674299
5d9fc49
2d88176
a3c4c69
686d0c7
491a54b
5e69ee9
d36622a
ee213d1
81871b2
a95604e
5a90fcf
20d7d6a
ae655cb
25fa6ae
d419283
8a44308
cb94c36
e26052c
4d272d1
2a38f59
ca098cf
67d4b3d
9838cda
6a19dbb
665f411
2894e40
ea0ab16
915562b
1c0d0ac
24da3eb
8f3774a
503cd4e
6865fad
903ecd1
06d1e99
60a7728
4711517
af8754c
655a724
6386c1b
2bc6134
0de7c62
8e8c534
f148f24
da030c0
6af6498
b281569
1ad24b4
d629911
2aecde4
8eeb44b
d9301b3
06e7d37
efd6c51
fab85ea
c73a355
76b99e2
1d39bee
54f1508
b1a3834
1986bbe
52be3dd
5f50a04
908c47d
278605a
40265e1
ac4719b
cf19dce
34097de
c46ddc2
99afc02
fcc630e
6f144e2
4600c96
48ec0bb
f524cad
cb31b7c
02dd061
ff90af8
8b014dd
57662c6
bcc0fc8
79a46f4
cd24a81
5f0bb91
3de4346
5b55a59
aa6facf
cc35056
9c1689c
3f59895
95341dd
616bef3
b0023d1
36b6fb3
4596386
7af6521
e19dae2
8c1373a
25ee4e2
c6e3914
fd4bfdb
49f4424
613d106
8a29736
cca2dbf
a810cc1
78c1036
a2bbea5
bf4746f
09d955c
cde567d
49c662a
2cf1bce
7afc8f5
5849dac
e58ff09
83b887e
519495a
c125250
408e213
715b2f0
ec59b89
b0b6d6a
a759807
808b174
c829a8b
8e91e47
bfd341c
4ccd3fc
4fd3b0e
41b7cfb
3a8c8f6
d0422ae
4ff8cea
649468d
bb5139f
c46e1ae
298ae36
8e43b90
55c68bd
d1d04cf
974b5c2
018571c
6cd54dd
261a669
8955d80
ac88692
91c143a
151e887
3771ff4
0736d82
894a047
5823347
e3c9a94
6fbf8c7
ed007a4
43923cb
ea64602
0b16ef6
1507659
4c2a175
e2d5e83
9d4dd26
d696ffa
8523dea
9ee0298
1d771e0
121977e
9736247
2167b03
08156e4
84a0352
8890252
1067935
b086376
4b1cf63
9b2d4f8
a495846
90c28de
df34dd1
9d59f6d
1e04711
db0b5de
6fc9a2c
ed8ee79
ecb5084
632c009
1201350
505d6c5
edf0213
5c3efca
42ca3d7
faa1380
d3f3836
ee66820
4a36e98
668ca9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -172,9 +172,10 @@ public Object construct(Node node) { | |||||||||||||||||||
| final String prevSnapIdStr = (String) nodes.get(OzoneConsts.OM_SLD_PREV_SNAP_ID); | ||||||||||||||||||||
| UUID prevSnapId = prevSnapIdStr != null ? UUID.fromString(prevSnapIdStr) : null; | ||||||||||||||||||||
| final String purgeTxInfoStr = (String) nodes.get(OzoneConsts.OM_SLD_TXN_INFO); | ||||||||||||||||||||
| final long dbTxnSeqNumber = ((Number)nodes.get(OzoneConsts.OM_SLD_DB_TXN_SEQ_NUMBER)).longValue(); | ||||||||||||||||||||
|
||||||||||||||||||||
| final long dbTxnSeqNumber = ((Number)nodes.get(OzoneConsts.OM_SLD_DB_TXN_SEQ_NUMBER)).longValue(); | |
| Object dbTxnSeqNumberObj = nodes.getOrDefault(OzoneConsts.OM_SLD_DB_TXN_SEQ_NUMBER, 0L); | |
| long dbTxnSeqNumber; | |
| if (dbTxnSeqNumberObj instanceof Number) { | |
| dbTxnSeqNumber = ((Number) dbTxnSeqNumberObj).longValue(); | |
| } else { | |
| throw new IllegalArgumentException("Invalid type for dbTxSequenceNumber: " + | |
| dbTxnSeqNumberObj.getClass().getName() + ". Expected Number type."); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should never happen
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,11 +181,14 @@ public String getSnapshotLocalPropertyYamlPath(UUID snapshotId) { | |
| public void createNewOmSnapshotLocalDataFile(RDBStore snapshotStore, SnapshotInfo snapshotInfo) throws IOException { | ||
| try (WritableOmSnapshotLocalDataProvider snapshotLocalData = | ||
| new WritableOmSnapshotLocalDataProvider(snapshotInfo.getSnapshotId(), | ||
| () -> Pair.of(new OmSnapshotLocalData(snapshotInfo.getSnapshotId(), | ||
| getLiveSSTFilesForCFs(snapshotStore.getDb().getManagedRocksDb(), | ||
| COLUMN_FAMILIES_TO_TRACK_IN_SNAPSHOT), | ||
| snapshotInfo.getPathPreviousSnapshotId(), null), | ||
| null))) { | ||
| () -> { | ||
| List<LiveFileMetaData> lfms = getLiveSSTFilesForCFs(snapshotStore.getDb().getManagedRocksDb(), | ||
| COLUMN_FAMILIES_TO_TRACK_IN_SNAPSHOT); | ||
| long dbTxnSeqNumber = lfms.stream().mapToLong(LiveFileMetaData::largestSeqno).max().orElse(0L); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still want to fall back to the dbTxSeqNumber stored in SnapshotInfo proto?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No this should be ok. We are basically talking about acquiring an empty rocksdb if there are no sst files for the tables. |
||
| OmSnapshotLocalData localData = new OmSnapshotLocalData(snapshotInfo.getSnapshotId(), | ||
| lfms, snapshotInfo.getPathPreviousSnapshotId(), null, dbTxnSeqNumber); | ||
| return Pair.of(localData, null); | ||
| })) { | ||
| snapshotLocalData.commit(); | ||
| } | ||
| } | ||
|
|
@@ -263,16 +266,18 @@ private void addMissingSnapshotYamlFiles( | |
| // Create a yaml file for snapshots which are missing | ||
| if (!snapshotLocalDataFile.exists()) { | ||
| List<LiveFileMetaData> sstList = Collections.emptyList(); | ||
| long dbTxnSeqNumber = 0L; | ||
| if (snapshotInfo.getSnapshotStatus() == SNAPSHOT_ACTIVE) { | ||
| try (OmMetadataManagerImpl snapshotMetadataManager = defaultSnapProvider.apply(snapshotInfo)) { | ||
| ManagedRocksDB snapDB = ((RDBStore)snapshotMetadataManager.getStore()).getDb().getManagedRocksDb(); | ||
| sstList = getLiveSSTFilesForCFs(snapDB, COLUMN_FAMILIES_TO_TRACK_IN_SNAPSHOT); | ||
| dbTxnSeqNumber = sstList.stream().mapToLong(LiveFileMetaData::largestSeqno).max().orElse(0L); | ||
| } catch (Exception e) { | ||
| throw new IOException(e); | ||
| } | ||
| } | ||
| OmSnapshotLocalData snapshotLocalData = new OmSnapshotLocalData(snapshotId, sstList, | ||
| snapshotInfo.getPathPreviousSnapshotId(), null); | ||
| snapshotInfo.getPathPreviousSnapshotId(), null, dbTxnSeqNumber); | ||
| // Set needsDefrag to true to indicate that the snapshot needs to be defragmented, since the snapshot has | ||
| // never been defragmented before. | ||
| snapshotLocalData.setNeedsDefrag(true); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be safe to just remove this field later, so that when SnapshotInfo is serialized again this field will be ignored while maintaining compatibility, as long as we don't use field number
12ever again for this message.