[OJS-3.4.0-4] Statistic problem

OJS-3.4.0-4
PHP-8.1

I’ve checked the error logs and usage folders but couldn’t find anything. Please suggest a spade to solve the journal’s statistical problem.

Same type statistics graphs are showing in the Issue and journal .

We have upgraded OJS-3.3.0-14 to OJS-3.4.0-4 on 01 December 2023.


1

Hi @asmecher @NateWr @bozana can you help me to solve the statistics problem?
I have seen several times that UsageStats jobs fail. I don’t know how to handle this error.

Illuminate\Queue\MaxAttemptsExceededException: APP\jobs\statistics\CompileUsageStatsFromTemporaryRecords has been attempted too many times or run too long. The job may have previously timed out. in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:746
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(505): Illuminate\Queue\Worker->maxAttemptsExceededException()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(415): Illuminate\Queue\Worker->markJobAsFailedIfAlreadyExceedsMaxAttempts()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(375): Illuminate\Queue\Worker->process()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(326): Illuminate\Queue\Worker->runJob()
#4 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(104): Illuminate\Queue\Worker->runNextJob()
#5 /ojs/lib/pkp/classes/queue/JobRunner.php(220): PKP\core\PKPQueueProvider->runJobInQueue()
#6 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(128): PKP\queue\JobRunner->processJobs()
#7 [internal function]: PKP\core\PKPQueueProvider->PKP\core\{closure}()
#8 {main}

#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(505): Illuminate\Queue\Worker->maxAttemptsExceededException()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(415): Illuminate\Queue\Worker->markJobAsFailedIfAlreadyExceedsMaxAttempts()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(375): Illuminate\Queue\Worker->process()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(326): Illuminate\Queue\Worker->runJob()
#4 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(104): Illuminate\Queue\Worker->runNextJob()
#5 /ojs/lib/pkp/classes/queue/JobRunner.php(220): PKP\core\PKPQueueProvider->runJobInQueue()
#6 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(128): PKP\queue\JobRunner->processJobs()
#7 [internal function]: PKP\core\PKPQueueProvider->PKP\core\{closure}()
#8 {main}
{
    "uuid": "98c1c005-ce6a-4062-aab7-0d9574bba4c4",
    "displayName": "APP\\jobs\\statistics\\CompileUsageStatsFromTemporaryRecords",
    "job": "Illuminate\\Queue\\CallQueuedHandler@call",
    "maxTries": 1,
    "maxExceptions": 3,
    "failOnTimeout": true,
    "backoff": "5",
    "timeout": 60,
    "retryUntil": null,
    "data": {
        "commandName": "APP\\jobs\\statistics\\CompileUsageStatsFromTemporaryRecords",
        "command": "O:57:\"APP\\jobs\\statistics\\CompileUsageStatsFromTemporaryRecords\":3:{s:9:\"\u0000*\u0000loadId\";s:25:\"usage_events_20240113.log\";s:10:\"connection\";s:8:\"database\";s:5:\"queue\";s:5:\"queue\";}"
    }
}
{
    "message": "APP\\jobs\\statistics\\CompileUsageStatsFromTemporaryRecords has been attempted too many times or run too long. The job may have previously timed out.",
    "code": 0,
    "file": "\/ojs\/lib\/pkp\/lib\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php",
    "line": 746,
    "trace": [
        {
            "file": "\/ojs\/lib\/pkp\/lib\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php",
            "line": 505,
            "function": "maxAttemptsExceededException",
            "class": "Illuminate\\Queue\\Worker",
            "type": "->"
        },
        {
            "file": "\/ojs\/lib\/pkp\/lib\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php",
            "line": 415,
            "function": "markJobAsFailedIfAlreadyExceedsMaxAttempts",
            "class": "Illuminate\\Queue\\Worker",
            "type": "->"
        },
        {
            "file": "\/ojs\/lib\/pkp\/lib\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php",
            "line": 375,
            "function": "process",
            "class": "Illuminate\\Queue\\Worker",
            "type": "->"
        },
        {
            "file": "\/ojs\/lib\/pkp\/lib\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php",
            "line": 326,
            "function": "runJob",
            "class": "Illuminate\\Queue\\Worker",
            "type": "->"
        },
        {
            "file": "\/EPUB\/ojs\/lib\/pkp\/classes\/core\/PKPQueueProvider.php",
            "line": 104,
            "function": "runNextJob",
            "class": "Illuminate\\Queue\\Worker",
            "type": "->"
        },
        {
            "file": "\/EPUB\/ojs\/lib\/pkp\/classes\/queue\/JobRunner.php",
            "line": 220,
            "function": "runJobInQueue",
            "class": "PKP\\core\\PKPQueueProvider",
            "type": "->"
        },
        {
            "file": "\/ojs\/lib\/pkp\/classes\/core\/PKPQueueProvider.php",
            "line": 128,
            "function": "processJobs",
            "class": "PKP\\queue\\JobRunner",
            "type": "->"
        },
        {
            "function": "PKP\\core\\{closure}",
            "class": "PKP\\core\\PKPQueueProvider",
            "type": "->"
        }
    ]
}

