oliverw / miningcore

Miningcore is a high-performance Mining Pool Software for Linux and Windows.
https://store.miningcore.pro
MIT License
728 stars 669 forks source link

Error in Pgsql #1004

Closed edcomrocha closed 2 years ago

edcomrocha commented 2 years ago

To Reproduce Steps to reproduce the behavior:

  1. Go to 'dotnet Miningcore.dll -c config.json'
  2. Start miningcore normally
  3. Right after I get the error in the database [E] [StatsRecorder] Npgsql.PostgresException (0x80004005): 42703: column "poolid" does not exist

Right after the miner shares a share I get the following message on the screen.

[ShareRecorder] System.InvalidCastException: Cannot write DateTime with Kind=UTC to PostgreSQL type 'timestamp without time zone', consider using 'timestamp with time zone'. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.

And in the pgsql log I get

miningcore@miningcore ERROR: COPY from stdin failed: miningcore@miningcore STATEMENT: COPY shares (poolid, blockheight, difficulty, networkdifficulty, miner, worker, useragent, ipaddress, source, created) FROM STDIN (FORMAT BINARY)

Work in Dell R710

Hello again. I managed to run Miningcore but now I get some errors from pgsql.

I did the process as instructed by README.md. Even so I tried many times, and I can't find the problem again (noob)

there are all tables and columns correctly in the BD, however the same error occurs.

I looked in many places on the internet about the tables and columns, and also about the timestamp, but without success. If you can help, thank you immensely. Sorry but I don't think where I can change this.

Start miningcore normally

Right after I get the error in the database

Thank you Hugs.

riabikov commented 2 years ago

Check the Postgres version is installed. If you installed it on an empty server with the command sudo apt-get install postgresql, then version 10 could be installed. Miningcore requires 11 or higher.

oliverw commented 2 years ago

Technically it should work with older versions of Postgres but it is not recommended due to performance considerations.

riabikov commented 2 years ago

Technically it should work with older versions of Postgres but it is not recommended due to performance considerations.

OK thanks! I ran into the same error, but only now I found out that I installed version 10.

[E] [StatsRecorder] Npgsql.PostgresException (0x80004005): 42703: column "poolid" does not exist

Also, when setting up a server for a multi-pool, I received two errors when executing:

psql -d miningcore -U miningcore -f createdb_postgresql_11_appendix.sql

Errors:

SET
DROP TABLE
CREATE TABLE
psql:createdb_postgresql_11_appendix.sql:19: ERROR:  cannot create index on partitioned table "shares"
psql:createdb_postgresql_11_appendix.sql:20: ERROR:  cannot create index on partitioned table "shares"

Original "shares" table:

CREATE TABLE shares
(
    poolid TEXT NOT NULL,
    blockheight BIGINT NOT NULL,
    difficulty DOUBLE PRECISION NOT NULL,
    networkdifficulty DOUBLE PRECISION NOT NULL,
    miner TEXT NOT NULL,
    worker TEXT NULL,
    useragent TEXT NULL,
    ipaddress TEXT NOT NULL,
        source TEXT NULL,
    created TIMESTAMP NOT NULL
);

CREATE INDEX IDX_SHARES_POOL_MINER on shares(poolid, miner);
CREATE INDEX IDX_SHARES_POOL_CREATED ON shares(poolid, created);
CREATE INDEX IDX_SHARES_POOL_MINER_DIFFICULTY on shares(poolid, miner, difficulty);

Multi-pool "shares" table:

CREATE TABLE shares
(
    poolid TEXT NOT NULL,
    blockheight BIGINT NOT NULL,
    difficulty DOUBLE PRECISION NOT NULL,
    networkdifficulty DOUBLE PRECISION NOT NULL,
    miner TEXT NOT NULL,
    worker TEXT NULL,
    useragent TEXT NULL,
    ipaddress TEXT NOT NULL,
        source TEXT NULL,
    created TIMESTAMP NOT NULL
) PARTITION BY LIST (poolid);

CREATE INDEX IDX_SHARES_CREATED ON SHARES(created);
CREATE INDEX IDX_SHARES_MINER_DIFFICULTY on SHARES(miner, difficulty);
oliverw commented 2 years ago

Yes partitioned tables will only work with Postgres 11 and up. Those provide a major boost to share processing performance. That's why PG 11 is recommended.

riabikov commented 2 years ago

Yes partitioned tables will only work with Postgres 11 and up. Those provide a major boost to share processing performance. That's why PG 11 is recommended.

