@@ -218,14 +218,10 @@ func isTooOldSchema(usedVersion, newVersion int64) bool {
218218// The second returned value is the delta updated table IDs.
219219func (do * Domain ) tryLoadSchemaDiffs (m * meta.Meta , usedVersion , newVersion int64 ) (bool , []int64 , error ) {
220220 // If there isn't any used version, or used version is too old, we do full load.
221+ // And when users use history read feature, we will set usedVersion to initialVersion, then full load is needed.
221222 if isTooOldSchema (usedVersion , newVersion ) {
222223 return false , nil , nil
223224 }
224- if usedVersion > newVersion {
225- // When user use History Read feature, history schema will be loaded.
226- // usedVersion may be larger than newVersion, full load is needed.
227- return false , nil , nil
228- }
229225 var diffs []* model.SchemaDiff
230226 for usedVersion < newVersion {
231227 usedVersion ++
@@ -260,7 +256,8 @@ func (do *Domain) InfoSchema() infoschema.InfoSchema {
260256// GetSnapshotInfoSchema gets a snapshot information schema.
261257func (do * Domain ) GetSnapshotInfoSchema (snapshotTS uint64 ) (infoschema.InfoSchema , error ) {
262258 snapHandle := do .infoHandle .EmptyClone ()
263- _ , _ , _ , err := do .loadInfoSchema (snapHandle , do .infoHandle .Get ().SchemaMetaVersion (), snapshotTS )
259+ // For the snapHandle, it's an empty Handle, so its usedSchemaVersion is initialVersion.
260+ _ , _ , _ , err := do .loadInfoSchema (snapHandle , initialVersion , snapshotTS )
264261 if err != nil {
265262 return nil , err
266263 }
0 commit comments