Hi @shantanusingh,

Could you explain a little bin in more detail and provide more information:

  • the upgrade was successful, after the upgrade the usage stats were correct?
  • what is the exact problem, maybe with the example? It seems that some days have no numbers after the upgrade? It seems the usage stats graph on the article view page is not working correctly – it is not showing the earlier numbers?
  • the listings above are what you see when you click on ‘Details’ in the table ‘Filed Jobs’?

How is your PHP setting for the max execution time?
Do you use the built-in job runner (default), a worker daemon or cron job?
How big is your installation, e.g. how many articles do you have?

It seems the log file usage_events_20240113.log could not be processed, for example. Where is this file now, in the folder /usageStats/archive/? How big is the file? Are the usageStats folders processing/, stage/ and reject/ empty? Is only the current (or the log file from yesterday) in the usageStats folder usageEventLogs/?

Because I do not see any other error I think it could maybe be a timeout problem, but this I will need to double check with my colleague once I have all the information…

Thanks,
Bozana

Hi @bozana Thanks for your reply.

  • The upgrade was successful and the usage statistics are correct after the upgrade.
  • The problem is that the Usase status is not working properly, it takes 3-4 days to update the usage record. We upgraded on 01 December 2023 and below the mentioned image you can see the statistics of articles. You can see the above image of the UsasgeState failed task, this has happened several times.
  • On clicking Details of Failed Job above mentioned error "message": "APP\\jobs\\statistics\\CompileUsageStatsFromTemporaryRecords has been attempted too many times or run too long. The job may have previously timed out.", "code": 0,.

Max PHP execution time is 600.
I am running a MySQL database backup cron job once a night at a fixed time at night. There are no other cron tasks scheduled. MySQL database size is 20GB and 53-56 journals and around 147474 submissions.

usage_events_20240113.log file is now in /usageStats/archive/ folder and the file size is 40MB-60MB.
usageStats folders processing/, stage/ is empty but reject/ folder is not empty, it holds 3 files dated: usage_events_20231130.log, usage_events_20231201.log, usage_events_20240114.log
Yes in usageStats folder usageEventLogs/holds the correct date file.

Hi @shantanusingh,