Then I apologize a thousand times for wasting your time. I didn't have time to reinstall Postgres to check for this error.

oliverw commented 2 years ago

Yes partitioned tables will only work with Postgres 11 and up. Those provide a major boost to share processing performance. That's why PG 11 is recommended.

Then I apologize a thousand times for wasting your time. I didn't have time to reinstall Postgres to check for this error.

No problem.

edcomrocha commented 2 years ago

Verifique se a versão do Postgres está instalada. Se você instalou em um servidor vazio com o comando sudo apt-get install postgresql, a versão 10 pode ser instalada. Miningcore requer 11 ou superior.

Sorry, I forgot to tell you the version of postgres The version used is: psql (PostgreSQL) 12.9 (Ubuntu 12.9-0ubuntu0.20.04.1)

I used the command to install: sudo apt-get install postgresql-12

edcomrocha commented 2 years ago

Tecnicamente, ele deve funcionar com versões mais antigas do Postgres, mas não é recomendado devido a considerações de desempenho.

OK, obrigado! Encontrei o mesmo erro, mas só agora descobri que instalei a versão 10.

[E] [StatsRecorder] Npgsql.PostgresException (0x80004005): 42703: column "poolid" does not exist

Além disso, ao configurar um servidor para um multi-pool, recebi dois erros ao executar:

psql -d miningcore -U miningcore -f createdb_postgresql_11_appendix.sql

Erros:

SET
DROP TABLE
CREATE TABLE
psql:createdb_postgresql_11_appendix.sql:19: ERROR:  cannot create index on partitioned table "shares"
psql:createdb_postgresql_11_appendix.sql:20: ERROR:  cannot create index on partitioned table "shares"

Tabela de "compartilhamentos" original:

CREATE TABLE shares
(
  poolid TEXT NOT NULL,
  blockheight BIGINT NOT NULL,
  difficulty DOUBLE PRECISION NOT NULL,
  networkdifficulty DOUBLE PRECISION NOT NULL,
  miner TEXT NOT NULL,
  worker TEXT NULL,
  useragent TEXT NULL,
  ipaddress TEXT NOT NULL,
        source TEXT NULL,
  created TIMESTAMP NOT NULL
);

CREATE INDEX IDX_SHARES_POOL_MINER on shares(poolid, miner);
CREATE INDEX IDX_SHARES_POOL_CREATED ON shares(poolid, created);
CREATE INDEX IDX_SHARES_POOL_MINER_DIFFICULTY on shares(poolid, miner, difficulty);

Tabela de "compartilhamentos" multi-pool:

CREATE TABLE shares
(
  poolid TEXT NOT NULL,
  blockheight BIGINT NOT NULL,
  difficulty DOUBLE PRECISION NOT NULL,
  networkdifficulty DOUBLE PRECISION NOT NULL,
  miner TEXT NOT NULL,
  worker TEXT NULL,
  useragent TEXT NULL,
  ipaddress TEXT NOT NULL,
        source TEXT NULL,
  created TIMESTAMP NOT NULL
) PARTITION BY LIST (poolid);

CREATE INDEX IDX_SHARES_CREATED ON SHARES(created);
CREATE INDEX IDX_SHARES_MINER_DIFFICULTY on SHARES(miner, difficulty);

I don't get any error when creating the BD. Everything runs normally. I only get error while Miningcore is running.

riabikov commented 2 years ago

I rebuilt miningcore and got the same errors.

Trying to save pool statistics:

[2021-11-23 23:06:42.6579] [E] [StatsRecorder] Npgsql.PostgresException (0x80004005): 42703: column "poolid" does not exist

POSITION: 183
   at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|213_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
   at Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) in /_/Dapper/SqlMapper.Async.cs:line 646
   at Miningcore.Persistence.Postgres.Repositories.StatsRepository.InsertPoolStatsAsync(IDbConnection con, IDbTransaction tx, PoolStats stats) in /home/user/miningcore/src/Miningcore/Persistence/Postgres/Repositories/StatsRepository.cs:line 42
   at Miningcore.Mining.StatsRecorder.<>c__DisplayClass19_2.<<UpdatePoolHashratesAsync>b__3>d.MoveNext() in /home/user/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 172
