Skip to content

Instantly share code, notes, and snippets.

Seb braoru

Block or report user

Report or block braoru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Keycloak_CockroachDB.md

We want to use CockroachDB instead of Postgres as database for Keycloak. CockroachDB is a distributed and lockless database.

Thus there is conceptually some differences with Postgres.

In case of concurrent transaction, it may happens that one of the transaction is aborted, the application is in charge of retry the transaction. The way to do it with cockroach is described in https://www.cockroachlabs.com/docs/stable/transactions.html#client-side-transaction-retries.

In summary, we have to create a SAVEPOINT just after the BEGIN transaction. Once all the statements are executed, release the SAVEPOINT.If the is a transaction fails due to concurrent Tx, we rollback to the savepoint and reexecute the statements.

This is the standard behavior of Cockroach, so we need to implement this mechanism for each DB calls.

View xxx.md

#Fedora devel-env setup

From nothing to up and running dev environment [With Fedora]

  • Currently working on Fedora 23
  • Some of the dependencies are discovred by try and try and try again and fail fail fail then it's work...

Welcome in MS (AkA I don't care about RFC world)

View test.go
package main
import (
"fmt"
"net/http"
"net/http/httptest"
"github.com/vulcand/oxy/forward"
"github.com/vulcand/oxy/testutils"
"strconv"
)
View gist:f4facb9bf93cb99dbc67c4ebf12ce07c
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2013:
# Sébastien Pasche, braoru@gmail.com
#
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
View gist:946650dc501468e0e1b942c95273d663
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# Copyright (C) 2015-:
# Pasche Sebastien, sebastien.pasche@leshop.ch
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
View error
E1014 11:31:45.018967144 10074 ev_epoll_linux.c:1178] pollset_kick: {"created":"@1476437505.018940010","description":"Kick Failure","file":"src/core/lib/iomgr/ev_epoll_linux.c","file_line":258,"referenced_errors":[{"created":"@1476437505.018938087","description":"OS Error","errno":3,"file":"src/core/lib/iomgr/ev_epoll_linux.c","file_line":1091,"os_error":"No such process","syscall":"pthread_kill"}]}
E1014 11:31:45.018992716 10074 completion_queue.c:295] Kick failed: {"created":"@1476437505.018940010","description":"Kick Failure","file":"src/core/lib/iomgr/ev_epoll_linux.c","file_line":258,"referenced_errors":[{"created":"@1476437505.018938087","description":"OS Error","errno":3,"file":"src/core/lib/iomgr/ev_epoll_linux.c","file_line":1091,"os_error":"No such process","syscall":"pthread_kill"}]}
E1014 11:31:45.019075543 9789 tcp_server_posix.c:393] Failed accept4: Invalid argument
View task.py
#!/usr/bin/python -i
from concurrent import futures
import logging
import time
import signal
import datetime
import pykka
View test.py
#!/usr/bin/python -i
from concurrent import futures
import logging
import time
from os import getpid
import datetime
from circuits import Component, Event, Debugger, handler, Worker, BaseComponent
View test_log.log
(test_ciscuit) [sebastien@ecudspa test_ciscuit]$ python test.py
10/07/2016 09:03:33 AM test INFO 8426 140104351950592 init() MainThread Main app is starting
10/07/2016 09:03:33 AM test INFO 8426 140104351950592 init() MainThread Master circuits client is starting
10/07/2016 09:03:33 AM pykka DEBUG 8426 140104351950592 register() MainThread Registered Master (urn:uuid:b8607750-9002-4f61-91b5-0801e5d68f6b)
10/07/2016 09:03:33 AM pykka DEBUG 8426 140104351950592 start() MainThread Starting Master (urn:uuid:b8607750-9002-4f61-91b5-0801e5d68f6b)
<registered[*] (<Debugger/* 8426:MainThread (queued=0) [S]>, <App/* 8426:MainThread (queued=12) [R]> )>
<registered[*] (<CircuitClient/* 8426:MainThread (queued=0) [S]>, <App/* 8426:MainThread (queued=11) [R]> )>
<registered[web] (<TCPServer/web 8426:MainThread (queued=0) [S]>, <Server/web 8426:MainThread (queued=0) [S]> )>
<registered[web] (<HTTP/web 8426:MainThread (queued=0) [S]>, <Server/web 8426:MainThread (queued=0) [S]> )>
<registered[worker] (<Worker/worker 8426:M
You can’t perform that action at this time.