Skip to content

Commit b9ba6f6

Browse files
authored
core/rawdb: open meta file in read only mode (#26009)
1 parent d86fe26 commit b9ba6f6

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

core/rawdb/freezer_table.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,12 @@ func newTable(path string, name string, readMeter metrics.Meter, writeMeter metr
148148
meta *os.File
149149
)
150150
if readonly {
151-
// Will fail if table doesn't exist
151+
// Will fail if table index file or meta file is not existent
152152
index, err = openFreezerFileForReadOnly(filepath.Join(path, idxName))
153153
if err != nil {
154154
return nil, err
155155
}
156-
// TODO(rjl493456442) change it to read-only mode. Open the metadata file
157-
// in rw mode. It's a temporary solution for now and should be changed
158-
// whenever the tail deletion is actually used. The reason for this hack is
159-
// the additional meta file for each freezer table is added in order to support
160-
// tail deletion, but for most legacy nodes this file is missing. This check
161-
// will suddenly break lots of database relevant commands. So the metadata file
162-
// is always opened for mutation and nothing else will be written except
163-
// the initialization.
164-
meta, err = openFreezerFileForAppend(filepath.Join(path, fmt.Sprintf("%s.meta", name)))
156+
meta, err = openFreezerFileForReadOnly(filepath.Join(path, fmt.Sprintf("%s.meta", name)))
165157
if err != nil {
166158
return nil, err
167159
}

0 commit comments

Comments
 (0)