--- End of stack trace from previous location ---
   at Miningcore.Extensions.ConnectionFactoryExtensions.RunTx(IConnectionFactory factory, Func`3 action, Boolean autoCommit, IsolationLevel isolation) in /home/user/miningcore/src/Miningcore/Extensions/ConnectionFactoryExtensions.cs:line 50
   at Miningcore.Mining.StatsRecorder.UpdatePoolHashratesAsync(CancellationToken ct) in /home/user/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 161
   at Miningcore.Mining.StatsRecorder.UpdateAsync(CancellationToken ct) in /home/user/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 320
  Exception data:
    Severity: ERROR
    SqlState: 42703
    MessageText: column "poolid" does not exist
    Hint: There is a column named "poolid" in table "poolstats", but it cannot be referenced from this part of the query.
    Position: 183
    File: parse_relation.c
    Line: 3589
    Routine: errorMissingColumn Npgsql.PostgresException (0x80004005): 42703: column "poolid" does not exist

POSITION: 183
   at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|213_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
   at Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) in /_/Dapper/SqlMapper.Async.cs:line 646
   at Miningcore.Persistence.Postgres.Repositories.StatsRepository.InsertPoolStatsAsync(IDbConnection con, IDbTransaction tx, PoolStats stats) in /home/user/miningcore/src/Miningcore/Persistence/Postgres/Repositories/StatsRepository.cs:line 42
   at Miningcore.Mining.StatsRecorder.<>c__DisplayClass19_2.<<UpdatePoolHashratesAsync>b__3>d.MoveNext() in /home/user/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 172
--- End of stack trace from previous location ---
   at Miningcore.Extensions.ConnectionFactoryExtensions.RunTx(IConnectionFactory factory, Func`3 action, Boolean autoCommit, IsolationLevel isolation) in /home/user/miningcore/src/Miningcore/Extensions/ConnectionFactoryExtensions.cs:line 50
   at Miningcore.Mining.StatsRecorder.UpdatePoolHashratesAsync(CancellationToken ct) in /home/user/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 161
   at Miningcore.Mining.StatsRecorder.UpdateAsync(CancellationToken ct) in /home/user/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 320
  Exception data:
    Severity: ERROR
    SqlState: 42703
    MessageText: column "poolid" does not exist
    Hint: There is a column named "poolid" in table "poolstats", but it cannot be referenced from this part of the query.
    Position: 183
    File: parse_relation.c
    Line: 3589
    Routine: errorMissingColumn    at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|213_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
   at Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) in /_/Dapper/SqlMapper.Async.cs:line 646
   at Miningcore.Persistence.Postgres.Repositories.StatsRepository.InsertPoolStatsAsync(IDbConnection con, IDbTransaction tx, PoolStats stats) in /home/user/miningcore/src/Miningcore/Persistence/Postgres/Repositories/StatsRepository.cs:line 42
   at Miningcore.Mining.StatsRecorder.<>c__DisplayClass19_2.<<UpdatePoolHashratesAsync>b__3>d.MoveNext() in /home/user/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 172