Your installation seems to be huge, so I assume that your Jobs (or at least some of them) will not finish during a request – which is the default option for job executions.
Thus, generally I would suggest that you use a Cron job or Worker for Jobs (s. this documentation for that https://docs.pkp.sfu.ca/admin-guide/en/deploy-jobs).
But, maybe to double check a few more things first:

  • Do you see any other job (than CompileUsageStatsFromTemporaryRecords) in that list of failed jobs?
  • Could you double check if there are entries in your DB tables usage_stats_total_temporary_records, usage_stats_unique_item_investigations_temporary_records, and usage_stats_unique_item_requests_temporary_records? – there could be some entries from the log files that haven’t been successfully processed.

Thanks,
Bozana

Hi @bozana Yes, it is a huge database that we are handling.

  • As per your suggestion, I have checked and did not find any failing functions other than CompileUsageStatsFromTemporaryRecords and it is the same as the previous error.

Below is the question which is taking a lot of time (screenshot attached)
DELETE FROM ust USING usage_stats_total_temporary_records ust INNER JOIN usage_stats

Can you guide me in setting up cron job for this or fix the problem?
I’ve tried running the commands as suggested in https://docs.pkp.sfu.ca/admin-guide/en/deploy-jobs but I’m not getting anything.


Hi @shantanusingh,

Oh, for real huge amount of data… (you are collecting also the Geo data on the city level…)… So yes, the stats processing could take time…

You can use these commands to redispatch the failed jobs and then run them again from the CLI:

php lib/pkp/tools/jobs.php failed --redispatch
php lib/pkp/tools/jobs.php run

Please let me then know what happened…

Thanks,
Bozana

OK, I’ve set up the Geographical Statistics data, Collect the visitor's country.

What if we select Do not collect any geographical data for Geographic Statistics?
What happens if we select Only track monthly statistics for Monthly or Daily Statistics?

I have run the suggested command and the result is below.

As I can see the previous SQL command is still using DELETE FROM ust USING usage_stats_total_temporary_records ust INNER JOIN usage_stats. This operation has caused --redispatch to fail.

SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction (SQL: \n                DELETE FROM ust USING usage_stats_total_temporary_records ust\n                INNER JOIN usage_stats_total_temporary_records ustt ON (ustt.load_id = ust.load_id AND ustt.ip = ust.ip AND ustt.user_agent = ust.user_agent AND ustt.canonical_url = ust.canonical_url)\n                WHERE TIMESTAMPDIFF(SECOND, ust.date, ustt.date) < 30 AND TIMESTAMPDIFF(SECOND, ust.date, ustt.date) > 0 AND ust.line_number < ustt.line_number\n                )",
    "code": "HY000",

Hi @shantanusingh,

Ah, one more thing that I have forgotten: Set job_runner = Off in your config.inc.php while you are testing this CLI commands. Do not forget to return it to On when you have finished.

You probably had those options earlier, so nothing changed with upgrade to 3.4.

Regarding Geo statistics:
If you select that option “Do not collect any geographical data” you will collect no usage statistics for geographical locations, and thus you will have to Geo data stats – you will not see from which Geo location your articles are accessed. So maybe to rethink if you need the Geo stats, or at least do you need to know them on the City level (from which cities the articles are accessed) of would just country level (from which countries the articles are accessed) be enough.

Regarding daily and monthly statistics:
This is relevant for COUNTER and Geo data statistics. Daily usage statistics are aggregated for each month – there are daily and monthly metrics tables. So the daily metrics are actually not needed – they are not used for reports. Thus, if you not necessarily think you need the daily usage, you could select that option – this would make your database (the daily metrics tables) smaller (and some processing would surely be easier). I would recommend to only keep the monthly metrics.
But, please wait with everything till we fixed the current problem and reprocessed your log files for which the stats are missing!

Hi @bozana

After setting job_runner=off and running the suggested job command it gets executed but after some time it gets stuck on this SQL query (DELETE FROM ust USING usage_stats_total_temporary_records ust INNER JOIN usage_stats). After the query (DELETE FROM ust USING usage_stats_total_temporary_records ust INNER JOIN usage_stats) got stuck for some time, I checked the DB and there is no change happening in the DB.

And the error message is SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction (SQL: delete from usage_stats_total_temporary_recordswhereload_id = usage_events_20240116.log).

[2024-01-18 04:28:18] http://localhost/ojs3404
[2024-01-18 04:28:18] [Notice] Task process started.
[2024-01-18 04:38:19] [Error] SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction (SQL: delete from `usage_stats_total_temporary_records` where `load_id` = usage_events_20240116.log)
[2024-01-18 04:48:20] [Error] SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction (SQL: delete from `usage_stats_total_temporary_records` where `load_id` = usage_events_20240117.log)
[2024-01-18 04:48:20] [Notice] Task process stopped.

Taking to much time to execute

Hi @shantanusingh,

OK, I think I/we need to improve that query – I will try to add an index.
Also, those temporary usage stats DB tables grew because of daily jobs constantly failing and thus not being able to remove the entries from those temporary tables after successful completion.
Let me then first try to improve the query.
You can already delete those failed jobs and empty the temporary usage stats tables:
usage_stats_institution_temporary_records
usage_stats_total_temporary_records
usage_stats_unique_item_investigations_temporary_records
usage_stats_unique_item_requests_temporary_records.
So we can maybe hope that next jobs could eventually execute successfully.
And once the fix is there, you will need to re-process your log files, for which the jobs failed, for which the statistics are missing.

Thanks!
Bozana

Hi @bozana

Ok, I will try your suggestion on localhost and update you.

Can you give me some idea, how to re-process log files, for which the jobs failed?

Hi @shantanusingh

I will tell you step by step what to do to re-process log files. But please wait till I improve that query that makes most of the problems… First then it makes sense to re-process them – in order not to fail again…

Ok, I will wait for your response.

Hi @bozana can you see the errors?

[22-Jan-2024 13:53:44 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(100): Illuminate\Database\Connectors\Connector->createPdoConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(50): Illuminate\Database\Connectors\Connector->tryAgainIfCausedByLostConnection()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect()
#5 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#6 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1181): call_user_func()
#7 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1217): Illuminate\Database\Connection->getPdo()
#8 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(486): Illuminate\Database\Connection->getReadPdo()
#9 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\Database\Connection->getPdoForSelect()
#10 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\Database\Connection->Illuminate\Database\{closure}()
#11 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#12 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#13 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#14 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(422): Illuminate\Database\Connection->run()
#15 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2706): Illuminate\Database\Connection->select()
#16 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\Database\Query\Builder->runSelect()
#17 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#18 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2695): Illuminate\Database\Query\Builder->onceWithColumns()
#19 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3157): Illuminate\Database\Query\Builder->get()
#20 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3085): Illuminate\Database\Query\Builder->aggregate()
#21 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1869): Illuminate\Database\Query\Builder->count()
#22 /ojs/lib/pkp/classes/queue/JobRunner.php(203): Illuminate\Database\Eloquent\Builder->__call()
#23 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(128): PKP\queue\JobRunner->processJobs()
#24 [internal function]: PKP\core\PKPQueueProvider->PKP\core\{closure}()
#25 {main}

Next Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] Connection refused (SQL: select count(*) as aggregate from `jobs` where `reserved_at` is null and `available_at` <= 1705931624 and `queue` is not null and `queue` != queuedTestJob and `attempts` < 3) in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(422): Illuminate\Database\Connection->run()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2706): Illuminate\Database\Connection->select()
#5 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\Database\Query\Builder->runSelect()
#6 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2695): Illuminate\Database\Query\Builder->onceWithColumns()
#8 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3157): Illuminate\Database\Query\Builder->get()
#9 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3085): Illuminate\Database\Query\Builder->aggregate()
#10 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1869): Illuminate\Database\Query\Builder->count()
#11 /ojs/lib/pkp/classes/queue/JobRunner.php(203): Illuminate\Database\Eloquent\Builder->__call()
#12 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(128): PKP\queue\JobRunner->processJobs()
#13 [internal function]: PKP\core\PKPQueueProvider->PKP\core\{closure}()
#14 {main}
  thrown in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 760
