PostgreSQL Transaction ID went backwards - postgresql

In PostgreSQL 9.0, I have a table that keeps tracks of last processed transactions. For some reason, it went backwards (in time)! Here is the table data:
seq_id | tx_id
628 | 10112
629 | 10118
630 | 10124
631 | 10130
632 | 10136
654 | 10160
655 | 10166 <---
656 | 4070 <---
657 | 4071
658 | 4084
659 | 4090
660 | 4096
How can this happen? Can a restart of the database induce such behavior?
Thanks for any hints.
Regards,
D.

This is an invalid issue. Please ignore.
It turns out that the issue came out of restoring the table from a backup and continue working with (invalid) previous data, in a newly created database :-(
Thanks you for all those who responded already.
Case closed.
Lesson learned: TXID will NOT go backwards and they do get synced to a slave instance if you're using a Master/Slave setup. TXID rollovers are also correctly handled. Hope this will help others who might be thinking TXID can go backwards!

Related

Bootup/Startup Script Not Working for nVidia GPU Clock Offset

Trying to change GPU Graphics and Memory Transfer Rate Clock Offset on my nVidia EVGA 1030 SC on bootup. I am a linux noob here using Rocky Linux 9.
Question:
How do I check my current set values for GPUGraphicsClockOffsetAllPerformanceLevels and GPUMemoryTransferRateOffsetAllPerformanceLevels?
Currently I am checking by starting up nVidia X Server then look for the values in Graphics Clock Offset and Memory Transfer Rate Offset under the PowerMizer tab. Is there a better way? I don't even really know if that is always up to date...
What did I do wrong and what do I need to change to fix my bootup script below to work?
I think my bootup script is NOT working because the PowerMizer in nVidia X Server does NOT show clock offset values of 50MHz and 200MHz for Graphics and Memory Transfer Rates, respectively, when I boot with my script. It only shows 0 and 0.
However, it does show 50MHz and 200MHz when I enter the following 3 commands line after line directly in bash terminal.
nvidia-smi -pm 1
nvidia-settings -a [gpu:0]/"GPUGraphicsClockOffsetAllPerformanceLevels=50"
nvidia-settings -a [gpu:0]/"GPUMemoryTransferRateOffsetAllPerformanceLevels=200"
Below is the bootup script...
i.
Wrote a shell script file named nVidiaStartUp.sh and placed it in: /etc/rc.d/init.d
nVidiaStartUp.sh contains
#!/bin/bash
nvidia-smi -pm 1
nvidia-settings -a [gpu:0]/"GPUGraphicsClockOffsetAllPerformanceLevels=50"
nvidia-settings -a [gpu:0]/"GPUMemoryTransferRateOffsetAllPerformanceLevels=200"
ii.
In Terminal, executed chmod +x /etc/rc.d/init.d/nVidiaStartUp.sh
iii.
Added a script named nVidiaStartUp.service in /etc/systemd/system with contents below
[Unit]
Description=nVidia Startup Script Call with Undervolt
After=getty.target
[Service]
Type=simple
ExecStart=/etc/rc.d/init.d/nVidiaStartUp.sh
TimeoutStartSec=0
#RemainAfterExit=yes
[Install]
WantedBy=default.target
#WantedBy=graphical.target
#WantedBy=multi-user.target
iv.
Ran in terminal
systemctl enable nVidiaStartUp.service
v.
Reboot and then I check my clockoffset under PowerMizer in nVidia X Server. I don't see 50MHz and 200MHz. I only see 0 and 0. That seems to imply my bootup script isn't working? Please help!
======================================================================================================================================================
Additional background info:
I have installed nVidia driver and it loads with proper GPU information. Here is what it shows after running nvidia-smi
Fri Nov 4 11:39:36 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 520.61.05 Driver Version: 520.61.05 CUDA Version: 11.8 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... On | 00000000:0B:00.0 On | N/A |
| 48% 50C P0 N/A / 30W | 373MiB / 2048MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 2309 G /usr/libexec/Xorg 100MiB |
| 0 N/A N/A 2439 G /usr/bin/gnome-shell 139MiB |
| 0 N/A N/A 3270 G ...470561649073451082,131072 130MiB |
+-----------------------------------------------------------------------------+
My relevant sections for Cool-bits (I am using 8 for cool-bits as this card is passively cooled) of my /etc/X11/xorg.conf shows
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "NVIDIA GeForce GT 1030"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Coolbits" "8"
SubSection "Display"
Depth 24
EndSubSection
EndSection

Including date or time in clocktable report

I didn't think this was going to be hard but I couldn't dig up anything on how to make an org-mode clock table report include the date/time of the task. My report is like this:
#+BEGIN: clocktable :scope agenda-with-archives :timestamp "TIMESTAMP" :link nil :maxlevel 3 :tstart "<-1w>" :tend "<now>" :stepskip0 t :fileskip0 t :tcolumns 3 :narrow 110 :hidefiles t
#+CAPTION: Clock summary at [2021-01-20 Wed 10:47]
| | | <110> | | |
| File | Timestamp | Headline | Time | |
|-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
| | ALL | -Total time- | -12:36- | |
|-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
| inbox.org | | -- File time | *1:12* | |
| | | Inbox | 1:12 | |
| | | \_ Chat w/Saranya | | 0:01 |
| | [2021-01-20 Wed 10:45] | \_ Troubleshoot Cylance/3503 issue | | 1:11 |
|-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
| 01-14.org | | -- File time | *1:11* | |
| | | \_ MEETING: Build discussion/working session | | 1:11 |
|-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
| 01-18.org | | -- File time | *1:25* | |
| | | \_ MEETING: MBean registration failures in MAG DEV2 (and MAG QA2) | | 1:25 |
|-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
| 01-19.org | | -- File time | *1:55* | |
| | | \_ MEETING: nTier Bi-Weekly - Check point | | 1:00 |
| | | \_ MEETING: MBE Project Status Update Meeting - Investment and MRO | | 0:39 |
| | | \_ MEETING: Discuss problems encountered when installing package for 3503 | | 0:16 |
|-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
| admin.org | | -- File time | *0:12* | |
| | | Admin | 0:12 | |
| | <2021-01-14 Thu 09:00 ++1w> | \_ Manage timesheet | | 0:07 |
| | <2021-01-13 Wed 09:00 ++1w> | \_ Create Deploy & Environments Meeting Agenda | | 0:05 |
|-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
...
What I'd like is to NOT have the File column and then have some type of timestamp for each task. I've tried various special properties but I can't seem to find anything that consistently gives me a timestamp.
If I have a log entry that has a recurring schedule or an inactive timestamp outside of the property drawer then it's able to pick something up. For example, in the table above the underlying tasks had entries like this:
** WIP Troubleshoot Cylance/3503 issue :MBE:
:PROPERTIES:
:CREATED: <2021-01-20 Wed 10:46>
:END:
:LOGBOOK:
CLOCK: [2021-01-20 Wed 09:35]--[2021-01-20 Wed 10:46] => 1:11
:END:
[2021-01-20 Wed 10:45] - <snip log entry>.
...
** WIP [#B] Create Deploy & Environments Meeting Agenda
SCHEDULED: <2021-01-13 Wed 09:00 ++1w>
:PROPERTIES:
:LAST_REPEAT: [2021-01-06 Wed 09:35]
:EFFORT: 0:15
:END:
:LOGBOOK:
CLOCK: [2021-01-20 Wed 08:42]--[2021-01-20 Wed 08:47] => 0:05
<snip>
CLOCK: [2020-07-14 Tue 16:17]--[2020-07-14 Tue 16:39] => 0:22
:END:
The problem is most of my tasks are either unscheduled and/or don't have timestamps outside of the logbook. I've tried various values for the :timestamp parameter but it doesn't seem to matter.
Can anyone advise how to create a clock table with task times in a column?
Another problem I have is that even with :hidefiles it always shows the File column.
I'm still pretty new at using clock tables in org-mode, but I came across your question when I was searching for something related to org-mode the other day.
Something that might help with displaying timestamps relates to using a setting called :properties("CLOSED"). I read about this from a post by #Fabian. When this setting is used, it adds a column named "CLOSED" that should display the date-time-stamp of when a task was "CLOSED".
Before this works, however, you might need to add the following setting to your .emacs settings file first: (setq org-log-done 'time). I read about this in the org-mode documentation. When this setting is set, and if you are using the "TODO" feature in org-mode: once you set a task to "DONE", a "CLOSED" date-time-stamp should be added to your task. From there, once you refresh your clock table, this new date-time-stamp should appear in the "CLOSED" column.
Also, from playing around with the :hidefiles settings, I ran into the same problem you had where the "File" column kept showing up even with the :hidefiles setting set. My previous attempt at fixing this (in the earlier answer revision) appears to not actually be doing what I thought it was doing, so I took that part out for now. I have the feeling that this :hidefiles setting issue might be related to the version of org-mode that is being used.
Update: After trying a more recent version of org-mode (20210201), the :hidefiles setting appears to be working as expected. I installed the new org-mode version using the setting instructions from this documentation page along with the following steps.
Warning: You may want to use an older version of org-mode depending on your needs. For myself, I tried out a very recent version of org-mode (at the time of this writing), but it might be too new for your purposes. Please consider if you need to try an older version before going through the following steps if you choose to do so.
Add these lines to the .emacs file:
(require 'package)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
Open up a blank emacs editor
Type: M-x list-packages
Navigate to the org option (I picked the 20210201 option, but this might vary) so that the cursor is over the org link
Push the return/enter key
Type: C-x o
Navigate to the Install option so that the cursor is over the Install link
Push the return/enter key
Push y to continue if you want to install this
The package should install at this point
When done, exit out of emacs
Then, open up your .org file
Also: I added the following setting to my .emacs file, because I generally like to hide the various lists in my .org file when it first gets opened in org-mode:
; ref: https://orgmode.org/guide/Visibility-Cycling.html
(setq org-startup-folded t)
Here is an updated example of the settings I used in my example.org file (partly based on your original example):
#+BEGIN: clocktable :scope agenda-with-archives :properties("CLOSED") :maxlevel 3 :tstart "<-2w>" :tend "<now>" :timestamp t :hidefiles t
#+CAPTION: Clock summary at [2021-02-01 Mon 16:30]
| Timestamp | CLOSED | Headline | Time | |
|-----------------------------+------------------------+----------------------------------------------+--------+------|
| | | *Total time* | *1:17* | |
|-----------------------------+------------------------+----------------------------------------------+--------+------|
| | | topic | 1:17 | |
| | [2021-01-29 Fri 18:22] | \_ test | | 0:01 |
| [2021-01-20 Wed 10:45] | [2021-01-29 Fri 18:26] | \_ WIP Troubleshoot Cylance/3503 issue | | 1:11 |
| <2021-02-26 Fri 09:00 ++1w> | | \_ WIP [#B] Create Deploy & Environments... | | 0:05 |
|-----------------------------+------------------------+----------------------------------------------+--------+------|
|-----------------------------+------------------------+----------------------------------------------+--------+------|
#+END:
* topic
** DONE test
CLOSED: [2021-01-29 Fri 18:22]
CLOCK: [2021-01-29 Fri 18:21]--[2021-01-29 Fri 18:22] => 0:00
** DONE WIP Troubleshoot Cylance/3503 issue :MBE:
CLOSED: [2021-01-29 Fri 18:26]
:PROPERTIES:
:CREATED: <2021-01-20 Wed 10:46>
:END:
:LOGBOOK:
CLOCK: [2021-01-20 Wed 09:35]--[2021-01-20 Wed 10:46] => 1:11
:END:
[2021-01-20 Wed 10:45] - <snip log entry>.
** TODO WIP [#B] Create Deploy & Environments Meeting Agenda
SCHEDULED: <2021-02-26 Fri 09:00 ++1w>
- State "DONE" from "TODO" [2021-01-30 Sat 10:56]
:PROPERTIES:
:LAST_REPEAT: [2021-01-30 Sat 10:56]
:EFFORT: 0:15
:END:
:LOGBOOK:
CLOCK: [2021-01-20 Wed 08:42]--[2021-01-20 Wed 08:47] => 0:05
<snip>
CLOCK: [2020-07-14 Tue 16:17]--[2020-07-14 Tue 16:39] => 0:22
:END:
It's up to you if you want to take out the :timestamp t setting if adding the new "CLOSED" column.
A downside, though, with the "CLOSED" column is that I haven't found an approach that allows for scheduled tasks (that have been periodically completed) to also be shown with a date-time-stamp in the "CLOSED" column. It looks like the "SCHEDULED" setting is shown in the "Timestamp" column, but that might not be what you want.
I hope this information helps!

Ember CLI - Babel is too slow on Mac

From last couple of days my ember is slow, here is the output
version: 2.4.2
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
Build successful - 76337ms.
Slowest Trees | Total
----------------------------------------------+---------------------
Babel | 70809ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
Babel (20) | 72361ms (3618 ms)
How can I debug and fix it. I have checked it on Mac(SSD + 16gb Ram)
Edit
After updating npm to latest version, cleaning npm cache, and reinstalling all node packages. It was quite fast but after couple of rebuilds, it became slow again.
Build successful - 56809ms.
Slowest Trees | Total
----------------------------------------------+---------------------
Babel | 55422ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
Babel (20) | 55580ms (2779 ms)
Edit #2
Is there anything to do with which file it changed here are two results
file changed site/components/site/carpets/neworderform-form/template.hbs - 1822 lines in this template
Build successful - 62844ms.
Slowest Trees | Total
----------------------------------------------+---------------------
Babel | 61122ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
Babel (20) | 61280ms (3064 ms)
file changed site/components/site/countries/country-form/template.hbs - 64 lines total in this template
Build successful - 1322ms.
Slowest Trees | Total
----------------------------------------------+---------------------
SourceMapConcat: Concat: App | 424ms
SourceMapConcat: Concat: App Tests | 77ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
SourceMapConcat: Concat: App (1) | 424ms
Babel (20) | 199ms (9 ms)
SourceMapConcat: Concat: App Tests (1) | 77ms
Edit 3 (after 2 days)
Now I guess I really should fix this or else I cant work on it.
Slowest Trees | Total
----------------------------------------------+---------------------
Babel | 146179ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
Babel (20) | 170889ms (8544 ms)

segmentation fault when building postgres GiST index

I'm using postgres 9.4 on Ubuntu 14.04 LTS.
When I execute this query:
create index a_idx on my_table using gist(my_column);
I'm getting error:
erver closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!>
In the logs I can see this:
2016-04-21 11:30:11 BST LOG: server process (PID 7850) was terminated by signal 11: Segmentation fault
I checked if this column has any null values but it doesn't.
How can I debug this?
The structure of my_table is:
Table "public.my_table"
Column | Type | Modifiers | Storage | Stats target | Description
-----------+---------+-----------+----------+--------------+-------------
id | integer | not null | plain | |
my_column | bfp | | extended | |

Why autovacuum process takes so much memory and swap memory?

We have a product log database which only produces insert sql。 But we found that
The autovacuum process took so much memory。 it takes about 16 GB at peak, And it is
happend about every 2 month。The folloing is the detail information, Any one know it?
And the table skytf.urs_user_log_201105 only has insert operation, and have no
update,delete operations, So i think the table has no dead tuples! But why the autovacuum
process takes so much memory on the table?
--top detail
top - 16:39:46 up 225 days, 1:12, 1 user, load average: 1.29, 1.51, 1.52
Tasks: 341 total, 2 running, 339 sleeping, 0 stopped, 0 zombie
Cpu(s): 4.8%us, 5.3%sy, 0.0%ni, 85.5%id, 4.1%wa, 0.0%hi, 0.4%si, 0.0%st
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29267 postgres 14 -1 27.0g 16g 2928 S 1.0 72.2 199:59.74 postgres: autovacuum launcher process
From the above, we can see that the autovacuum process taks about 16 gb;
--current sql
postgres=# select datname, current_query from pg_stat_activity where current_query !='<IDLE>';
datname | current_query
----------+-------------------------------------------------------------------------------------
skytf | autovacuum: VACUUM skytf.urs_user_log_201105 (to prevent wraparound)
--table size
skytf=> \dt+ urs_user_log_201105
List of relations
Schema | Name | Type | Owner | Size | Description
--------+---------------------+-------+--------+-------+-------------
skytf | urs_user_log_201105 | table | skytf | 62 GB |
(1 row)
--memory state
postgres#logdb-> free -m
total used free shared buffers cached
Mem: 24104 24028 75 0 4 5545
-/+ buffers/cache: 18479 5625
Swap: 16386 8824 7561
If you look at this:
autovacuum: VACUUM skytf.urs_user_log_201105 (to prevent wraparound)
this is not a regular autovacuum. it is running to prevent transaction wraparound. this kind of autovacuum must run before transaction id goes beyond two billion. read more at here:
http://www.postgresql.org/docs/8.3/static/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND
you can control the behavior of it with vacuum_freeze_min_age, vacuum_freeze_max_age. you can not disable this kind of autovacuum whether you have disabled autovacuum or not.
only has insert operation, and have no update,delete operations, So i think the table has no dead tuples!
If memory serves, autovacuum will actually do two things:
vacuum
analyze
The first won't kick in if you only ever get inserts. But the second continues to do so when PG thinks the stats might have changed a bit.