[isf-wifidog] Incoming/outgoing wrap-around in database

Mina Naguib webmaster at topfx.com
Dim 20 Fév 18:56:30 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


I think the column types in the database need to be changed for input
and output.

Currently they're int4, but since they're signed that means the maximum
value they will hold is exceeded after ~ 2.1 Gigs of transfer.

Several records in the database have looped-around and now show negative
values (select * from connections where incoming < 0 or outgoing < 0)

The data type in wifidog is "unsigned long long int" which will
typically occupy 8 bytes of memory and hold the range of 0 to 2^64 (a
ridiculously large number)

The DB field needs to be expanded to match that if at all possible.  As
far as I can tell, the integer types in postgresql are all signed, which
means the biggest of them (bigint/int8) will hold the range -(2^63) to
2^63.  That is basically half the maximum wifidog could possibly report.

If anyone knows PostgreSQL better maybe they can recommend a field type
that will gracefully handle the 0 - 2^64 range, otherwise we might have
to settle for a signed int8.  That's still plenty (maxes out at 16
exabytes) and there's a good chance we will never, ever see it
wrap-around unless our software is still in use several millennia from
now :)


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCGSOueS99pGMif6wRAlGSAKDvPIoHN6fXlgynss0pDi6C4ap2hwCgtsmV
+K7N+sxZGrXB8p24iXXXqTw=
=vCvq
-----END PGP SIGNATURE-----


Plus d'informations sur la liste de diffusion WiFiDog