[22-Jan-2024 13:53:44 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(100): Illuminate\Database\Connectors\Connector->createPdoConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(50): Illuminate\Database\Connectors\Connector->tryAgainIfCausedByLostConnection()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect()
#5 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#6 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1181): call_user_func()
#7 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1217): Illuminate\Database\Connection->getPdo()
#8 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(486): Illuminate\Database\Connection->getReadPdo()
#9 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\Database\Connection->getPdoForSelect()
#10 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\Database\Connection->Illuminate\Database\{closure}()
#11 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#12 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#13 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#14 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(422): Illuminate\Database\Connection->run()
#15 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2706): Illuminate\Database\Connection->select()
#16 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\Database\Query\Builder->runSelect()
#17 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#18 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2695): Illuminate\Database\Query\Builder->onceWithColumns()
#19 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3157): Illuminate\Database\Query\Builder->get()
#20 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3085): Illuminate\Database\Query\Builder->aggregate()
#21 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1869): Illuminate\Database\Query\Builder->count()
#22 /ojs/lib/pkp/classes/queue/JobRunner.php(203): Illuminate\Database\Eloquent\Builder->__call()
#23 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(128): PKP\queue\JobRunner->processJobs()
#24 [internal function]: PKP\core\PKPQueueProvider->PKP\core\{closure}()
#25 {main}

Next Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] Connection refused (SQL: select count(*) as aggregate from `jobs` where `reserved_at` is null and `available_at` <= 1705931624 and `queue` is not null and `queue` != queuedTestJob and `attempts` < 3) in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(422): Illuminate\Database\Connection->run()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2706): Illuminate\Database\Connection->select()
#5 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\Database\Query\Builder->runSelect()
#6 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2695): Illuminate\Database\Query\Builder->onceWithColumns()
#8 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3157): Illuminate\Database\Query\Builder->get()
#9 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3085): Illuminate\Database\Query\Builder->aggregate()
#10 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1869): Illuminate\Database\Query\Builder->count()
#11 /ojs/lib/pkp/classes/queue/JobRunner.php(203): Illuminate\Database\Eloquent\Builder->__call()
#12 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(128): PKP\queue\JobRunner->processJobs()
#13 [internal function]: PKP\core\PKPQueueProvider->PKP\core\{closure}()
#14 {main}
  thrown in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 760
