Comments (11)
If I am understanding the question correctly. This particular case is for the tables when table doesn't have any primary key. So the IsPrimaryKey
is the meta information for the column information stored in tableInfo
. In case there are multiple primary keys, tableInfo will have multiple ColumnInfo
with IsPrimaryKey
set to true
.
from marmot.
I think the error is assuming that IsPrimaryKey: true,
can be converted to a boolean when SELECT name, type, notnull, dflt_value, pk FROM pragma_table_info(?)
returns for pk a integer which can be interpreted as 0 for no pk, 1 for 1 pk (true) or 2+ for the number of primary keys. I did not look at how isPrimary key is used, but I would suspect there's logic that tracks the pk
and if there's multiple pk
one would need to account for that in the design.
from marmot.
I might need a detailed repro or side-effect this is causing. Can you help me do that?
from marmot.
if you have docker compose, you should be able to just build this: https://github.com/disarticulate/marmot/tree/master/example/single-leader
That should pull the latest source. and the sqlite file is there.
from marmot.
I managed to hit this on the first attempt at using marmot. The issue comes up when a table is configured with multiple primary keys or the primary key is not the first column. According to this pragma_table_info's pk value is a index of the column containing the primary key not a boolean. The following schema will cause the error and prevent marmot from starting:
CREATE TABLE "playlist_track" (
"PlaylistId" INTEGER NOT NULL,
"TrackId" INTEGER NOT NULL,
FOREIGN KEY("PlaylistId") REFERENCES "playlists"("PlaylistId") ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY("TrackId") REFERENCES "tracks"("TrackId") ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY("PlaylistId","TrackId")
);
I tested changing the type to an int and doing >0 checks. This seems to be sufficient to workaround the crash but someone who has used this software for more than a few hours should probably have a closer look.
from marmot.
Perfect I will try it locally, and try to get fix out.
from marmot.
I see how SQLite is putting index numbers instead of booleans, and I can reproduce it already. I have got a fix in place that should fix it let me put that up once a beta build once I've tested it locally.
from marmot.
I have a build ready to test these changes out here. @thetooth can you try it and let me know if the changes fix the issue. I tried on my side and it works.
from marmot.
@thetooth did you get a chance to test it on your side? I've been able to get it up and running without any issues.
from marmot.
@maxpert not yet but changes look identical to my local branch, should be ready to go as I've not encountered any problems so far. Will resync onto tagged release next week and let you know if any problems come up.
from marmot.
@thetooth the latest master has the changes now, feel free to use binaries from build or compile yourself and try.
from marmot.
Related Issues (20)
- Download button with correct version for site HOT 1
- Keystone alternative
- How to get first snapshot to work HOT 31
- Sqlite Database is Locked is Coming, and Marmot is Crashing After Continusouly Inserting For Long time. HOT 12
- Need explanation: How does it handle conflicts? How does it merge data? HOT 2
- Perf - 138.3 writes/sec is really slow.... HOT 4
- benthos and marmot seems like a bit of a good marriage HOT 2
- Unable to scan global changes error no such table __marmot___change_log_global HOT 6
- polling doesnt start until a change is detected HOT 3
- Build for mac OSX HOT 6
- Add a simple example. Can be a Marmot admin gui later
- What is the best way to handle schema migrations? HOT 3
- Support for 2 nodes only? HOT 4
- NATS TLS authentication HOT 1
- Consider cgo-free version of sqlite HOT 2
- marmot transforms datetime fields HOT 8
- Crash: "double free or corruption (!prev)" HOT 2
- Use Nats-Expected-Last-Sequence etc. to manage competing updates more deterministically
- Example FAILING to CONNECT ! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marmot.