Skip to content

Instantly share code, notes, and snippets.

@philip-doctor
philip-doctor / customer-transaction.clj
Created December 15, 2016 01:14
Example of one way to try to structure clojure code by creating a compositional root, and then a stateful layer around a core of pure functions
(ns customer-bank.core
(:require
[clojure.core.async :as async :refer [go timeout close! put! chan <! >!! go-loop]])
(:gen-class))
(defrecord TransactionLog [action account-number data])
(defn add-to-bank-account [bank-balance deposit-amount]
(let [new-balance (+ bank-balance deposit-amount)]
(prn new-balance)
@philip-doctor
philip-doctor / schema_migration.cql
Last active August 29, 2015 14:26
Schema migration work around
-- depending on how far through the migration you progressed, parts of this may fail
-- this assumes you're using the default name of "OpsCenter" for the opscenter keyspace, otherwise
-- you'll have to rename the "OpsCenter" part.
-- in between each step wait a few minutes, you need to wait for the migrations to propagate around the cluster
-- 5 mins should be more than enough
-- If you don't wait, CQLSH can report success but in reality, it may fail
ALTER TABLE "OpsCenter"."events" ADD message text;
ALTER TABLE "OpsCenter"."events" ADD column_family text;
ALTER TABLE "OpsCenter"."events" ADD target_node text;
If opsc created these backups, there should be no problem, if the customer did something manual, then there is a problem.
This file will be found in a directory structure that looks something like this
/phil-lwc/snapshots/63c75f99-17e1-4b18-b4c7-43b474940192/opscenter_adhoc_2014-12-17-20-22-57-UTC/backup.json
| | |
bucket name | snapshot name
cassandra host id unique to each node
{
"checksums": {
"OpsCenter-events-jb-1-CompressionInfo.db": "3748e83735796d180be2592e46cebf14",