[22-Jan-2024 13:53:44 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(100): Illuminate\Database\Connectors\Connector->createPdoConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(50): Illuminate\Database\Connectors\Connector->tryAgainIfCausedByLostConnection()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect()
#5 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#6 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1181): call_user_func()
#7 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1217): Illuminate\Database\Connection->getPdo()
#8 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(486): Illuminate\Database\Connection->getReadPdo()
#9 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\Database\Connection->getPdoForSelect()
#10 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\Database\Connection->Illuminate\Database\{closure}()
#11 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#12 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#13 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#14 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(422): Illuminate\Database\Connection->run()
#15 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2706): Illuminate\Database\Connection->select()
#16 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\Database\Query\Builder->runSelect()
#17 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#18 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2695): Illuminate\Database\Query\Builder->onceWithColumns()
#19 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3157): Illuminate\Database\Query\Builder->get()
#20 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3085): Illuminate\Database\Query\Builder->aggregate()
#21 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1869): Illuminate\Database\Query\Builder->count()
#22 /ojs/lib/pkp/classes/queue/JobRunner.php(203): Illuminate\Database\Eloquent\Builder->__call()
#23 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(128): PKP\queue\JobRunner->processJobs()
#24 [internal function]: PKP\core\PKPQueueProvider->PKP\core\{closure}()
#25 {main}

Next Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] Connection refused (SQL: select count(*) as aggregate from `jobs` where `reserved_at` is null and `available_at` <= 1705931624 and `queue` is not null and `queue` != queuedTestJob and `attempts` < 3) in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(422): Illuminate\Database\Connection->run()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2706): Illuminate\Database\Connection->select()
#5 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\Database\Query\Builder->runSelect()
#6 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2695): Illuminate\Database\Query\Builder->onceWithColumns()
#8 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3157): Illuminate\Database\Query\Builder->get()
#9 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3085): Illuminate\Database\Query\Builder->aggregate()
#10 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1869): Illuminate\Database\Query\Builder->count()
#11 /ojs/lib/pkp/classes/queue/JobRunner.php(203): Illuminate\Database\Eloquent\Builder->__call()
#12 /ojs/lib/pkp/classes/core/PKPQueueProvider.php(128): PKP\queue\JobRunner->processJobs()
#13 [internal function]: PKP\core\PKPQueueProvider->PKP\core\{closure}()
#14 {main}
  thrown in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 760