--- End of stack trace from previous location ---
   at Miningcore.Extensions.ConnectionFactoryExtensions.RunTx(IConnectionFactory factory, Func`3 action, Boolean autoCommit, IsolationLevel isolation) in /home/user/miningcore/src/Miningcore/Extensions/ConnectionFactoryExtensions.cs:line 50
   at Miningcore.Mining.StatsRecorder.UpdatePoolHashratesAsync(CancellationToken ct) in /home/user/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 161
   at Miningcore.Mining.StatsRecorder.UpdateAsync(CancellationToken ct) in /home/user/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 320

Trying to save share:

[2021-11-23 23:03:47.5440] [E] [ShareRecorder] System.InvalidCastException: Cannot write DateTime with Kind=UTC to PostgreSQL type 'timestamp without time zone', consider using 'timestamp with time zone'. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.
   at Npgsql.Internal.TypeHandlers.DateTimeHandlers.TimestampHandler.ValidateAndGetLength(DateTime value, NpgsqlParameter parameter)
   at Npgsql.NpgsqlParameter`1.ValidateAndGetLength()
   at Npgsql.NpgsqlBinaryImporter.Write[T](T value, NpgsqlParameter param, Boolean async, CancellationToken cancellationToken)
   at Miningcore.Persistence.Postgres.Repositories.ShareRepository.BatchInsertAsync(IDbConnection con, IDbTransaction tx, IEnumerable`1 shares) in /home/user/miningcore/src/Miningcore/Persistence/Postgres/Repositories/ShareRepository.cs:line 70
   at Miningcore.Persistence.Postgres.Repositories.ShareRepository.BatchInsertAsync(IDbConnection con, IDbTransaction tx, IEnumerable`1 shares) in /home/user/miningcore/src/Miningcore/Persistence/Postgres/Repositories/ShareRepository.cs:line 73
   at Miningcore.Mining.ShareRecorder.<>c__DisplayClass17_0.<<PersistSharesCoreAsync>b__0>d.MoveNext() in /home/user/miningcore/src/Miningcore/Mining/ShareRecorder.cs:line 98
--- End of stack trace from previous location ---
   at Miningcore.Extensions.ConnectionFactoryExtensions.RunTx(IConnectionFactory factory, Func`3 action, Boolean autoCommit, IsolationLevel isolation) in /home/user/miningcore/src/Miningcore/Extensions/ConnectionFactoryExtensions.cs:line 50
   at Miningcore.Mining.ShareRecorder.PersistSharesCoreAsync(IList`1 shares) in /home/user/miningcore/src/Miningcore/Mining/ShareRecorder.cs:line 94
   at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Func`5 onRetryAsync, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass4_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.CircuitBreaker.AsyncCircuitBreakerPolicy.<>c__DisplayClass8_0`1.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.CircuitBreaker.AsyncCircuitBreakerEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, ICircuitController`1 breakerController)
   at Polly.CircuitBreaker.AsyncCircuitBreakerPolicy.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy innerPolicy)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass4_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackPolicy.<>c__DisplayClass3_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, Func`3 onFallbackAsync, Func`4 fallbackAction, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy innerPolicy)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass4_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackPolicy.<>c__DisplayClass3_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, Func`3 onFallbackAsync, Func`4 fallbackAction, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy innerPolicy)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Miningcore.Mining.ShareRecorder.PersistSharesAsync(IList`1 shares) in /home/user/miningcore/src/Miningcore/Mining/ShareRecorder.cs:line 89
   at Miningcore.Util.ActionUtils.Guard(Func`1 func, Action`1 errorHandler) in /home/user/miningcore/src/Miningcore/Util/ActionUtils.cs:line 12 System.InvalidCastException: Cannot write DateTime with Kind=UTC to PostgreSQL type 'timestamp without time zone', consider using 'timestamp with time zone'. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.
   at Npgsql.Internal.TypeHandlers.DateTimeHandlers.TimestampHandler.ValidateAndGetLength(DateTime value, NpgsqlParameter parameter)
   at Npgsql.NpgsqlParameter`1.ValidateAndGetLength()
   at Npgsql.NpgsqlBinaryImporter.Write[T](T value, NpgsqlParameter param, Boolean async, CancellationToken cancellationToken)
   at Miningcore.Persistence.Postgres.Repositories.ShareRepository.BatchInsertAsync(IDbConnection con, IDbTransaction tx, IEnumerable`1 shares) in /home/user/miningcore/src/Miningcore/Persistence/Postgres/Repositories/ShareRepository.cs:line 70
   at Miningcore.Persistence.Postgres.Repositories.ShareRepository.BatchInsertAsync(IDbConnection con, IDbTransaction tx, IEnumerable`1 shares) in /home/user/miningcore/src/Miningcore/Persistence/Postgres/Repositories/ShareRepository.cs:line 73
   at Miningcore.Mining.ShareRecorder.<>c__DisplayClass17_0.<<PersistSharesCoreAsync>b__0>d.MoveNext() in /home/user/miningcore/src/Miningcore/Mining/ShareRecorder.cs:line 98
--- End of stack trace from previous location ---
   at Miningcore.Extensions.ConnectionFactoryExtensions.RunTx(IConnectionFactory factory, Func`3 action, Boolean autoCommit, IsolationLevel isolation) in /home/user/miningcore/src/Miningcore/Extensions/ConnectionFactoryExtensions.cs:line 50
   at Miningcore.Mining.ShareRecorder.PersistSharesCoreAsync(IList`1 shares) in /home/user/miningcore/src/Miningcore/Mining/ShareRecorder.cs:line 94
   at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Func`5 onRetryAsync, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass4_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.CircuitBreaker.AsyncCircuitBreakerPolicy.<>c__DisplayClass8_0`1.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.CircuitBreaker.AsyncCircuitBreakerEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, ICircuitController`1 breakerController)
   at Polly.CircuitBreaker.AsyncCircuitBreakerPolicy.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy innerPolicy)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass4_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackPolicy.<>c__DisplayClass3_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, Func`3 onFallbackAsync, Func`4 fallbackAction, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy innerPolicy)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass4_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackPolicy.<>c__DisplayClass3_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, Func`3 onFallbackAsync, Func`4 fallbackAction, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy innerPolicy)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Miningcore.Mining.ShareRecorder.PersistSharesAsync(IList`1 shares) in /home/user/miningcore/src/Miningcore/Mining/ShareRecorder.cs:line 89
   at Miningcore.Util.ActionUtils.Guard(Func`1 func, Action`1 errorHandler) in /home/user/miningcore/src/Miningcore/Util/ActionUtils.cs:line 12    at Npgsql.Internal.TypeHandlers.DateTimeHandlers.TimestampHandler.ValidateAndGetLength(DateTime value, NpgsqlParameter parameter)
   at Npgsql.NpgsqlParameter`1.ValidateAndGetLength()
   at Npgsql.NpgsqlBinaryImporter.Write[T](T value, NpgsqlParameter param, Boolean async, CancellationToken cancellationToken)
   at Miningcore.Persistence.Postgres.Repositories.ShareRepository.BatchInsertAsync(IDbConnection con, IDbTransaction tx, IEnumerable`1 shares) in /home/user/miningcore/src/Miningcore/Persistence/Postgres/Repositories/ShareRepository.cs:line 70
   at Miningcore.Persistence.Postgres.Repositories.ShareRepository.BatchInsertAsync(IDbConnection con, IDbTransaction tx, IEnumerable`1 shares) in /home/user/miningcore/src/Miningcore/Persistence/Postgres/Repositories/ShareRepository.cs:line 73
   at Miningcore.Mining.ShareRecorder.<>c__DisplayClass17_0.<<PersistSharesCoreAsync>b__0>d.MoveNext() in /home/user/miningcore/src/Miningcore/Mining/ShareRecorder.cs:line 98
--- End of stack trace from previous location ---
   at Miningcore.Extensions.ConnectionFactoryExtensions.RunTx(IConnectionFactory factory, Func`3 action, Boolean autoCommit, IsolationLevel isolation) in /home/user/miningcore/src/Miningcore/Extensions/ConnectionFactoryExtensions.cs:line 50
   at Miningcore.Mining.ShareRecorder.PersistSharesCoreAsync(IList`1 shares) in /home/user/miningcore/src/Miningcore/Mining/ShareRecorder.cs:line 94
   at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Func`5 onRetryAsync, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass4_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.CircuitBreaker.AsyncCircuitBreakerPolicy.<>c__DisplayClass8_0`1.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.CircuitBreaker.AsyncCircuitBreakerEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, ICircuitController`1 breakerController)
   at Polly.CircuitBreaker.AsyncCircuitBreakerPolicy.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy innerPolicy)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass4_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackPolicy.<>c__DisplayClass3_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, Func`3 onFallbackAsync, Func`4 fallbackAction, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy innerPolicy)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass4_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackPolicy.<>c__DisplayClass3_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Polly.Fallback.AsyncFallbackEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, Func`3 onFallbackAsync, Func`4 fallbackAction, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy innerPolicy)
   at Polly.AsyncPolicy.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Miningcore.Mining.ShareRecorder.PersistSharesAsync(IList`1 shares) in /home/user/miningcore/src/Miningcore/Mining/ShareRecorder.cs:line 89
   at Miningcore.Util.ActionUtils.Guard(Func`1 func, Action`1 errorHandler) in /home/user/miningcore/src/Miningcore/Util/ActionUtils.cs:line 12

