Browse Source

filer store: sql update if any insert error happens

fix https://github.com/chrislusf/seaweedfs/issues/1673
pull/1681/head
Chris Lu 4 years ago
parent
commit
38fc89d041
  1. 3
      weed/filer/abstract_sql/abstract_sql_store.go
  2. 5
      weed/filer/abstract_sql/abstract_sql_store_kv.go

3
weed/filer/abstract_sql/abstract_sql_store.go

@ -77,7 +77,8 @@ func (store *AbstractSqlStore) InsertEntry(ctx context.Context, entry *filer.Ent
}
if !strings.Contains(strings.ToLower(err.Error()), "duplicate") {
return fmt.Errorf("kv insert: %s", err)
// return fmt.Errorf("insert: %s", err)
// skip this since the error can be in a different language
}
// now the insert failed possibly due to duplication constraints

5
weed/filer/abstract_sql/abstract_sql_store_kv.go

@ -21,7 +21,8 @@ func (store *AbstractSqlStore) KvPut(ctx context.Context, key []byte, value []by
}
if !strings.Contains(strings.ToLower(err.Error()), "duplicate") {
return fmt.Errorf("kv insert: %s", err)
// return fmt.Errorf("kv insert: %s", err)
// skip this since the error can be in a different language
}
// now the insert failed possibly due to duplication constraints
@ -33,7 +34,7 @@ func (store *AbstractSqlStore) KvPut(ctx context.Context, key []byte, value []by
}
_, err = res.RowsAffected()
if err != nil {
if err != nil {
return fmt.Errorf("kv upsert no rows affected: %s", err)
}
return nil

Loading…
Cancel
Save