[22-Jan-2024 13:53:44 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(100): Illuminate\Database\Connectors\Connector->createPdoConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(50): Illuminate\Database\Connectors\Connector->tryAgainIfCausedByLostConnection()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect()
#5 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#6 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1181): call_user_func()
#7 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(566): Illuminate\Database\Connection->getPdo()
#8 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\Database\Connection->Illuminate\Database\{closure}()
#9 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#10 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#11 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#12 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(577): Illuminate\Database\Connection->run()
#13 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(469): Illuminate\Database\Connection->affectingStatement()
#14 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(338): Illuminate\Database\DatabaseManager->__call()
#15 /ojs/lib/pkp/classes/db/DAO.php(170): Illuminate\Support\Facades\Facade::__callStatic()
#16 /ojs/lib/pkp/classes/session/SessionDAO.php(117): PKP\db\DAO->update()
#17 /ojs/lib/pkp/classes/session/SessionManager.php(137): PKP\session\SessionDAO->updateObject()
#18 [internal function]: PKP\session\SessionManager->write()
#19 {main}

Next Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] Connection refused (SQL: UPDATE sessions
				SET
					user_id = ?,
					ip_address = 00.000.000.00,
					user_agent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.0 Safari/537.36,
					created = 1705931351,
					last_used = 1705931526,
					remember = 0,
					data = ,
					domain = ebook.icar.gov.in
				WHERE session_id = cl7bvprk516n5h1q84sm7r3e8l) in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(577): Illuminate\Database\Connection->run()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(469): Illuminate\Database\Connection->affectingStatement()
#5 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(338): Illuminate\Database\DatabaseManager->__call()
#6 /ojs/lib/pkp/classes/db/DAO.php(170): Illuminate\Support\Facades\Facade::__callStatic()
#7 /ojs/lib/pkp/classes/session/SessionDAO.php(117): PKP\db\DAO->update()
#8 /ojs/lib/pkp/classes/session/SessionManager.php(137): PKP\session\SessionDAO->updateObject()
#9 [internal function]: PKP\session\SessionManager->write()
#10 {main}
  thrown in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 760
[22-Jan-2024 13:53:44 UTC] PHP Warning:  Unknown: Cannot call session save handler in a recursive manner in Unknown on line 0
[22-Jan-2024 13:53:44 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(100): Illuminate\Database\Connectors\Connector->createPdoConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(50): Illuminate\Database\Connectors\Connector->tryAgainIfCausedByLostConnection()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect()
#5 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#6 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1181): call_user_func()
#7 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(566): Illuminate\Database\Connection->getPdo()
#8 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\Database\Connection->Illuminate\Database\{closure}()
#9 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#10 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#11 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#12 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(577): Illuminate\Database\Connection->run()
#13 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(469): Illuminate\Database\Connection->affectingStatement()
#14 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(338): Illuminate\Database\DatabaseManager->__call()
#15 /ojs/lib/pkp/classes/db/DAO.php(170): Illuminate\Support\Facades\Facade::__callStatic()
#16 /ojs/lib/pkp/classes/session/SessionDAO.php(117): PKP\db\DAO->update()
#17 /ojs/lib/pkp/classes/session/SessionManager.php(137): PKP\session\SessionDAO->updateObject()
#18 [internal function]: PKP\session\SessionManager->write()
#19 {main}

Next Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] Connection refused (SQL: UPDATE sessions
				SET
					user_id = ?,
					ip_address = 00.000.000.00,
					user_agent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.0 Safari/537.36,
					created = 1705931351,
					last_used = 1705931486,
					remember = 0,
					data = ,
					domain = ebook.icar.gov.in
				WHERE session_id = cl7bvprk516n5h1q84sm7r3e8l) in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
Stack trace:
#0 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(899): Illuminate\Database\Connection->runQueryCallback()
#1 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(879): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection()
#2 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(723): Illuminate\Database\Connection->handleQueryException()
#3 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(577): Illuminate\Database\Connection->run()
#4 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(469): Illuminate\Database\Connection->affectingStatement()
#5 /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(338): Illuminate\Database\DatabaseManager->__call()
#6 /ojs/lib/pkp/classes/db/DAO.php(170): Illuminate\Support\Facades\Facade::__callStatic()
#7 /ojs/lib/pkp/classes/session/SessionDAO.php(117): PKP\db\DAO->update()
#8 /ojs/lib/pkp/classes/session/SessionManager.php(137): PKP\session\SessionDAO->updateObject()
#9 [internal function]: PKP\session\SessionManager->write()
#10 {main}
  thrown in /ojs/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 760
````|

@touhidur, do you maybe know what these last error messages, in the last post here, mean?