I apologize if you didn't need to upload the entire error. I thought it would be easier to figure out where to look for the cause.

UPD: I changed the version of "Npgsql" Version="5.0.7", rebuilt the project, but it did not help.

oliverw commented 2 years ago

Could you try the oliverw branch?

riabikov commented 2 years ago

The error with saving statistics was repeated. Saving the share throws an error like this:

[2021-11-24 00:49:16.7722] [I] [pool1] [0HMDEP9KLP52V] Share accepted: D=0.1 
[2021-11-24 00:49:20.5326] [W] [ShareRecorder] Retry 1 in 00:00:02 due to Npgsql: PostgresException (23514: no partition of relation "shares" found for row

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.) 
[2021-11-24 00:49:20.8029] [I] [pool1] [0HMDEP9KLP52V] Share accepted: D=0.1 
[2021-11-24 00:49:22.5377] [W] [ShareRecorder] Retry 2 in 00:00:04 due to Npgsql: PostgresException (23514: no partition of relation "shares" found for row

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.) 
[2021-11-24 00:49:26.5544] [W] [ShareRecorder] Retry 3 in 00:00:08 due to Npgsql: PostgresException (23514: no partition of relation "shares" found for row

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.) 
[2021-11-24 00:49:34.5776] [W] [ShareRecorder] Fallback due to Npgsql: PostgresException (23514: no partition of relation "shares" found for row

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.) 
[2021-11-24 00:49:34.6152] [W] [ShareRecorder] Retry 1 in 00:00:02 due to Npgsql: PostgresException (23514: no partition of relation "shares" found for row

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.) 
[2021-11-24 00:49:36.6284] [W] [ShareRecorder] Retry 2 in 00:00:04 due to Npgsql: PostgresException (23514: no partition of relation "shares" found for row

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.) 
[2021-11-24 00:49:40.6391] [W] [ShareRecorder] Retry 3 in 00:00:08 due to Npgsql: PostgresException (23514: no partition of relation "shares" found for row

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.) 
[2021-11-24 00:49:48.6488] [W] [ShareRecorder] Fallback due to Npgsql: PostgresException (23514: no partition of relation "shares" found for row

DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.)
oliverw commented 2 years ago

