Skip to content

Commit

Permalink
Fix restore with view (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter committed Nov 29, 2024
1 parent 37277ee commit 49ff3b4
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pkg/ccr/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -953,20 +953,25 @@ func (j *Job) fullSync() error {
}
if len(j.progress.TableAliases) > 0 {
tableRefs = make([]*festruct.TTableRef, 0)
viewMap := make(map[string]interface{})
for _, viewName := range inMemoryData.Views {
log.Debugf("fullsync alias with view ref %s", viewName)
viewMap[viewName] = nil
tableRef := &festruct.TTableRef{Table: utils.ThriftValueWrapper(viewName)}
tableRefs = append(tableRefs, tableRef)
}
for _, tableName := range tableNameMapping {
if alias, ok := j.progress.TableAliases[tableName]; ok {
log.Debugf("fullsync alias skip table ref %s because it has alias %s", tableName, alias)
continue
}
if _, ok := viewMap[tableName]; ok {
continue
}
log.Debugf("fullsync alias with table ref %s", tableName)
tableRef := &festruct.TTableRef{Table: utils.ThriftValueWrapper(tableName)}
tableRefs = append(tableRefs, tableRef)
}
for _, viewName := range inMemoryData.Views {
log.Debugf("fullsync alias with view ref %s", viewName)
tableRef := &festruct.TTableRef{Table: utils.ThriftValueWrapper(viewName)}
tableRefs = append(tableRefs, tableRef)
}
for table, alias := range j.progress.TableAliases {
log.Infof("fullsync alias table from %s to %s", table, alias)
tableRef := &festruct.TTableRef{
Expand Down

0 comments on commit 49ff3b4

Please sign in to comment.