v1.27.0-a #10

Closed
jonathanface wants to merge 473 commits from v1.27.0-a into master
3 changed files with 32 additions and 17 deletions
Showing only changes of commit 9ddfe23702 - Show all commits

View File

@ -77,6 +77,10 @@ func (f FIL) MarshalText() (text []byte, err error) {
} }
func (f FIL) UnmarshalText(text []byte) error { func (f FIL) UnmarshalText(text []byte) error {
if f.Int == nil {
return fmt.Errorf("cannot unmarshal into nil BigInt (text:%s)", string(text))
}
p, err := ParseFIL(string(text)) p, err := ParseFIL(string(text))
if err != nil { if err != nil {
return err return err

View File

@ -37,7 +37,7 @@ var configMigrateCmd = &cli.Command{
Aliases: []string{FlagMinerRepoDeprecation}, Aliases: []string{FlagMinerRepoDeprecation},
EnvVars: []string{"LOTUS_MINER_PATH", "LOTUS_STORAGE_PATH"}, EnvVars: []string{"LOTUS_MINER_PATH", "LOTUS_STORAGE_PATH"},
Value: "~/.lotusminer", Value: "~/.lotusminer",
Usage: fmt.Sprintf("Specify miner repo path. flag(%s) and env(LOTUS_STORAGE_PATH) are DEPRECATION, will REMOVE SOON", FlagMinerRepoDeprecation), Usage: "Miner repo path",
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo", Name: "repo",
@ -124,7 +124,7 @@ func fromMiner(cctx *cli.Context) (err error) {
if err != nil { if err != nil {
return fmt.Errorf("could not read config.toml: %w", err) return fmt.Errorf("could not read config.toml: %w", err)
} }
var lpCfg config.LotusProviderConfig lpCfg := config.DefaultLotusProvider()
_, err = deps.LoadConfigWithUpgrades(string(buf), &lpCfg) _, err = deps.LoadConfigWithUpgrades(string(buf), &lpCfg)
if err != nil { if err != nil {
return fmt.Errorf("could not decode toml: %w", err) return fmt.Errorf("could not decode toml: %w", err)
@ -177,12 +177,16 @@ func fromMiner(cctx *cli.Context) (err error) {
} }
lpCfg.Apis.ChainApiInfo = []string{header.Get("Authorization")[7:] + ":" + ainfo.Addr} lpCfg.Apis.ChainApiInfo = []string{header.Get("Authorization")[7:] + ":" + ainfo.Addr}
// Enable WindowPoSt // WindowPoSt message
lpCfg.Subsystems.EnableWindowPost = true msg += "\n!! Before running lotus-provider with Window PoSt enabled, ensure any miner/worker answering of WindowPost is disabled by " +
msg += "\nBefore running lotus-provider, ensure any miner/worker answering of WindowPost is disabled by " +
"(on Miner) " + configColor("DisableBuiltinWindowPoSt=true") + " and (on Workers) not enabling windowpost on CLI or via " + "(on Miner) " + configColor("DisableBuiltinWindowPoSt=true") + " and (on Workers) not enabling windowpost on CLI or via " +
"environment variable " + configColor("LOTUS_WORKER_WINDOWPOST") + "." "environment variable " + configColor("LOTUS_WORKER_WINDOWPOST") + "."
// WinningPoSt message
msg += "\n!! Before running lotus-provider with Winning PoSt enabled, ensure any miner/worker answering of WinningPost is disabled by " +
"(on Miner) " + configColor("DisableBuiltinWinningPoSt=true") + " and (on Workers) not enabling winningpost on CLI or via " +
"environment variable " + configColor("LOTUS_WORKER_WINNINGPOST") + "."
// Express as configTOML // Express as configTOML
configTOML := &bytes.Buffer{} configTOML := &bytes.Buffer{}
if err = toml.NewEncoder(configTOML).Encode(lpCfg); err != nil { if err = toml.NewEncoder(configTOML).Encode(lpCfg); err != nil {

View File

@ -180,7 +180,7 @@ func (dbi *DBIndex) StorageAttach(ctx context.Context, si storiface.StorageInfo,
} }
} }
retryWait := time.Millisecond * 100 retryWait := time.Millisecond * 20
retryAttachStorage: retryAttachStorage:
// Single transaction to attach storage which is not present in the DB // Single transaction to attach storage which is not present in the DB
_, err := dbi.harmonyDB.BeginTransaction(ctx, func(tx *harmonydb.Tx) (commit bool, err error) { _, err := dbi.harmonyDB.BeginTransaction(ctx, func(tx *harmonydb.Tx) (commit bool, err error) {
@ -289,7 +289,7 @@ func (dbi *DBIndex) StorageDetach(ctx context.Context, id storiface.ID, url stri
log.Warnw("Dropping sector path endpoint", "path", id, "url", url) log.Warnw("Dropping sector path endpoint", "path", id, "url", url)
} else { } else {
retryWait := time.Millisecond * 100 retryWait := time.Millisecond * 20
retryDropPath: retryDropPath:
// Single transaction to drop storage path and sector decls which have this as a storage path // Single transaction to drop storage path and sector decls which have this as a storage path
_, err := dbi.harmonyDB.BeginTransaction(ctx, func(tx *harmonydb.Tx) (commit bool, err error) { _, err := dbi.harmonyDB.BeginTransaction(ctx, func(tx *harmonydb.Tx) (commit bool, err error) {
@ -321,15 +321,9 @@ func (dbi *DBIndex) StorageDetach(ctx context.Context, id storiface.ID, url stri
} }
func (dbi *DBIndex) StorageReportHealth(ctx context.Context, id storiface.ID, report storiface.HealthReport) error { func (dbi *DBIndex) StorageReportHealth(ctx context.Context, id storiface.ID, report storiface.HealthReport) error {
retryWait := time.Millisecond * 20
var canSeal, canStore bool retryReportHealth:
err := dbi.harmonyDB.QueryRow(ctx, _, err := dbi.harmonyDB.Exec(ctx,
"SELECT can_seal, can_store FROM storage_path WHERE storage_id=$1", id).Scan(&canSeal, &canStore)
if err != nil {
return xerrors.Errorf("Querying for storage id %s fails with err %v", id, err)
}
_, err = dbi.harmonyDB.Exec(ctx,
"UPDATE storage_path set capacity=$1, available=$2, fs_available=$3, reserved=$4, used=$5, last_heartbeat=NOW()", "UPDATE storage_path set capacity=$1, available=$2, fs_available=$3, reserved=$4, used=$5, last_heartbeat=NOW()",
report.Stat.Capacity, report.Stat.Capacity,
report.Stat.Available, report.Stat.Available,
@ -337,7 +331,20 @@ func (dbi *DBIndex) StorageReportHealth(ctx context.Context, id storiface.ID, re
report.Stat.Reserved, report.Stat.Reserved,
report.Stat.Used) report.Stat.Used)
if err != nil { if err != nil {
return xerrors.Errorf("updating storage health in DB fails with err: %v", err) //return xerrors.Errorf("updating storage health in DB fails with err: %v", err)
if harmonydb.IsErrSerialization(err) {
time.Sleep(retryWait)
retryWait *= 2
goto retryReportHealth
}
return err
}
var canSeal, canStore bool
err = dbi.harmonyDB.QueryRow(ctx,
"SELECT can_seal, can_store FROM storage_path WHERE storage_id=$1", id).Scan(&canSeal, &canStore)
if err != nil {
return xerrors.Errorf("Querying for storage id %s fails with err %v", id, err)
} }
if report.Stat.Capacity > 0 { if report.Stat.Capacity > 0 {