Hi @shantanusingh,

The fix is merged.

Before proceeding with the instructions here, please clear the failed statistics jobs again, and clear the usage stats temporary tables:

DELETE FROM `usage_stats_institution_temporary_records`
DELETE FROM `usage_stats_total_temporary_records`  
DELETE FROM `usage_stats_unique_item_investigations_temporary_records` 
DELETE FROM `usage_stats_unique_item_requests_temporary_records`

Do did you install the 3.4. version, using Git or .tar.gz package?

If you are using Git, you would only need to get the latest branch stable-3_4_0.
If you used release package, then you will need to apply the patches. To do so:

  1. go to your OJS folder and then to lib/pkp/ (cd lib/pkp)
  2. from OJS/lib/pkp/ run the following:
    wget -q -O - https://github.com/pkp/pkp-lib/commit/9f2123ed4ff41440856a829f2e01c06e154ef20a.diff | patch -p1
  3. go to the OJS folder (cd ../..)
  4. from OJS folder run the following:
    wget -q -O - https://github.com/pkp/ojs/commit/f8e4002e8d0ed9de475531f8728a3406701364a5.diff | patch -p1

Eventually you can experience some conflicts, because the code that you have is not 100% the same with the stable-3_4_0 branch on which the fix was done. In that case you would need to resolve the conflicts. Let me know if this happen i.e. if I can help somehow.
Here you can see which classes were changed and what changes you would then need to have:
for lib/pkp/: pkp/pkp-lib#9627 Add indexes to usage stats temporary tables, conside… · pkp/pkp-lib@9f2123e · GitHub
for ojs: pkp/pkp-lib#9627 Add indexes to usage stats temporary tables, decreas… · pkp/ojs@f8e4002 · GitHub
This might help you solve the conflicts, double check the code, to have the code correct.

Once the patch is successfully executed (and there are no conflicts) you will need to run an upgrade script, that will change you DB tables:

  1. go to your OJS folder
  2. run/call:
    php lib/pkp/tools/migration.php "PKP\migration\upgrade\v3_4_0\I9627_AddUsageStatsTemporaryTablesIndexes" up

After this there should be a new combined index (load_id, context_id, ip) in the usage stats temporary tables:

usage_stats_total_temporary_records, 
usage_stats_unique_item_investigations_temporary_records,
usage_stats_unique_item_requests_temporary_records

Also the ip column should be varchar(64).

Is this all so, is everything right till now?

Hi @bozana we are using .tar.gz package.

I am not very friendly with GitHub and I want to test on a local system like wamp-server, can we use pkp/pkp-lib#9627 Add indexes to usage stats temporary tables, conside… · pkp/pkp-lib@9f2123e · GitHub and pkp/pkp-lib#9627 Add indexes to usage stats temporary tables, decreas… · pkp/ojs@f8e4002 · GitHub for patching manually?

After that, we run the php lib/pkp/tools/migration.php "PKP\migration\upgrade\v3_4_0\I9627_AddUsageStatsTemporaryTablesIndexes"

Yes @shantanusingh, you would then need to do the steps:

  1. go to your OJS folder and then to lib/pkp/ (cd lib/pkp)
  2. from OJS/lib/pkp/ run the following:
    wget -q -O - https://github.com/pkp/pkp-lib/commit/9f2123ed4ff41440856a829f2e01c06e154ef20a.diff | patch -p1
  3. go to the OJS folder (cd ../..)
  4. from OJS folder run the following:
    wget -q -O - https://github.com/pkp/ojs/commit/f8e4002e8d0ed9de475531f8728a3406701364a5.diff | patch -p1

and after that run from OJS folder:
php lib/pkp/tools/migration.php "PKP\migration\upgrade\v3_4_0\I9627_AddUsageStatsTemporaryTablesIndexes" up

EDIT:
Those are commands for linux, but there must be something similar for Windows, to apply the pathes:
https://github.com/pkp/pkp-lib/commit/9f2123ed4ff41440856a829f2e01c06e154ef20a.diff
and
https://github.com/pkp/ojs/commit/f8e4002e8d0ed9de475531f8728a3406701364a5.diff