You forgot this step from the README:

CREATE TABLE shares_mypool1 PARTITION OF shares FOR VALUES IN ('mypool1');

'mypool1' is of course supposed to be the id of each of your pools in the pools array of config.json.

riabikov commented 2 years ago

Thank you, I'll try now. I have not forgotten, I thought that for the master of the pool it is not necessary to do this. I was confused by this disagreement:

The following step needs to performed once for every new pool - EVERY NEW
Once you have done this for all of your existing pools - ALL

UPD: The save share has worked successfully. 👍🏻

edcomrocha commented 2 years ago

I installed it again by downloading the recommended branch file.

I redid the BD, the ShareRecorder error ended.

But the poolstats error still persists ERROR: column "poolid" does not exist at character 183 HINT: There is a column named "poolid" in table "poolstats", but it cannot be referenced from this part of the query.

In console Miningcore is: [StatsRecorder] Npgsql.PostgresException (0x80004005): 42703: column "poolid" does not exist POSITION: 183 at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|213_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) at Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) in /_/Dapper/SqlMapper.Async.cs:line 646 at Miningcore.Persistence.Postgres.Repositories.StatsRepository.InsertPoolStatsAsync(IDbConnection con, IDbTransaction tx, PoolStats stats) in /home/edvaldo/miningcore/src/Miningcore/Persistence/Postgres/Repositories/StatsRepository.cs:line 41 at Miningcore.Mining.StatsRecorder.<>c__DisplayClass19_2.<<UpdatePoolHashratesAsync>b__3>d.MoveNext() in /home/edvaldo/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 172 --- End of stack trace from previous location --- at Miningcore.Extensions.ConnectionFactoryExtensions.RunTx(IConnectionFactory factory, Func3 action, Boolean autoCommit, IsolationLevel isolation) in /home/edvaldo/miningcore/src/Miningcore/Extensions/ConnectionFactoryExtensions.cs:line 63 at Miningcore.Mining.StatsRecorder.UpdatePoolHashratesAsync(CancellationToken ct) in /home/edvaldo/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 161 at Miningcore.Mining.StatsRecorder.UpdateAsync(CancellationToken ct) in /home/edvaldo/miningcore/src/Miningcore/Mining/StatsRecorder.cs:line 320 Exception data: Severity: ERROR SqlState: 42703 MessageText: column "poolid" does not exist Hint: There is a column named "poolid" in table "poolstats", but it cannot be referenced from this part of the query. Position: 183 File: parse_relation.c Line: 3349 Routine: errorMissingColumn Npgsql.PostgresException (0x80004005): 42703: column "poolid" does not exist

Sorry for taking your time, and thank you so much for all the work on the project and the help you've given us.

riabikov commented 2 years ago
[E] [StatsRecorder] Npgsql.PostgresException (0x80004005): 42703: column "poolid" does not exist

@oliverw Any idea what the problem is? I am ready to compile your ideas and help solve issue..

oliverw commented 2 years ago

Use the latest oliverw branch. Everything will work again.

edcomrocha commented 2 years ago

Use the latest oliverw branch. Everything will work again.

Hi, ok now.

working ok, no error

Thanks